When deploying an Apache IoTDB cluster, the process is straightforward for a basic standalone mode, which involves starting a single ConfigNode and DataNode by executing the start-standalone
script. However, for more advanced distributed modes, such as a 3C3D setup (3 ConfigNodes and 3 DataNodes), each node requires its configuration files and individual execution of the start scripts on each host machine.
As the number of nodes increases, the manual startup process becomes cumbersome and inefficient. To enhance deployment efficiency and enable quick, automated cluster startup and management, a centralized script tool was developed that supports one-click startup and shutdown of multiple nodes.
What is the One-Click Cluster Start/Stop Feature?
In the IoTDB root directory, the sbin
subdirectory contains start-all.sh
and stop-all.sh
scripts. These scripts work in conjunction with the iotdb-cluster.properties
configuration file in the conf
subdirectory to provide one-click startup and shutdown functionality for the cluster in a Linux environment. This feature allows efficient management of the IoTDB cluster lifecycle, simplifying deployment and operational processes.
How to use it?
We need to configure the node information and the host information in the iotdb-cluster.properties
file located in the conf
directory of the IoTDB root directory. Here are the details:
Step 1: Modify the Configuration in iotdb-cluster.properties
# Configure ConfigNodes machine addresses separated by ,
confignode_address_list=
# Configure DataNodes machine addresses separated by ,
datanode_address_list=
# User name for logging in to the deployment machine using ssh
ssh_account=root
# ssh login port
ssh_port=22
# iotdb deployment directory (iotdb should be deployed to the following folders in all machines)
confignode_deploy_path=
datanode_deploy_path=
confignode_address_list
: A comma-separated list of the IP addresses of the host machines where the ConfigNode nodes are to be started/stopped.datanode_address_list
: A comma-separated list of the IP addresses of the host machines where the DataNode nodes are to be started/stopped.ssh_account
: The username used to log into the target host machines via SSH. The same username must be used on all machines, with the default beingroot
.ssh_port
: The SSH port exposed by the target host machines. The default port is 22.confignode_deploy_path
: The path on the target host machines where all ConfigNode nodes to be started/stopped are located. This path must be the same on all target machines.datanode_deploy_path
: The path on the target host machines where all DataNode nodes to be started/stopped are located. This path must be the same on all target machines.
Notes:
If the
iotdb-cluster.properties
configuration file is not configured, executing thestart-all.sh
orstop-all.sh
scripts will by default start/stop the ConfigNode and DataNode nodes in the currentIOTDB_HOME
directory.It is recommended to configure SSH password-free login: Users who have not configured SSH password-free login will be prompted to enter the server password after starting the script for subsequent startup/stop/destruction operations. If SSH password-free login is already configured, there is no need to enter the server password during script execution.
When the cluster configuration changes, this configuration file needs to be updated manually.
Step 2: Execute One-Click Start
./sbin/start-all.sh
Executing this command will sequentially start the ConfigNode and DataNode nodes configured in the iotdb-cluster.properties
file.
Step 3: Execute One-Click Shutdown
./sbin/stop-all.sh
Executing this command will sequentially stop the ConfigNode and DataNode nodes configured in the iotdb-cluster.properties
file.
The Mechanism of One-Click Start/Stop
One-Click Start
During the one-click startup process of an IoTDB cluster, a specific startup sequence is followed: the SeedConfigNode of the cluster is started first, followed by adding other nodes to the cluster.
Startup Process
First, the parent directory of the directory where the script is located is identified and initialized as the
IOTDB_HOME
environment variable.Next, the script checks for the existence and completeness of the
iotdb-cluster.properties
configuration file.If the configuration file is missing or contains unfilled required items, the script defaults to starting a standalone 1C1D mode in the
IOTDB_HOME
directory, equivalent to runningstart-standalone.sh
.If the configuration file is complete, the script starts the ConfigNode nodes on the target hosts in the order specified in the configuration, and immediately starts all DataNode nodes on the same host after each ConfigNode node starts. The script then continues to start the next ConfigNode node until all ConfigNode nodes are started.
Finally, the script sequentially starts the remaining unstarted DataNode nodes to ensure the complete startup of the cluster.
One-Click Stop
In the one-click shutdown process of an IoTDB cluster, the operation sequence is the reverse of the one-click startup process but follows the same initialization and configuration check steps.
Shutdown Process:
First, the parent directory of the directory where the script is located is set as the
IOTDB_HOME
environment variable.Then, the script checks for the existence of the
iotdb-cluster.properties
configuration file.If the file is missing, it stops the standalone 1C1D mode in the
IOTDB_HOME
directory, equivalent to runningstop-standalone.sh
.If the configuration file exists, the script verifies its completeness and stops the standalone 1C1D mode if required items are missing.
If the configuration file is complete, the script stops the DataNode nodes on the target hosts first, followed by stopping the ConfigNode nodes on the same host if they exist. The script continues this process until all DataNode nodes are stopped.
Finally, the script stops the remaining ConfigNode nodes in sequence to ensure the complete shutdown of the cluster.
This process ensures an orderly shutdown of the cluster, avoiding issues that may arise from improper shutdown sequences.
Conclusion
In this article, we explored how to efficiently manage an IoTDB cluster using a carefully designed one-click start and stop script tool. By filling in the necessary node information in the configuration file iotdb-cluster.properties
, users can enjoy the convenience of one-click cluster startup and shutdown. We strongly recommend configuring SSH password-free login to further simplify deployment and operational processes. This automated solution not only improves the startup efficiency of the cluster but also ensures an orderly shutdown, avoiding risks associated with improper operations. It is the ideal choice for quick and reliable management of IoTDB clusters.
For any questions or further discussions, please feel free to reach out to us (contact@timecho.com)