Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd...

75

Transcript of Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd...

Page 1: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP
Page 2: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Distributed environment

● Pros: Performance● Cons: ACID - hard to comply

○ Atomicity○ Consistency○ Isolation○ Durability

Page 3: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

etcd = /etc distributed

● Key-Value storage● Consistency● High Availability● Failure tolerant● Cluster Configuration

● /config○ /database

● /feature-flags○ /verbose-logging○ /redesign

Page 4: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

etcd

● open source developed by CoreOS● written in Go● durable● watchable● exposed via HTTP● runtime reconfigurable

Page 5: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Cluster Architecture

Node 1 Node 2

Node 3

etcd etcd

etcdClientetcdctl / HTTP API

port 2380

port 2379

Page 6: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Basic Features - SET

Command line interface - etcdctl

$ etcdctl set /nosql/foo barbar

HTTP API

$ curl -L -X PUT http://localhost:2379/v2/keys/nosql/foo -d value="bar"

{"action":"set","node":{"key":"/nosql/foo","value":"bar","modifiedIndex":23995,"createdIndex":23995}}

Page 7: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Basic Features - LIST

Command line interface - etcdctl

$ etcdctl ls /nosql/nosql/foo

HTTP API

$ curl -L http://localhost:2379/v2/keys/nosql

{"action":"get","node":{"key":"/nosql","dir":true,"nodes":[{"key":"/nosql/foo","value":"bar","modifiedIndex":23931,"createdIndex":23931}],"modifiedIndex":282,"createdIndex":282}}

Page 8: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Basic Features - GET

Command line interface - etcdctl

$ etcdctl get /nosql/foobar

HTTP API

$ curl -L http://localhost:2379/v2/keys/nosql/foo

{"action":"get","node":{"key":"/nosql/foo","value":"bar","modifiedIndex":23931,"createdIndex":23931}}

Page 9: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Basic Features - WATCH

Command line interface - etcdctl

$ etcdctl watch --recursive /web-service/backends...

HTTP API

$ curl -L http://localhost:2379/v2/keys/web-service/backends?wait=true&recursive=true

...

Page 10: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Atomic Compare and Swap

Command line interface - etcdctl

$ etcdctl set --swap-with-value 'two' /foo three

Error: 101: Compare failed ([two != one]) [31627]

HTTP API

$ curl http://localhost:2379/v2/keys/foo?prevValue=two -XPUT -d value=three

{"errorCode":101,"message":"Compare failed","cause":"[two != one]","index":31642}

Page 11: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Cluster Availability

Available

Page 12: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Cluster Availability

Available

Page 13: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Cluster Availability

Available

Page 14: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Cluster Availability

Unavailable

Page 15: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Raft

The understandable distributed consensus protocol

Page 16: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Distributed = “a lot” of nodesConsensus = Agreement

Page 17: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Raft

Data replication

Leader election

Distributed Locks

Page 18: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Three roles:

Page 19: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT

The Leader

Page 20: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT

The Follower

Page 21: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT

The Candidate

Page 22: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

High level example:Leader Election

Page 23: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Leader election

F

F

F

Page 24: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Leader election

C

F

F

Page 25: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Leader election

C

F

F

Vote for me

Vote for me

Page 26: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Leader election

C

F

F

Ok!

Ok!

Page 27: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Leader election

L

F

F

LogEntries & Heartbeat

LogEntries & Heartbeat

Page 28: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Leader election

X

F

F

Page 29: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Leader election

X

F

F

C

Vote for me

Page 30: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Leader election

X

F

F

C

Ok!

Page 31: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Leader election

X

F

F

L

LogEntries & Heartbeat

Page 32: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

High level example:Log Replication

(with network partitions)

Page 33: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

F

L

F

F

F

t(ms)

0 200 400 600 800 1000

0ms

1 “much”

A new uncommitted log entry is added to the leader

Page 34: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

F

L

F

F

F

1 “much”

t(ms)

0 200 400 600 800 1000

10ms

1 “much”

1 “much”

1 “much”

1 “much”Append Entries

On the next heartbeat, the entry is replicated to the followers

Page 35: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

F

L

F

F

F

1 “much”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

1 “much”OK!

The followers acknowledge the entry and the entry is committed

25ms

Page 36: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

F

L

F

F

F

1 “much”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

1 “much”Append entries

On the next heartbeat, the committed entry is replicated to the followers

40ms

Page 37: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

F

L

F

F

F

1 “much”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

1 “much”

On the next heartbeat, the committed entry is replicated to the followers

50ms

Page 38: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

F

L

F

F

F

1 “much”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

1 “much”

A network partition makes a majority of nodes inaccessiblefrom the leader

60ms

Page 39: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

F

L

F

F

F

1 “much”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

2 “wow”

1 “much”

A new log entry is added to the leader

70ms

Page 40: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

F

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

2 “wow”

1 “much”

The leader replicates the entry to the only accessible follower

80ms

Append Entries

Page 41: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

F

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

2 “wow”

1 “much”

The follower acknowledges the entry but there is not a quorum

85ms

OK!

Page 42: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

F

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

2 “wow”

1 “much”

90ms

Page 43: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

C

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

2 “wow”

1 “much”

After an election timeout, one disconnected follower becomes a candidate

190ms

Request vote

Page 44: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

2 “wow”

1 “much”

The candidate receives a majority of votes and becomes a leader

195ms

Vote granted

Page 45: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

2 “wow”

1 “much”

200ms

Page 46: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

1 “much”

1 “much”

2 “wow”

1 “much”

2 “cool”

A log entry is added to the new leader

210ms

Page 47: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

2 “wow”

1 “much”

2 “cool”

The log entry is replicated to the accessible followers

220ms

Append entries

Page 48: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

2 “wow”

1 “much”

2 “cool”

A majority of nodes acknowledge the entry so it becomes committed

225ms

OK!

Page 49: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

2 “wow”

1 “much”

2 “cool”

On the next heartbeat, the followers are notified the entry is committed

240ms

Append entries

Page 50: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

2 “wow”

1 “much”

2 “cool”

The network recovers and there is no longer a partition

255ms

Page 51: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

2 “wow”

1 “much”

2 “cool”

The new leader sends a heartbeat on the next heartbeat timeout

260ms

Append entries

Page 52: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “wow”

t(ms)

0 200 400 600 800 1000

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

2 “wow”

1 “much”

2 “cool”

The leader of term #1 steps down after seeing a new leader in term #2

260ms

Append entries

F

Page 53: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

t(ms)

0 200 400 600 800 1000

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

1 “much”

2 “cool”

Uncommitted entries from disconnected nodes are discarded

260ms

Append entries

F

Page 54: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “cool”

t(ms)

0 200 400 600 800 1000

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

2 “cool”

New log entries are appended to the previously disconnected nodes

260ms

Append entries

F

Page 55: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

RAFT - Log Replication

L

L

F

F

F

1 “much”

2 “cool”

t(ms)

0 200 400 600 800 1000

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

2 “cool”

1 “much”

2 “cool”

260ms

F

Page 56: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP
Page 57: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Bootstrapping the Cluster

● mandatory configuration options○ listen-peer-urls

default: http://localhost:2380

○ listen-client-urls default: http://localhost:2379

○ advertise-client-urls default: http://localhost:2379

○ initial-advertise-peer-urls default: http://localhost:2380

Static

● initial-clusterinfra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380

Page 58: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Bootstrapping the Cluster - Discovery URL

90293c90

_config/size=5

https://discovery.etcd.io/new?size=5

discovery=https://discovery.etcd.io/90293c59191021d1c27ebd9eda963f47

Page 59: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Bootstrapping the Cluster - Discovery URL

https://discovery.etcd.io/90293c59191021d1c27ebd9eda963f47

90293c90/state

_config/size=5

KEY VALUE INDEX

state started 5890

n0 10.0.1.10 5891

Page 60: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Bootstrapping the Cluster - Discovery URL

https://discovery.etcd.io/90293c59191021d1c27ebd9eda963f47

90293c90/state

_config/size=5

KEY VALUE INDEX

state started 5890

n0 10.0.1.10 5891

n1 10.0.1.11 5898

Page 61: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Bootstrapping the Cluster - Discovery URL

https://discovery.etcd.io/90293c59191021d1c27ebd9eda963f47

● When member list size meets expected value, the list is used to bootstrap every node like initial-cluster option in static bootstraping method

● Election process● Cluster is ready

Page 62: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Managing cluster size at runtime

List cluster members$ etcdctl member list

Add cluster member$ etcdctl member add <name> <peerURL>

Remove cluster member$ etcdctl member remove <name>

Page 63: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Comparison with similar technologies

● Zookeeper● Consul● Doozer

Page 64: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Similarities

● Consistent and durable general-purpose K/V store across distributed system

● Based on Paxos or Raft algorithm to quickly converge to a consistent state after disconnecting one of nodes

● Paxos vs. Raft

Page 65: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Zookeeper vs etcd (1)

● Zookeeper is the oldest project from compared databases

○ Mature and has big number of client bindings, tools and API’s.

○ Few years back there was no alternative

● Written in Java○ Zookeeper is more resource hungry than any other

databases

Page 66: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Zookeeper vs etcd (2)

● Zookeeper is more complex than etcd○ Harder to maintain○ It’s harder to configure

● Zookeeper uses Zab ○ implementation of Paxos○ Zab designed for primary-backup

systems rather than for state machine replication

Page 67: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Consul vs etcd (1)

● Written in GO● Consul has more high level

○ Consul implements a full service discovery system in the library

○ DNS server interface, allowing to perform service lookups using the DNS protocol

● Uses RAFT, but different implementation than etcd

● etcd is older then Consul

Page 68: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Consul vs etcd (2)

● HTTP+JSON based API, Curl-able● Internals of consul are not public http:

//www.consul.io/docs/internals/index.html

Page 69: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Doozer vs. etcd (1)

● Written in GO, created by Heroku before etcd

● Not developed anymore ○ has big number of forks

● Doozer implements own Paxos algorithm

Page 70: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Doozer vs. etcd (2)

● Splitted into client (doozer) and server (doozerd)

● ACL permissions are not implemented

Page 71: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Who is using etcd ?

Page 72: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Fleet by CoreOS

Distributed init system

Page 73: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Kubernetes by Google

● container cluster manager● etcd takes care of storing and replicating data used by Kubernetes across

the entire cluster

Page 74: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

Cloud foundry

● cache for information about where and how processes are running within the container runtime

● discovery mechanism for some components.

Many more: 500+ projects on github are using etcd

Page 75: Consistency Distributed environment - DISA Laboratorydisa.fi.muni.cz/wp-content/uploads/etcd.pdfetcd open source developed by CoreOS written in Go durable watchable exposed via HTTP

etcd by CoreOS

● Distributed Key-Value store● Raft consensus protocol● High Availability and Failure tolerant● https://coreos.com/etcd/● https://github.com/coreos/etcd

Thank you