Uploading Configuration Files to ZooKeeper

3 minute readScalability

Before starting the CloudBees CD/RO server cluster, you must populate your Apache ZooKeeper server with CloudBees CD/RO database configuration information that all CloudBees CD/RO 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/RO server package must be installed on the system.

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

  • The ZooKeeper software must be installed on the network.

Location of ZKConfigTool

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

  • Windows: C:\Program Files\CloudBees\Software Delivery Automation\server\bin\zk-config-tool-jar-with-dependencies.jar

  • Linux: /opt/cloudbees/sda/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>
OptionDescription

--commanderPropertiesFile <path_to_file>

Import the CloudBees CD/RO server commander.properties file.

--confSecurityFolder <path_to_folder>

Import the CloudBees CD/RO server conf/security folder.

--databasePropertiesFile <path_to_file>

Import the CloudBees CD/RO server database.properties file.

--help

Show the command help.

--keystoreFile <path_to_file>

Import the CloudBees CD/RO server keystore file.

--<path_to_file>

Import the CloudBees CD/RO 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/RO 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\CloudBees\Software Delivery Automation\jre\bin\java.exe" -DCOMMANDER_ZK_CONNECTION=<ZooKeeper_Server_IP>:2181 -jar "C:\Program Files\CloudBees\Software Delivery Automation\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/RO servers in the cluster.

  2. Start one CloudBees CD/RO server in the cluster.

  3. Check if the CloudBees CD/RO 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/RO 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/RO server is in running state, start the other CloudBees CD/RO servers so that they can join the cluster.

  7. After all CloudBees CD/RO 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