[O’Reilly Media / Infinite Skills] Introduction to CoreOS Training Video [2015, ENG] : Launching A Development CoreOS Cluster : etcd And etcdctl

Interacting with ETCD

$ etcdctl ls /
/coreos.com


$ etcdctl get /coreos.com
/coreos.com: is a directory


$ etcdctl ls / --recursive
/coreos.com
/coreos.com/network
/coreos.com/network/config
/coreos.com/network/subnets
/coreos.com/network/subnets/10.1.22.0-24
/coreos.com/network/subnets/10.1.7.0-24
/coreos.com/network/subnets/10.1.68.0-24
/coreos.com/updateengine
/coreos.com/updateengine/rebootlock
/coreos.com/updateengine/rebootlock/semaphore


$ etcdctl get /coreos.com/updateengine/rebootlock/semaphore
{"semaphore":1,"max":1,"holders":null}


$ etcdctl -o extended get /coreos.com/updateengine/rebootlock/semaphore
Key: /coreos.com/updateengine/rebootlock/semaphore
Created-Index: 5
Modified-Index: 5
TTL: 0
Index: 12383

{"semaphore":1,"max":1,"holders":null}


$ etcdctl mkdir /my_data
$ etcdctl ls / --recursive



$ etcdctl mk /my_data/key myvalue

$ etcdctl get /my_data/key       
myvalue

$ etcdctl update /my_data/key myNewValue

$ etcdctl get /my_data/key
myNewValue

$ etcdctl set /my_data/key2 mykey2

$ etcdctl set /my_data/expiring_key byebye --ttl 5

$ etcdctl rm /my_data/key

$ etcdctl rm /my_data --recursive


[email protected] ~ $ etcdctl watch /test/hello

[email protected] ~ $ etcdctl set /test/hello "hello world"
hello world


[email protected] ~ $ etcdctl -o extended watch /test/hello --recursive

[email protected] ~ $ etcdctl exec-watch --recursive /foo -- sh -c "env | grep ETCD"

[email protected] ~ $ etcdctl set /foo/bar 1
[email protected] ~ $ etcdctl set /foo/bar2 2