Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 670 Bytes

2.put-data.MD

File metadata and controls

47 lines (34 loc) · 670 Bytes

启动新 etcd 集群

docker run -d registry.aliyuncs.com/google_containers/etcd:3.5.0-0 /usr/local/bin/etcd

进入 etcd 容器

docker ps|grep etcd
docker exec –it <containerid> sh

存入数据

etcdctl put x 0

读取数据

etcdctl get x -w=json
{"header":{"cluster_id":14841639068965178418,"member_id":10276657743932975437,"revision":2,"raft_term":2},"kvs":[{"key":"eA==","create_revision":2,"mod_revision":2,"version":1,"value":"MA=="}],"count":1}

修改值

etcdctl put x 1

查询最新值

etcdctl get x
x
1

查询历史版本值

etcdctl get x --rev=2
x
0