- 案例源码仓库地址: github.com/Rodert/go-d…
- 官方文档: etcd.io/
- 视频教程: 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
与 ETCD 交互
集群
Go+ETCD 编码
安装依赖
编码
github.com/Rodert/go-d…
执行
执行结果: