mantl / mesos-consul

Mesos to Consul bridge for service discovery
Apache License 2.0
338 stars 95 forks source link

ip and hostname confusion #9

Open tgermain opened 9 years ago

tgermain commented 9 years ago

Hi,

I've got a lot of messages saying [WARN] master changed to 10.76.102.60. In fact each check lead to this message, even if the mesos leader does not change. Here is a complete log which keep repeating :

2015/07/02 09:35:37 [INFO] Zookeeper leader: <zookeeper hostname>
2015/07/02 09:35:37 [INFO] reloading from master <mesos master hostname>
2015/07/02 09:35:37 [WARN] master changed to 10.76.102.60

I dive into the code to find the source of those logs and it leads me to https://github.com/CiscoCloud/mesos-consul/blob/master/mesos/mesos.go#L71-L81

ip, port := m.getLeader() you get the hostname (the value is named ip, but it's an hostname and the port of mesos leader. It's displayed in this line : [INFO] reloading from master

Then you compare this ip with the one from mesos-API if rip := leaderIP(sj.Leader); rip != ip. Here is the problem, I've manually make the call messos-consul is making to get the sj object.

There is a leader key but the value associated is an ip not a hostname. The comparison always fails since you compare an IP with an hostname.

I've tried to launch mesos with --hostname <ip address of the host>, the problem seems to be resolve.

I'm not sure if you can qualified this as a bug, but at least it could be mentioned in the documentation.