Service failover on Consul

847 views
Skip to first unread message

Dimitris Samaras

unread,
Aug 25, 2014, 11:41:29 AM8/25/14
to consu...@googlegroups.com
Hi there, 
i am trying to setup consul for service configuration and failover. 
In my current  test case I have 2 services that consume messages from a Rabbitmq queue aprocess them and write to a db.
Each of these runs on seperate server in the cluster. I want only 1 of them to work at a time but when 1 is down (check failure) the other to autmatically start. The service when healthy never stops only remains idle if Rabbit is empty.
My checks run on 10s intervals.
Could you provide me an example on how blocking queries can be implemented to start the second service.
I have read the guides but i cannot  implement the leader election along with the session locks described in the guides.
I need to create a script for doing so or modify the consumers' (services) code?

Thank you, 
Dimitris

Armon Dadgar

unread,
Aug 25, 2014, 2:56:13 PM8/25/14
to consu...@googlegroups.com, Dimitris Samaras
It sounds like you basically need to do leader election within the consumers.
The consumers elect an active leader who is the one doing the processing, and the
others are hot standbys.

Also take a look at consul-replicate, which implements the leader election logic:

Hope that helps!

Best Regards,
Armon Dadgar
--
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages