mantl / mesos-consul

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

Service found. Not registering. #28

Closed micahlmartin closed 8 years ago

micahlmartin commented 8 years ago

None of the services I launch ever get registered with consul. Here are the logs:

time="2015-10-14T16:21:04Z" level=info msg="Running parseState"
time="2015-10-14T16:21:04Z" level=debug msg="Running RegisterHosts"
time="2015-10-14T16:21:04Z" level=info msg="Host found. Comparing tags: ([agent], [agent])"
time="2015-10-14T16:21:04Z" level=info msg="Host found. Comparing tags: ([leader master], [leader master])"
time="2015-10-14T16:21:04Z" level=debug msg="Done running RegisterHosts"
time="2015-10-14T16:21:04Z" level=debug msg="Service found. Not registering: mesos-consul:127.0.0.1:service1:13254"
time="2015-10-14T16:21:04Z" level=debug msg="Service found. Not registering: mesos-consul:127.0.0.1:service2:49394"
time="2015-10-14T16:21:04Z" level=debug msg="Service found. Not registering: mesos-consul:127.0.0.1:service3:18796"

I'm launching with this command:

docker run -i ciscocloud/mesos-consul \
   --zk=zk://zk-1.service.consul:2181/mesos \
   --refresh=15s \
   --log-level=debug \
   --consul
ChrisAubuchon commented 8 years ago

Try running adding --net=host to your docker command. mesos-consul uses the address of the mesos slave/agent to connect to the Consul agent. In your case, the mesos slave/agent is 127.0.0.1 and the docker container can't connect to it.

One issue that I have to fix is that the service is being added to the serviceCache even if the consul registration fails.

micahlmartin commented 8 years ago

Yes. That does fix it. Thanks.