Reputation: 354
I am trying Zookeeper for storing the configs for services, so one functionality I need is scheduling, i.e. for some mentioned duration I will swap my current config, with some other config. How can I achieve this in Zookeeper?
Also what is the best UI for the zookeeper?
Upvotes: 1
Views: 578
Reputation: 15261
Q: I am trying Zookeeper for storing the configs for services, so one functionality I need is scheduling, i.e. for some mentioned duration I will swap my current config, with some other config. How can I achieve this in Zookeeper?
Let's assume that you have two applications, one that sets configuration (let's call it A
) and the other that reads it (let's call it B
). A
should create znode in ZooKeeper, named for example /config
, with the configuration data inside. Note that a single znode can keep up to 1 MB of data - that should be probably enough for keeping the configuration. B
then needs to read the content of znode /config
and register a watch. The purpose of watch is to notify B
whenever something changes with that znode.
Particularly, when A
writes new configuration into /config
, watch will ensure that B
gets a notification about it. Important note - watch event is one-time trigger, i.e. when B
gets notification, it needs to register a watch again or it will miss further changes. Also note that ZooKeeper itself does not have any built-in scheduler mechanism - A
will have to rely on its system clock to update the configuration within the specified time frame.
Q: Also what is the best UI for the zookeeper?
Haven't personally tried any of these (zkCli fits my needs), but supposedly the most popular are:
Upvotes: 1