mantl / mesos-consul

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

Allow the consul addr to be configured #40

Closed mindscratch closed 8 years ago

mindscratch commented 8 years ago

When I try to run mesos-consul I'm unable to specify the location of consul, it seems to want to connect to consul as if it's running on a mesos master node. It would be great if I could specify consul-addr 192.168.1.2, looks like consul-port is already supported.

ChrisAubuchon commented 8 years ago

In order to get a service registered with the correct node in Consul's catalog, it has to be registered with an agent running on the same node as the service. Otherwise all of the services are listed as being on the consul master node and a failed service check affects the consul server instead of the node the service is running on.

mindscratch commented 8 years ago

@ChrisAubuchon that explains it, I was just testing and didn't have agents running on all hosts which had mesos tasks. Thanks.

nnordrum commented 8 years ago

It would be really helpful if this was spelled out somewhere. Adding a paragraph or two on how this should be deployed would be very helpful.

michaeljs1990 commented 8 years ago

So if i have a mesos cluster of say 300 nodes i need to setup consul on every single one? This seems like an insane waste to me.

stevendborrelli commented 8 years ago

This is part of the consul design. It is expected to run an agent on every node so that registrations and health checks are performed locally.

nnordrum commented 8 years ago

just put it in your slave chef/puppet/etc. script that creates the node. It actually simplifies things since you can count on it being there, and helps with multi-data-center functions.

michaeljs1990 commented 8 years ago

True, seems to be a little bit of an issue bridging the gap between using consul with docker/mesos/marathon vs just using it in a VM which is incredibly simple.

ChrisAubuchon commented 8 years ago

The issue is with how Consul registers services. If you have a service running on Mesos agent A and you register that service with a central Consul server, the Consul server becomes the "owner" of the service. So if the consul server is taken out of service, then the service that is running on the is marked as unavailable. If you try to specify the mesos agent as the "owner" while registering at the Consul server, the created service is cleaned up by anti-entropy.