core@core-01 ~ $ etcdctl ls
/coreos.com
core@core-01 ~ $ etcdctl ls / –recursive
/coreos.com
/coreos.com/network
/coreos.com/network/config
/coreos.com/network/subnets
/coreos.com/network/subnets/10.1.18.0-24
/coreos.com/network/subnets/10.1.19.0-24
/coreos.com/network/subnets/10.1.34.0-24
/coreos.com/updateengine
/coreos.com/updateengine/rebootlock
/coreos.com/updateengine/rebootlock/semaphore
core@core-01 ~ $ etcdctl get /coreos.com/updateengine/rebootlock/semaphore
{“semaphore”:1,”max”:1,”holders”:[]}
core@core-01 ~ $ etcdctl get /coreos.com/network/config
{ “Network”: “10.1.0.0/16” }
core@core-01 ~ $ etcdctl get /coreos.com/network/subnets/10.1.18.0-24
{“PublicIP”:”172.17.8.103″}
core@core-01 ~ $ etcdctl -o extended get /coreos.com/network/subnets/10.1.18.0-24
Key: /coreos.com/network/subnets/10.1.18.0-24
Created-Index: 5712
Modified-Index: 5712
TTL: 82909
Index: 10208
{“PublicIP”:”172.17.8.103″}
core@core-01 ~ $ etcdctl -o extended get /coreos.com/updateengine/rebootlock/semaphore
Key: /coreos.com/updateengine/rebootlock/semaphore
Created-Index: 5
Modified-Index: 5665
TTL: 0
Index: 10233
{“semaphore”:1,”max”:1,”holders”:[]}
core@core-01 ~ $ etcdctl mkdir /mydata
core@core-01 ~ $ etcdctl ls / –recursive
/coreos.com
/coreos.com/updateengine
/coreos.com/updateengine/rebootlock
/coreos.com/updateengine/rebootlock/semaphore
/coreos.com/network
/coreos.com/network/config
/coreos.com/network/subnets
/coreos.com/network/subnets/10.1.18.0-24
/coreos.com/network/subnets/10.1.19.0-24
/coreos.com/network/subnets/10.1.34.0-24
/mydata
core@core-01 ~ $ etcdctl ls / –recursive |grep mydata
/mydata
core@core-01 ~ $ etcdctl mk /mydata/key myvalue
myvalue
core@core-01 ~ $ etcdctl get /mydata/key
myvalue
core@core-01 ~ $ etcdctl update /mydata/key newvalue
newvalue
core@core-01 ~ $ etcdctl get /mydata/key
newvalue
core@core-01 ~ $ etcdctl -o extended get /mydata/key
Key: /mydata/key
Created-Index: 11417
Modified-Index: 11487
TTL: 0
Index: 11530
newvalue
core@core-01 ~ $ etcdctl set /mydata/key2 value2
value2
core@core-01 ~ $ etcdctl get /mydata/key2
value2
core@core-01 ~ $ etcdctl update /mydata/key3 value3
Error: 100: Key not found (/mydata/key3) [11618]
core@core-01 ~ $ etcdctl set /mydata/dir1/dir2/key4 value4
value4
core@core-01 ~ $ etcdctl get /mydata/dir1/dir2/key4
value4
core@core-01 ~ $ etcdctl ls / –recursive |grep mydata
/mydata
/mydata/key
/mydata/key2
/mydata/dir1
/mydata/dir1/dir2
/mydata/dir1/dir2/key4
core@core-01 ~ $ etcdctl set /mydata/expiring byebye –ttl 10
byebye
core@core-01 ~ $ etcdctl get /mydata/expiring byebye
byebye
core@core-01 ~ $ etcdctl ls / –recursive |grep mydata
/mydata
/mydata/key
/mydata/key2
/mydata/dir1
/mydata/dir1/dir2
/mydata/dir1/dir2/key4
/mydata/expiring
core@core-01 ~ $ etcdctl -o extended get /mydata/expiring byebye
Key: /mydata/expiring
Created-Index: 11934
Modified-Index: 11934
TTL: 9
Index: 11935
byebye
core@core-01 ~ $ etcdctl -o extended get /mydata/expiring byebye
Key: /mydata/expiring
Created-Index: 11934
Modified-Index: 11934
TTL: 6
Index: 11940
byebye
core@core-01 ~ $ etcdctl -o extended get /mydata/expiring byebye
Key: /mydata/expiring
Created-Index: 11934
Modified-Index: 11934
TTL: 5
Index: 11945
byebye
core@core-01 ~ $ etcdctl -o extended get /mydata/expiring byebye
Error: 100: Key not found (/mydata/expiring) [11954]
core@core-01 ~ $ etcdctl ls / –recursive |grep mydata
/mydata
/mydata/key
/mydata/key2
/mydata/dir1
/mydata/dir1/dir2
/mydata/dir1/dir2/key4
core@core-01 ~ $ etcdctl watch /test/sample
good morining
core@core-02 ~ $ etcdctl set /test/sample “good morining”
good morining
core@core-01 ~ $ etcdctl -o extended watch /test/sample
Key: /test/sample
Created-Index: 12189
Modified-Index: 12189
PrevNode.Value: good bye
TTL: 0
Index: 12178
good bye
core@core-02 ~ $ etcdctl set /test/sample “good bye”
good bye
core@core-01 ~ $ etcdctl -o extended watch /test/sample
Key: /test/sample
Created-Index: 12229
Modified-Index: 12229
PrevNode.Value: good bye
TTL: 0
Index: 12220
good afternoon
core@core-02 ~ $ etcdctl set /test/sample “good afternoon”
good afternoon
core@core-01 ~ $ etcdctl -o extended watch /test –recursive
[set] /test/second
Key: /test/second
Created-Index: 12452
Modified-Index: 12452
PrevNode.Value: logging off
TTL: 0
Index: 12444
logging off
core@core-02 ~ $ etcdctl set /test/second “logging off”
logging off
—————
core@core-01 ~ $ etcdctl -o extended watch /test –recursive
[set] /test/second
Key: /test/second
Created-Index: 12867
Modified-Index: 12867
PrevNode.Value: logging off
TTL: 0
Index: 12848
the-end
core@core-02 ~ $ etcdctl set /test/second the-end
the-end
—————–
core@core-01 ~ $ etcdctl exec-watch –recursive /foo — sh -c “env |grep ETCD”
ETCD_WATCH_ACTION=set
ETCD_WATCH_MODIFIED_INDEX=13383
ETCD_WATCH_VALUE=one
ETCD_WATCH_KEY=/foo/bar
ETCD_WATCH_ACTION=set
ETCD_WATCH_MODIFIED_INDEX=13390
ETCD_WATCH_VALUE=2
ETCD_WATCH_KEY=/foo/bar2
ETCD_WATCH_ACTION=set
ETCD_WATCH_MODIFIED_INDEX=13391
ETCD_WATCH_VALUE=bye
ETCD_WATCH_KEY=/foo/hai
core@core-02 ~ $ etcdctl set /foo/bar one
one
core@core-02 ~ $ etcdctl set /foo/bar2 2
2
core@core-02 ~ $ etcdctl set /foo/hai bye
bye
core@core-02 ~ $ etcdctl ls / –recursive /foo
/foo/hai
/foo/bar
/foo/bar2
core@core-02 ~ $ etcdctl rm –recursive /foo
core@core-02 ~ $ etcdctl ls / –recursive /foo
Error: 100: Key not found (/foo) [13522]
