mtitek
  • Cloud
  • Big Data
  • CI
  • Install
  • Samples
  • Java
  • Ubuntu
  • Maven
  • Archive
ZooKeeper | ZooKeeper ensemble configuration
  1. ZooKeeper ensemble configuration
  2. Static configuration
  3. Dynamic configuration file

  1. ZooKeeper ensemble configuration
    To add a ZooKeeper instance to the ZooKeeper ensemble, you need to add the following parameter to the file "zoo.cfg":

    • <id>: the ZooKeeper instance id

    • <zk_host_address>: the host name or ip address where the ZooKeeper instance is running

    • <zk_port_1>: is used by peer ZooKeeper instances to communicate with each other

    • <zk_port_2>: is used for the ZooKeeper leader election.

    • <zk_role>: ZooKeeper instances roles ("participant", "observer"). The role is optional, and if not specified it defaults to "participant".

    • <client_port_address>: The client port address is optional, and if not specified it defaults to "0.0.0.0".

    • <client_port>: A client port of a ZooKeeper instance is the port on which the ZooKeeper instance accepts client connection requests.
  2. Static configuration
    To configure ZooKeeper instances that are parts of a ZooKeeper ensemble you can configure the file "zoo.cfg" of each instance to list all instances of the ZooKeeper ensemble.

    For example, I have 3 instances of ZooKeeper installed on 3 hosts: "zkhost1", "zkhost2", and "zkhost3".
    For each instance, I had to modify the file "zoo.cfg" to add the following:

    Example: ZooKeeper configuration file "zoo.cfg" of the host "zkhost1"

    Please note that in previous versions of ZooKeeper, when you start ZooKeeper, the static configuration of the zookeeper ensemble will be copied to a new file and a new parameter ("dynamicConfigFile") will be added to the file "zoo.cfg" to reference this new file:
  3. Dynamic configuration file
    You can configure the file "zoo.cfg" to add a dynamic configuration of the ZooKeeper instances which are parts of the ZooKeeper ensemble.

    For example, I have 3 instances of ZooKeeper installed on 3 hosts: "zkhost1", "zkhost2", and "zkhost3".
    For each instance, I had to modify the file "zoo.cfg" to add the parameter "dynamicConfigFile" as follow:

    Example: ZooKeeper configuration file "zoo.cfg" of the host "zkhost1"

    The "zoo.cfg.dynamic" file will contain the dynamic configuration of the ZooKeeper ensemble:
© 2020  mtitek