Skip to content

ZooKeeper server ports

ZooKeeper servers utilize specific network ports for client connections and internal cluster communication.^[600-developer__big-data__zookpeeper__zookpeeeper-01.md]

Client Port

The port designated for client connections is configured in the zoo.cfg file using the clientPort parameter^[600-developer__big-data__zookpeeper__zookpeeeper-01.md]. By default, this port is set to 2181^[600-developer__big-data__zookpeeper__zookpeeeper-01.md].

Cluster Communication Ports

In a multi-server (clustered) setup, additional ports must be configured for peer-to-peer communication.^[600-developer__big-data__zookpeeper__zookpeeeper-01.md] These are defined in the server.X configuration lines using the format server.X=[hostname]:[port1]:[port2]^[600-developer__big-data__zookpeeper__zookpeeeper-01.md].

  • Port 1 (e.g., 2888): Used by followers to connect to the leader^[600-developer__big-data__zookpeeper__zookpeeeper-01.md].
  • Port 2 (e.g., 3888): Used for leader election^[600-developer__big-data__zookpeeper__zookpeeeper-01.md].

For example, a configuration entry like server.1=zoo1:2888:3888 specifies that the server at zoo1 listens on port 2888 for leader connections and port 3888 for election traffic^[600-developer__big-data__zookpeeper__zookpeeeper-01.md].

Sources

  • 600-developer__big-data__zookpeeper__zookpeeeper-01.md