Tuesday, May 2, 2017

some basic etcd commands

1- enable etcd to listen on other interface, for example you have set your eth0 with ip, so the etcd configuration in /etc.default/etcd will be


2- restart etcd service to take effect with new configuration
$ sudo /etc/init.d/etcd restart

3- to interact with etcd, we can use curl or other http client, or can use etcdctl

- to get auth enable status, we can either command below

$ etcdctl  auth enable
$ curl -XGET

4- add user root and enable authentication
$ etcdctl user add root
$ curl -XPUT -d '{"enabled":"true"}' --user root:password

5- to get list of users
$ curl -XGET --user root:password
$ etcdctl --username root user list

6- create list delete keys

- create key name msg2 with value =hello
$ curl -XPUT -d value="hello" --user root:password
$ etcdctl --username root set /msg2 hello 

- list keys

$ etcdctl ls

- to deletes
$ etcdctl  rm /msg2
$ curl -XDELETE

No comments:

Post a Comment