如何学习一门新技术,十年 MarkDown 程序员怎么做

  • 案例源码仓库地址: https://github.com/Rodert/go-demo
  • 官方文档: https://etcd.io/
  • 视频教程: https://space.bilibili.com/404747369

介绍

谈使用场景之前,看看他有哪些功能

官方定义是这样的:
etcd is a strongly consistent, distributed key-value store that provides a reliable way to store data that needs to be accessed by a distributed system or cluster of machines. It gracefully handles leader elections during network partitions and can tolerate machine failure, even in the leader node.

使用场景

  • 服务发现

  • 配置中心

  • 分布式锁

安装&搭建

搭建 ETCD

环境: mac

# 安装
brew install etcd

# 启动
brew services start etcd

# 检查状态
brew services list | grep etcd

# 停止
brew services stop etcd

# 卸载
brew uninstall etcd

与 ETCD 交互

# 检查工具是否安装
etcdctl version

# 写入
etcdctl put mykey "myvalue"

# 获取
etcdctl get mykey

# 删除
etcdctl del mykey

集群

# 查看集群状态
etcdctl cluster-health

Go+ETCD 编码

安装依赖

go get go.etcd.io/etcd/client/v3

编码

https://github.com/Rodert/go-demo

执行

go run main.go

执行结果:


观看教学视频

老开如何快速学习一门新技术,ETCD快速入门


  • 7
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JavaPub-rodert

谢谢老板

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值