ZooKeeper configuration parameters¶
ZooKeeper configuration parameters are primarily defined in the zoo.cfg file, which controls the behavior of the ZooKeeper server.^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]
Core Parameters¶
- tickTime: Defines the basic time unit (in milliseconds) used by ZooKeeper for heartbeats and timeouts^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]. The source material does not specify a value, though a default of
2000(2 seconds) is shown in the cluster example^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]. - dataDir: Specifies the directory where the snapshot is stored^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]. It is recommended not to use
/tmpfor storage in production environments^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]. - clientPort: The port on which the server listens for client connections^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
Cluster (Replicated) Mode Parameters¶
In a multi-server setup, additional parameters are required to manage the synchronization and connection between nodes^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
- initLimit: Configures the time limit (in ticks) for followers to connect and sync to the leader^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]. For example, a value of
5with atickTimeof 2000ms represents a timeout of 10 seconds. - syncLimit: Configures the time limit (in ticks) for a follower to sync with the leader^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
- server.x: Defines the cluster ensemble members^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]. The format is
server.ID=HOST:PORT:PORT.- The first port is used for follower connections to the leader.
- The second port is used for leader election^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
Server Identification (myid)¶
The dataDir parameter must point to a valid directory containing a file named myid^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]. This file contains the server ID (e.g., "1", "2", or "3") corresponding to the server.x definitions in the configuration file^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
Sources¶
^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]