Having fun with Etcd

Etcd is a distributed, consistent key-value store for shared configuration and service discovery, with a focus on being. Etcd is very useful in DevOps context because today Immutable Infrastructure is one of the core principles. Often what people do is store the configs into a K/V store like Etcd and them just export OS_VARS into the OS level that could be an Amazon AMI, Linux or Bare metal, Mesos or even a Docker container.

One of the cool things about Etcd is that you have a pretty simple REST interface to operate over the K/V store.  When you are doing provisioning sometimes you need store IPs, IDS, Tags, etc... and this is very viable solution.

Having fun with Etcd

Install Go and git, Download Etcd from github and build

sudo yum install -y golang git
go version
sudo git clone https://github.com/coreos/etcd
cd etcd
sudo ./build

Add etcd on path on ~/.bashrc

sudo vim ~/.bashrc
export PATH=$PATH:/home/ec2-user/etcd/bin
ESC + : + wq! + ENTER

Source ~/.bashrc

source  vim ~/.bashrc

Check

etcd
etcdctl -v
curl -L http://127.0.0.1:2379/version

etcdctl set /message Hello
etcdctl get /message

set /message4 Hello --ttl 5
curl http://127.0.0.1:2379/v2/keys/

etcdctl mkdir /root
etcdctl set /root/k1 127.0.0.1
etcdctl set /root/k2 127.0.0.2
etcdctl set /root/k3 127.0.0.3
etcdctl ls /root
view raw etcd.md hosted with ❤ by GitHub
Cheers,
Diego Pacheco

Popular posts from this blog

Having fun with Zig Language

C Unit Testing with Check

Cool Retro Terminal