Uploading Configuration Files to ZooKeeper

3 minute read

Before starting the CloudBees CD server cluster, you must populate your Apache ZooKeeper server with CloudBees CD database configuration information that all CloudBees CD server nodes will use in the cluster. You use ZKConfigTool to import this information into your ZooKeeper server.

You must run ZKConfigTool after changing any updatable configuration file. Even with multiple ZooKeeper machines, you must do this only once, and the data is propagated to all of those machines.

The following minimum set of files from the <data_dir>\conf directory is imported:

  • database.properties

  • keystore

  • passkey

  • commander.properties

Prerequisites

  • The CloudBees CD server package must be installed on the system.

  • The system must be running a version of Java supported by CloudBees CD. Java is automatically installed with CloudBees CD as part of the Tools installation.

  • The ZooKeeper software must be installed on the network.

Location of ZKConfigTool

CloudBees CD includes ZKConfigTool. It is installed in the following default locations.

  • Windows: C:\Program Files\Electric Cloud\ElectricCommander\server\bin\zk-config-tool-jar-with-dependencies.jar

  • Linux: /opt/electriccloud/electriccommander/server/bin/zk-config-tool-jar-with-dependencies.jar

ZKConfigTool Command Syntax

ZKConfigTool is best run from the <install_dir>/conf directory.

$ java -jar zk-config-tool-jar-with-dependencies.jar <options>
Option Description

--commanderPropertiesFile <path_to_file>

Import the CloudBees CD server commander.properties file.

--confSecurityFolder <path_to_folder>

Import the CloudBees CD server conf/security folder.

--databasePropertiesFile <path_to_file>

Import the CloudBees CD server database.properties file.

--help

Show the command help.

--keystoreFile <path_to_file>

Import the CloudBees CD server keystore file.

--<path_to_file>

Import the CloudBees CD server passkey file.

--readFile <path_on_zookeeper> <path_to_file>

Read the specified file from the ZooKeeper server.

--readFolder < path_on_zookeeper > < path_to_folder >

Read the specified folder from the ZooKeeper server.

--wrapperConfFile<path_to_file>

Import the wrapper.conf file.

--version

Show the version number of the ZKConfigTool tool.

--writeFile <path_on_ zookeeper><path_to_file>

Write the specified file to the ZooKeeper server.

--writeFolder < path_on_zookeeper > < path_to_folder >

Write the specified folder to the Zookeeper server.

Importing the Configuration Files into the ZooKeeper Server Using ZKConfigTool

Run ZKConfigTool to populate the ZooKeeper server with configuration information. The system must have the CloudBees CD tools installed and must be able to communicate with ZooKeeper.

The following command shows how to run ZKConfigTool from the <data_dir>\conf directory.

Linux:

../jre/bin/java -DCOMMANDER_ZK_CONNECTION=<ZooKeeper_Server_IP>:2181 -jar ../server/bin/zk-config-tool-jar-with-dependencies.jar com.electriccloud.commander.cluster.ZKConfigTool --databasePropertiesFile database.properties --keystoreFile keystore --passkeyFile passkey --commanderPropertiesFile commander.properties --confSecurityFolder security

Windows:

"C:\Program Files\Electric Cloud\ElectricCommander\jre\bin\java.exe" -DCOMMANDER_ZK_CONNECTION=<ZooKeeper_Server_IP>:2181 -jar "C:\Program Files\Electric Cloud\ElectricCommander\server\bin\zk-config-tool-jar-with-dependencies.jar" com.electriccloud.commander.cluster.ZKConfigTool --databasePropertiesFile database.properties --keystoreFile keystore --passkeyFile passkey --commanderPropertiesFile commander.properties --confSecurityFolder security

Copying the Configuration Files to the Other Server Nodes

After you upload the new configuration files:

  1. Shut down all running CloudBees CD servers in the cluster.

  2. Start one CloudBees CD server in the cluster.

  3. Check if the CloudBees CD server is running fully by entering the following ectool command:

    ectool --server localhost --timeout 900 getServerStatus --block 1 --serverStateOnly 1

    This command runs for 900 seconds (15 minutes) or until getServerStatus displays either bootstrap or running.

  4. If the output says bootstrap, enter the command again until it says running.

    You can also use tail to follow the <data_dir>\logs\commander-<hostname>.log file to check for errors that could prevent the CloudBees CD server from going to running state.

  5. Copy all configuration files to each of the conf folders of the other server nodes.

    This ensures parity for all server nodes in the cluster.

  6. After the first CloudBees CD server is in running state, start the other CloudBees CD servers so that they can join the cluster.

  7. After all CloudBees CD servers are in running state, check the view of the cluster.

    • On Linux platforms, enter:

      <install_dir>/bin/ectool --server localhost getServerStatus --diagnostics 1 | grep -i "\(<view>\|<service_name>\|<participants>\)"

    • On Windows platforms, enter:

      <install_dir>\bin\ectool --server localhost getServerStatus --diagnostics 1 | findstr "<view> <service_name> <participants>" 2>NULL