xyzale
xyzale

Reputation: 795

Consul is unable to find the cluster leader

I used this:

https://github.com/Mashape/docker-kong/tree/master/compose

to run locally Kong on Docker via docker compose. Once I run docker-compose up I get continuously this error in my log:

consul_1 | 2017/05/29 08:44:05 [INFO] raft: Node at 172.17.0.4:8300 [Candidate] entering Candidate state
consul_1 | 2017/05/29 08:44:05 [ERR] raft: Failed to make RequestVote RPC to 172.17.0.3:8300: dial tcp 172.17.0.3:8300: connection refused
consul_1 | 2017/05/29 08:44:05 [ERR] raft: Failed to make RequestVote RPC to 172.17.0.2:8300: dial tcp 172.17.0.2:8300: connection refused
consul_1 | 2017/05/29 08:44:06 [ERR] agent: failed to sync changes: No cluster leader
consul_1 | 2017/05/29 08:44:06 [ERR] agent: failed to sync changes: No cluster leader
consul_1 | 2017/05/29 08:44:06 [ERR] agent: failed to sync changes: No cluster leader

I searched on Google but I didn't find any specific answer.

Upvotes: 3

Views: 5409

Answers (1)

Robert
Robert

Reputation: 36773

This is happening because consul 'hardcode' its initial assigned local IP (172.17....), then when you run docker-compose again, it takes a new IP, so it confuses our friend consul.

So, as simple workaround you can docker-compose rm consul and start again docker-compose up. But bear in mind that you can be loosing data of consul (i.e. Key/Value store, but I don't know if your application is using it)

As a better workaround (it's working for me), add -client=0.0.0.0 to tell consul to hardcode something better.

In docker-compose.yml:

consul:
  image: progrium/consul:latest
  command: -server -bootstrap -ui-dir /ui -client=0.0.0.0

Upvotes: 2

Related Questions