allegro / marathon-consul

Integrates Marathon apps with Consul service discovery.
Apache License 2.0
191 stars 33 forks source link

marathon-consul (de)registers consul services in all datacenters #286

Closed tomwganem closed 6 years ago

tomwganem commented 6 years ago

From #285

We run federated consul to stich together two mesos cluster installations running in an active-passive configuration. We we run marathon-consul in our passive site against a consul cluster that is configured to not be in "dc1", it de-registers all services in our active site ("dc1") whenever it does a sync.

The relevant piece of code seems to be https://github.com/allegro/marathon-consul/blob/master/consul/consul.go#L82

I think the default behavior should be to only (de)register services in the datacenter that the agent belongs to. And perhaps there should be a config option to select which datacenter that marathon-consul should sync with.

dankraw commented 6 years ago

Hi @tomwganem

If there is a single consul cluster that is used by different mesos/marathon clusters (in your case, they are active and passive clusters), marathon-consul configured for these clusters should have different configurations, so sync will understand they are in fact independent.

There is a property called consul-tag, it's value is added (as a tag) to every service registration in consul. This is the way marathon-consul knows if the service is managed by it, and whether it should touch it. In your case, you should change this value to something like marathon-active, and marathon-passive respectively.

Please let me know if this helps you.

tomwganem commented 6 years ago

I've read the docs and somehow that feature never properly registered in my mind. Sorry for the trouble. We have things running smoothly now. Thank you.

dankraw commented 6 years ago

@tomwganem I'm glad that worked for you. :)