curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jordan Zimmerman <jor...@jordanzimmerman.com>
Subject Re: multiple machines working on different task
Date Fri, 04 Sep 2015 22:20:07 GMT
There are many ways to accomplish this. However, I wrote something that may solve your problem.
Have a look at Nirmata Workflow: http://nirmataoss.github.io/workflow/

Even if you don’t use it directly, you can use the code as a sample of how to do what you
want.

-Jordan

On September 4, 2015 at 3:18:23 PM, Check Peck (comptechgeeky@gmail.com) wrote:

I have a simple requirement as I am using Zookeeper with Curator. I have a  
znode like this "/test/clients/" and some other application will create a  
znode under "/test/clients/" with some data in it and those are each task  
that my other three machines has to perform so it will be like this:-  

This will be a znode "/test/clients/clientid_123" with some data in it,  
let's say Hello World 1  
This will be a znode "/test/clients/clientid_124" with some data in it.  
let's say Hello World 2  
This will be a znode "/test/clients/clientid_125" with some data in it.  
let's say Hello World 3  
This will be a znode "/test/clients/clientid_126" with some data in it.  
let's say Hello World 4  

Now I have three machines in which I will be running a service which will  
use Curator library. I want all those three machine to pick up some  
clientid task from "/test/clients/" znode.  

For example : if machineA is working on "clientid_123", then I don't want  
machineB or machineC working on "clientid_123". A single machine can work  
on multiple clientid task but no two machines should pick same client id  
task.  

How can I do this with zookeeper? I can have all three machines keep a  
watch on "/test/clients/" znode and as soon as anything gets added up in  
this znode then I don't know how to make sure only one is picking client id  
task. I can use leadership but in leadership, only single machine will be  
leader and that single machine will work on all the client id task and  
that's what I dont want.  

I want all the machines working on some client id task.  

Mime
View raw message