http://ju.outofmemory.cn/entry/105412
Etcd是一个高可用的 Key/Value 存储系统,主要用于分享配置和服务发现。
简单:支持 curl 方式的用户 API (HTTP+JSON)
安全:可选 SSL 客户端证书认证
快速:单实例可达每秒 1000 次写操作
可靠:使用 Raft 实现分布式
下载安装etcd
[root@localhost ~]# wget https://github.com/coreos/etcd/releases/download/v0.4.6/etcd-v0.4.6-linux-amd64.tar.gz
[root@localhost ~]# tar -zxvf etcd-v0.4.6-linux-amd64.tar.gz
[root@localhost ~]# cd etcd-v0.4.6-linux-amd64
[root@localhost etcd-v0.4.6-linux-amd64]# cp etcd* /bin/
[root@localhost ~]# etcd -version
etcd version 0.4.6
简单操作
letong@me:~$ curl -L http://192.168.0.123:4001/v2/keys/lekey -XPUT -d value=”this is key” #添加
{“action”:”set”,”node”:{“key”:”/lekey”,”value”:”this is key”,”modifiedIndex”:4,”createdIndex”:4}}
letong@me:~$ curl -L http://192.168.0.123:4001/v2/keys/lekey #查询
{“action”:”get”,”node”:{“key”:”/lekey”,”value”:”this is key”,”modifiedIndex”:4,”createdIndex”:4}}
letong@me:~$ curl -L http://192.168.0.123:4001/v2/keys/lekey -XDELETE #删除
{“action”:”delete”,”node”:{“key”:”/lekey”,”modifiedIndex”:5,”createdIndex”:4},”prevNode”:{“key”:”/lekey”,”value”:”this is key”,”modifiedIndex”:4,”createdIndex”:4}}