As someone recently new to zookeeper myself I can see the confusion. Here
is what I can suggest and I'm sure others will have far more experienced
To keep things simple I will skip over some details and features.
Zookeeper is essentially an in memory replicated tree. This means any data
you can represent as a tree can be placed in zookeeper and clients can
register to listen for changes to that tree. Mapping a basic XML document
to this model is probably easiest to understand.
Each node in zookeeper can represent a tag in the xml with the same sort
The nodes themselves can have arbitrary data associated with them, though
off hand I'm not sure what the size and type limitations are.
But continuing this example the nodes of XML usually have attributes
associated with them and maybe some content between the open/close tags.
If you were mapping this onto zookeeper one option would be to put those
attributes and perhaps even the content between open/close tags as node
data. You could of course make a sub-node in the tree to represent the
content between open/close tags.
That's essentially it. Some of the practical challenges will likely center
around how your apps currently read config data. These are the areas that
need to be translated into zookeeper compatible logic. Also where today
you may start and read config once to fully take advantage of zookeeper
you'd likely want to react dynamically as state changes in zoookeeper,
though this can obviously be a latter phase as much difficulty can be
hidden here. Depending on how you abstract configuration load/read in your
code today this may or may not represent a big migration challenge.
I'm sure there are many follow on questions but hopefully this gives you
some context to start with.
Also if you brand new to zookeeper you might want to checkout Curator
which can help lower the learning curve by handling some of the
housekeeping required of the client. This client also implements some
common usage patterns (few of which you listed in your question).
On 3/20/13 2:15 AM, "吴靖" <[EMAIL PROTECTED]> wrote:
> I am new to zookeeper. and I 'm quite confused with zookeeper, as i
>know zookeeper is a coordination service for distributed applications.
>In Hbase,Zookeeper keeps all the meta data of the Hbase nodes,so all the
>node can see the same meta data, this is the coordination service.
> but what confused me is how to used zookeeper ? for example If we have
>a distributed system, and we need to unify the configuration files for
>all nodes， how can we use the zookeeper? Just put the configuration files
>in zookeeper(znode) and let the distributed nodes read from zookeeper?
>thank you !