curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Check Peck <comptechge...@gmail.com>
Subject multiple machines working on different task
Date Fri, 04 Sep 2015 22:17:55 GMT
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