Uploading Configuration Files to ZooKeeper

3 minute read

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

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

  • The ZooKeeper software must be installed on the network.

Location of ZKConfigTool

CloudBees Flow 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>
OptionDescription

--commanderPropertiesFile <path_to_file>

Import the CloudBees Flow server commander.properties file.

--confSecurityFolder <path_to_folder>

Import the CloudBees Flow server conf/security folder.

--databasePropertiesFile <path_to_file>

Import the CloudBees Flow server database.properties file.

--help

Show the command help.

--keystoreFile <path_to_file>

Import the CloudBees Flow server keystore file.

--<path_to_file>

Import the CloudBees Flow 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 Flow 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 Flow servers in the cluster.

  2. Start one CloudBees Flow server in the cluster.

  3. Check if the CloudBees Flow 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 “tail” the <data_dir>\logs\commander-<hostname>.log file to check for errors that could prevent the CloudBees Flow 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 Flow server is in running state, start the other CloudBees Flow servers so that they can join the cluster.

  7. After all CloudBees Flow 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