[root@docker ~]# curl http://127.0.0.1:2379/v2/stats/self
{"name":"default","id":"ce2a822cea30bfca","state":"StateLeader","startTime":"2016-02-02T10:16:08.734974815+08:00","leaderInfo":{"leader":"ce2a822cea30bfca","uptime":"7h10m25.17655575s","startTime":"2016-02-02T10:16:10.036154166+08:00"},"recvAppendRequestCnt":0,"sendAppendRequestCnt":0}[root@docker ~]# Attribute | Comment |
|---|---|
id | 成员的唯一标识 |
leaderInfo.leader | 当前主节点的id |
leaderInfo.uptime | 主节点的主持时间 |
name | 这个成员的名字 |
recvAppendRequestCnt | 这个节点接收到请求数 |
recvBandwidthRate | 这个节点的接收Bps(bytes per second)带宽速率 (follower only) |
recvPkgRate | 这个节点的rps(requests per second)请求速率 (follower only) |
sendAppendRequestCnt | 这个节点的发送过的请求数 |
sendBandwidthRate | 这个节点的发送Bps(bytes per second)带宽速率 (leader only). 在单节点集群中这个属性没有定义. |
sendPkgRate | 这个节点的rps(requests per second)发送请求速率 (leader only). 在单节点集群中这个属性没有定义. |
state | 当前的 leader 或 follower 角色 |
startTime | 这个节点的启动时间 |
存储统计提供了这个节点上的各种操作的统计信息
Note: v2版本将信息保存在了内存中,节点重启后,信息会丢失
[root@docker ~]# curl http://127.0.0.1:2379/v2/stats/store
{"getsSuccess":73,"getsFail":13,"setsSuccess":65,"setsFail":8,"deleteSuccess":3,"deleteFail":2,"updateSuccess":9,"updateFail":4,"createSuccess":7,"createFail":1,"compareAndSwapSuccess":2,"compareAndSwapFail":2,"compareAndDeleteSuccess":2,"compareAndDeleteFail":2,"expireCount":17,"watchers":0}[root@docker ~]#
[root@docker ~]# curl -L https://github.com/coreos/etcd/releases/download/v2.2.4/etcd-v2.2.4-linux-amd64.tar.gz -o etcd-v2.2.4-linux-amd64.tar.gzwget https://github.com/coreos/etcd/releases/download/v2.2.4/etcd-v2.2.4-linux-amd64.tar.gztar -zxvf etcd-v2.2.4-linux-amd64.tar.gz./etcd./etcdctl set keytest "hello world for etcd test"./etcdctl get keytest./etcdnetstat -ant | grep -E '(2379|2380)'curl -L http://127.0.0.1:2379/versioncurl http://127.0.0.1:2379/v2/keys/message -XPUT -d value="Hello world"curl http://127.0.0.1:2379/v2/keys/abc -XPUT -d value="Hello world"curl http://127.0.0.1:2379/v2/keys/abc -XPUT -d value="abc"curl http://127.0.0.1:2379/v2/keys/messagecurl http://127.0.0.1:2379/v2/keys/message -XPUT -d value="hello etcd"curl http://127.0.0.1:2379/v2/keys/message -XDELETEdate ; curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -d ttl=6date ; curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -d ttl=10date; curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -d ttl= -d prevExist=truedate ; curl http://127.0.0.1:2379/v2/keys/foocurl http://127.0.0.1:2379/v2/keys/foo?wait=truecurl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=abccurl http://127.0.0.1:2379/v2/keys/foo -vvcurl http://127.0.0.1:2379/v2/keys/queue -XPOST -d value=Job1curl http://127.0.0.1:2379/v2/keys/queue -XPOST -d value=Job2curl http://127.0.0.1:2379/v2/keys/queue -XPOST -d value=Job3curl -s 'http://127.0.0.1:2379/v2/keys/queue?recursive=true&sorted=true'date +%s ;curl http://127.0.0.1:2379/v2/keys/testdir -XPUT -d ttl=10 -d dir=truedate +%s ;curl http://127.0.0.1:2379/v2/keys/testdir -XPUT -d ttl=10 -d dir=true -d prevExist=truedate +%s ;curl http://127.0.0.1:2379/v2/keys/testdircurl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=onecurl http://127.0.0.1:2379/v2/keys/foo?prevExist=false -XPUT -d value=threecurl http://127.0.0.1:2379/v2/keys/foo?prevValue=two -XPUT -d value=threecurl http://127.0.0.1:2379/v2/keys/foo?prevValue=one -XPUT -d value=fivecurl http://127.0.0.1:2379/v2/keys/foo?prevIndex=99 -XPUT -d value=xxxcurl http://127.0.0.1:2379/v2/keys/foo?prevIndex=90 -XPUT -d value=xxxcurl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=onecurl http://127.0.0.1:2379/v2/keys/foo?prevValue=two -XDELETEcurl http://127.0.0.1:2379/v2/keys/foo?prevIndex=3 -XDELETEcurl http://127.0.0.1:2379/v2/keys/foo?prevValue=one -XDELETEcurl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=onecurl http://127.0.0.1:2379/v2/keys/foo?prevIndex=96 -XDELETEcurl http://127.0.0.1:2379/v2/keys/foocurl http://127.0.0.1:2379/v2/keys/testdir -XPUT -d dir=truecurl http://127.0.0.1:2379/v2/keys/foo_dir/abc -XPUT -d dir=truecurl http://127.0.0.1:2379/v2/keys/curl http://127.0.0.1:2379/v2/keys/?recursive=truecurl http://127.0.0.1:2379/v2/keys/foo_dir/abc?dir=true -XDELETEcurl http://127.0.0.1:2379/v2/keys/foo_dir/abc -XPUT -d value=uiuiuiicurl http://127.0.0.1:2379/v2/keys/foo_dir?dir=true -XDELETEcurl http://127.0.0.1:2379/v2/keys/foo_dir?recursive=true -XDELETEcurl http://127.0.0.1:2379/v2/keys/foo_dircurl http://127.0.0.1:2379/v2/keys/_message -XPUT -d value="Hello hidden"curl http://127.0.0.1:2379/v2/keys/message -XPUT -d value="Hello world"curl http://127.0.0.1:2379/v2/keys/curl http://127.0.0.1:2379/v2/keys/_messageecho "Hello\nWorld" > testfile.txtcurl http://127.0.0.1:2379/v2/keys/testfile -XPUT --data-urlencode value@testfile.txtcurl http://127.0.0.1:2379/v2/stats/leadercurl http://127.0.0.1:2379/v2/stats/selfcurl http://127.0.0.1:2379/v2/stats/store原文地址
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。