ZooKeeper Setup
Feature
ZooKeeper is a centralized service that plays a critical role in maintaining configuration information, providing distributed synchronization, managing naming services, and offering group services. Germain relies on ZooKeeper as an essential component of its infrastructure.
Download
ZooKeeper 3.6.3 or later is supported.
Deploy
Extract the archive to a directory of your choice. In this example, we will use
/opt/zookeeper
.Create a clone of the sample config:
CODEbashCopy codecp /opt/zookeeper/conf/zoo_sample.cfg /opt/zookeeper/conf/zoo.cfg
Update the
dataDir
setting inzoo.cfg
to match the data directory:CODEjavascriptCopy codedataDir=/opt/zookeeper/data
Add the following entries to the end of
zoo.cfg
to disable the ZooKeeper admin server:CODEarduinoCopy codeadmin.enableServer=false admin.serverPort=9080
Start ZooKeeper
This startup method is sufficient for a development or test environment. For a production environment, it is recommended to run ZooKeeper instances as a service.
Run ZooKeeper via the shell (on Linux):
CODEbashCopy code/opt/zookeeper/bin/zkServer.sh start
Run ZooKeeper via command (on Windows):
CODEmakefileCopy codec:\opt\zookeeper\bin\zkServer.cmd
Run ZooKeeper as a service on Windows:
Copy
ZooKeeperService.exe
andZooKeeperService.xml
from{serviceDistroDirectory}\install\zookeeper\
to your ZooKeeper bin directory.From an administrative command line, run:
CODECopy codeZooKeeperService.exe install
Start the Apache ZooKeeper Windows Service using your preferred method.
Bootstrap a ZooKeeper deployment:
Start the ZK command line via:
CODEbashCopy code/opt/zookeeper/bin/zkCli.sh
Execute the following commands from within
zkCli
to populate the required bootstrap entries.Note: The name of the environment in this case will be "germain". Change this value only if you plan to host multiple APM environments on the same ZooKeeper cluster, such as "prod" and "stage".
CODEluaCopy codecreate /config "" create /config/germain "" create /config/germain/rest-services "" create /config/germain/rest-services/logging.config "${catalina.base}/conf/rest-logback.xml" create /config/germain/ingestion-services "" create /config/germain/ingestion-services/logging.config "${catalina.base}/conf/ingestion-logback.xml"
To import existing settings from common.properties
, build and run the germain-apm\Util\ZkConfig
module. The utility requires three arguments:
ZooKeeper target IP and port.
Config root to store the setting under.
Path to
common.properties
file to import.
Example:
arduinoCopy codejava com.germainsoftware.apm.zkconfig.ZKConfig 127.0.0.1:2181 /config/germain/application common.properties
Alternatively, you can use the commands found in {serviceDistroDirectory}\install\zookeeper\bootstrap.zk
to populate common bootstrap settings.