Arbitration Cluster
The arbitration cluster stores ECOX metadata, including node configurations and roles.
Note
Unless otherwise specified, the following operations should be performed on all distributed coordination service nodes.
Hostname Resolution
This step is optional. To enable hostname resolution without DNS, add the node
IPs and names to /etc/hosts as follows:
Create User
Create a dedicated user and group (e.g., dcs) to run the arbitration service.
You can adjust these names to align with your system policies
ZooKeeper Cluster
Installation
ZooKeeper requires a Java environment to run, so you'll need to install Java first.
Next, download the ZooKeeper binary distribution. This guide is based on version 3.8.4.
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz
sudo tar -xf apache-zookeeper-3.8.4-bin.tar.gz -C /usr/local/
Tip
To simplify future operations, we recommend adding the ZooKeeper program's
path to the PATH environment variable.
We recommend storing ZooKeeper data in the dcs home directory. Run the
commands below to create the directories, ensuring there is adequate
disk space.
confUsed to store ZooKeeper's configuration files.dataUsed to store ZooKeeper's data files.logsUsed to store ZooKeeper's log files.
Create Configuration File
The ZooKeeper package provides a sample configuration file. Copy this template to create your initial configuration.
Key configuration parameters:
-
dataDirThe directory where ZooKeeper stores in-memory database snapshots and transaction logs (unless a separate dataLogDir is specified).
-
clientPortThe port that the server listens on for client connections (used by ECOX). The default is
2181. -
server.x=[hostname]:nnnn:nnnnDefines the nodes in the ZooKeeper cluster. The
xrepresents the server ID. When the server starts, it identifies itself by reading the myid file in thedataDir. This file must contain an integer matching thexin this setting.Note: Use IP address if hostname resolution is not configured.
For a complete list of configuration parameters, please refer to the ZooKeeper Administrator's Guide.
Configure logging directory using the ZOO_LOG_DIR environment variable:
Finally, create the myid file in the ZooKeeper data directory (dataDir).
This file must contain a single integer that corresponds to the server.x
ID defined in /home/dcs/zook/conf/zoo.cfg.
Perform the following steps on each of the three nodes:
Setup Firewall
If the system firewall is enabled, you must configure it to allow ZooKeeper traffic. ZooKeeper utilizes three ports as defined in the configuration file. Execute the following commands to apply these rules:
Testing
To start the ZooKeeper cluster, run the following command on all cluster nodes:
Note
Switch to the dcs user. Use the full path to start the service if ZooKeeper is not added to your system path.
After startup, verify the cluster status with the command below:
To stop the cluster, execute the following command:
Register Service
To simplify management, register ZooKeeper as a system service using the following configuration:
cat <<'EOF' | sudo tee /etc/systemd/system/zookeeper.service
[Unit]
Description=Zookeeper Service unit Configuration
After=network.target
[Service]
User=dcs
Group=dcs
Type=forking
Environment=ZOO_LOG_DIR=/home/dcs/dcs-data/logs
Environment=ZOO_HOME=/usr/local/apache-zookeeper-3.8.4-bin
ExecStart=/bin/sh -c "${ZOO_HOME}/bin/zkServer.sh --config /home/dcs/dcs-data/conf start"
ExecStop=/bin/sh -c "${ZOO_HOME}/bin/zkServer.sh --config /home/dcs/dcs-data/conf stop"
KillMode=none
Restart=on-failure
RestartSec=30s
[Install]
WantedBy=multi-user.target
EOF
Reload the configuration and enable the service for automatic startup.