We did this by having each service listen on a node and register/unregister 
based on the contents of that node.  (It did a little more than that as well 
like stop background threads, which is why a filter based approach wouldn’t 
work for us).  It worked ok for us but always felt a bit janky.

Regarding deleting the node, I think that also won’t work because the service 
in question might recreate the node.  (Even if it doesn’t recreate it right 
away, it probably will in the event of a transient zk disconnection).

From: Joe Littlejohn [mailto:[email protected]]
Sent: Wednesday, October 21, 2015 10:46 AM
To: [email protected]
Subject: Temporarily remove a host from service discovery

Hi

Is there a way, when using the service discovery recipe, to temporarily remove 
a host so that is not returned when a client asks for an instance? Ideally I'd 
then like to later be able to reinstate the disabled host. A bit like taking an 
instance out of a load balancer when there is a problem (or you need to do 
something that might affect the instance), and adding it back into the load 
balancer later.

Once option is simply to delete the node in Zookeeper to stop traffic hitting 
that instance, but there's then no way to reinstate it.

This could probably be implemented as a provider strategy, with a flag within 
the node data that says whether the host is enabled. I'm wondering if there is 
a better way. It would be great to have some kind of dashboard to help manage 
the service discovery nodes in Zookeeper.

Would love to hear from anyone that is using the service discovery recipe and 
whether you have come up with any good 'management/admin' strategies.

Cheers

Reply via email to