Skip to content

Instantly share code, notes, and snippets.

@progrium
Created May 15, 2014
Embed
What would you like to do?
$ docker run --rm consul -bootstrap
==> WARNING: Bootstrap mode enabled! Do not enable unless necessary
==> WARNING: It is highly recommended to set GOMAXPROCS higher than 1
==> Starting Consul agent...
==> Starting Consul agent RPC...
==> Consul agent running!
Node name: '4bf137905f14'
Datacenter: 'dc1'
Server: true (bootstrap: true)
Client Addr: 127.0.0.1 (HTTP: 8500, DNS: 8600, RPC: 8400)
Cluster Addr: 172.17.0.2 (LAN: 8301, WAN: 8302)
==> Log data will now stream in as it occurs:
2014/05/15 16:03:07 [INFO] serf: EventMemberJoin: 4bf137905f14 172.17.0.2
2014/05/15 16:03:07 [INFO] serf: EventMemberJoin: 4bf137905f14 172.17.0.2
2014/05/15 16:03:07 [INFO] raft: Node at 172.17.0.2:8300 [Follower] entering Follower state
2014/05/15 16:03:07 [INFO] consul: adding server for datacenter: dc1, addr: 172.17.0.2:8300
2014/05/15 16:03:07 [ERR] agent: failed to sync remote state: rpc error: No cluster leader
2014/05/15 16:03:09 [WARN] raft: Heartbeat timeout reached, starting election
2014/05/15 16:03:09 [INFO] raft: Node at 172.17.0.2:8300 [Candidate] entering Candidate state
2014/05/15 16:03:09 [INFO] raft: Election won. Tally: 1
2014/05/15 16:03:09 [INFO] raft: Node at 172.17.0.2:8300 [Leader] entering Leader state
2014/05/15 16:03:09 [INFO] consul: cluster leadership acquired
2014/05/15 16:03:09 [INFO] consul: New leader elected: 4bf137905f14
2014/05/15 16:03:09 [INFO] consul: member '4bf137905f14' joined, marking health alive
2014/05/15 16:14:54 [INFO] serf: EventMemberJoin: 9c43207ad86a 172.17.0.3
2014/05/15 16:14:54 [INFO] raft: Added peer 172.17.0.3:8300, starting replication
2014/05/15 16:14:54 [INFO] consul: member '9c43207ad86a' joined, marking health alive
2014/05/15 16:14:54 [WARN] raft: AppendEntries to 172.17.0.3:8300 rejected, sending older logs (next: 1)
$ docker run --rm consul -join 172.17.0.2
==> WARNING: It is highly recommended to set GOMAXPROCS higher than 1
==> Starting Consul agent...
==> Starting Consul agent RPC...
==> Joining cluster...
Join completed. Synced with 1 initial agents
==> Consul agent running!
Node name: '9c43207ad86a'
Datacenter: 'dc1'
Server: true (bootstrap: false)
Client Addr: 127.0.0.1 (HTTP: 8500, DNS: 8600, RPC: 8400)
Cluster Addr: 172.17.0.3 (LAN: 8301, WAN: 8302)
==> Log data will now stream in as it occurs:
2014/05/15 16:14:54 [INFO] serf: EventMemberJoin: 9c43207ad86a 172.17.0.3
2014/05/15 16:14:54 [INFO] serf: EventMemberJoin: 9c43207ad86a 172.17.0.3
2014/05/15 16:14:54 [INFO] raft: Node at 172.17.0.3:8300 [Follower] entering Follower state
2014/05/15 16:14:54 [INFO] consul: adding server for datacenter: dc1, addr: 172.17.0.3:8300
2014/05/15 16:14:54 [INFO] agent: (LAN) joining: [172.17.0.2]
2014/05/15 16:14:54 [INFO] serf: EventMemberJoin: 4bf137905f14 172.17.0.2
2014/05/15 16:14:54 [INFO] agent: (LAN) joined: 1 Err: <nil>
2014/05/15 16:14:54 [ERR] agent: failed to sync remote state: rpc error: No cluster leader
2014/05/15 16:14:54 [WARN] raft: Failed to get previous log: 15 log not found (last: 0)
FROM ubuntu:trusty
MAINTAINER Jeff Lindsay <progrium@gmail.com>
RUN apt-get -y install unzip
ADD https://dl.bintray.com/mitchellh/consul/0.2.0_linux_amd64.zip /tmp/consul.zip
RUN cd /usr/local/sbin && unzip /tmp/consul.zip && chmod +x /usr/local/sbin/consul
EXPOSE 8300 8301 8302
ENTRYPOINT ["/usr/local/sbin/consul", "agent", "-server", "-data-dir=/tmp/consul"]
CMD []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment