解压etc-v2.3.20-linux-amd64.tar.gz
cp etcd etcdctl /usr/local/bin/
etcd --version
创建etcd的数据目录
mkdir -p /data/etcd
创建
nohup etcd --name auto_scale --data-dir /data/etcd/
--listen-peer-urls 'http://192.168.0.163:2380,http://192.168.0.163:7001'
--listen-client-urls 'http://192.168.0.163:2379,http://192.168.0.163:4001'
--advertise-client-urls 'http://192.168.0.163:2379,http://192.168.0.163:4001' &
创建message:Hellor world
curl -s http://192.168.0.163:2379/v2/keys/message -XPUT -d value="Hellor world" | python -m json.tool
获取message值
curl -s http://192.168.0.163:2379/v2/keys/message | python -m json.tool
删除message值
curl -s http://192.168.0.163:2379/v2/keys/message -XDELETE | python -m json.tool
设置有时间限制为30秒的ttl_use
curl -s http://192.168.0.163:2379/v2/keys/ttl_use -XPUT -d value="Hellor world" -d ttl=10| python -m json.tool
转载于:https://blog.51cto.com/13491150/2049850