Friday, December 22, 2017

etcd

What is etcd ? https://en.wikipedia.org/wiki/Container_Linux_by_CoreOS#ETCD

Who is CoreOS ? https://en.wikipedia.org/wiki/Container_Linux_by_CoreOS#CoreOS and https://coreos.com/



sudo yum install etcd

etcdctl

etcdctl get pippo
Error: client: etcd cluster is unavailable or misconfigured; error #0: dial tcp 127.0.0.1:2379: getsockopt: connection refused
; error #1: malformed HTTP response "\x15\x03\x01\x00\x02\x02"

error #0: dial tcp 127.0.0.1:2379: getsockopt: connection refused
error #1: malformed HTTP response "\x15\x03\x01\x00\x02\x02"


systemctl start etcd

etcdctl get pippo
Error: 100: Key not found (/pippo) [3]

etcdctl set /example/key pippo
pippo
etcdctl get /example/key
pippo
etcdctl ls /
/example
etcdctl ls /example
/example/key
etcdctl ls /example/key
/example/key

netstat -an | grep 4001
you will see 143 entries (!!!) (use | wc -l to count)

netstat -an | grep 2379
here the HTTP service is running

curl -LsS http://127.0.0.1:2379/v2/keys
{"action":"get","node":{"dir":true,"nodes":[{"key":"/example","dir":true,"modifiedIndex":4,"createdIndex":4}]}}


#to get help
etcd -h

for instance:
etcd --version
etcd Version: 3.2.9
Git SHA: f1d7dd8
Go Version: go1.8.3
Go OS/Arch: linux/amd64


More basic examples here https://coreos.com/etcd/docs/latest/getting-started-with-etcd.html


As usual, great tutorial on "clustering nodes with etcd" by DigitalOcean:
https://www.digitalocean.com/community/tutorials/how-to-use-etcdctl-and-etcd-coreos-s-distributed-key-value-store and https://discovery.etcd.io
and https://coreos.com/etcd/docs/latest/op-guide/clustering.html



No comments: