1. Purpose

This document describes how to install and start IoTDB Cluster (1.0.0).

2. Prerequisites

  1. JDK>=1.8.
  2. Max open file 65535.
  3. Disable the swap memory.
  4. Ensure that data/confignode directory has been cleared when starting ConfigNode for the first time, and data/datanode directory has been cleared when starting DataNode for the first time
  5. Turn off the firewall of the server if the entire cluster is in a trusted environment.
  6. By default, IoTDB Cluster will use ports 10710, 10720 for the ConfigNode and 6667, 10730, 10740, 10750 and 10760 for the DataNode. Please make sure those ports are not occupied, or you will modify the ports in configuration files.

3. Get the Installation Package

You can either download the binary release files (see Chap 3.1) or compile with source code (see Chap 3.2).

3.1 Download the binary distribution

  1. Open our website Download PageCluster Setup - 图1open in new window.
  2. Download the binary distribution.
  3. Decompress to get the apache-iotdb-1.0.0-all-bin directory.

3.2 Compile with source code

3.2.1 Download the source code

Git

  1. git clone https://github.com/apache/iotdb.git
  2. git checkout v1.0.0

Website

  1. Open our website Download PageCluster Setup - 图2open in new window.
  2. Download the source code.
  3. Decompress to get the apache-iotdb-1.0.0 directory.

3.2.2 Compile source code

Under the source root folder:

  1. mvn clean package -pl distribution -am -DskipTests

Then you will get the binary distribution under distribution/target/apache-iotdb-1.0.0-SNAPSHOT-all-bin/apache-iotdb-1.0.0-SNAPSHOT-all-bin.

4. Binary Distribution Content

FolderDescription
confConfiguration files folder, contains configuration files of ConfigNode, DataNode, JMX and logback
dataData files folder, contains data files of ConfigNode and DataNode
libJar files folder
licensesLicenses files folder
logsLogs files folder, contains logs files of ConfigNode and DataNode
sbinShell files folder, contains start/stop/remove shell of ConfigNode and DataNode, cli shell
toolsSystem tools

5. Cluster Installation and Configuration

5.1 Cluster Installation

apache-iotdb-1.0.0-SNAPSHOT-all-bin contains both the ConfigNode and the DataNode. Please deploy the files to all servers of your target cluster. A best practice is deploying the files into the same directory in all servers.

If you want to try the cluster mode on one server, please read Cluster Quick StartCluster Setup - 图3open in new window.

5.2 Cluster Configuration

We need to modify the configurations on each server. Therefore, login each server and switch the working directory to apache-iotdb-1.0.0-SNAPSHOT-all-bin. The configuration files are stored in the ./conf directory.

For all ConfigNode servers, we need to modify the common configuration (see Chap 5.2.1) and ConfigNode configuration (see Chap 5.2.2).

For all DataNode servers, we need to modify the common configuration (see Chap 5.2.1) and DataNode configuration (see Chap 5.2.3).

5.2.1 Common configuration

Open the common configuration file ./conf/iotdb-common.properties, and set the following parameters base on the Deployment RecommendationCluster Setup - 图4open in new window:

ConfigurationDescriptionDefault
cluster_nameCluster name for which the Node to join indefaultCluster
config_node_consensus_protocol_classConsensus protocol of ConfigNodeorg.apache.iotdb.consensus.ratis.RatisConsensus
schema_replication_factorSchema replication factor, no more than DataNode number1
schema_region_consensus_protocol_classConsensus protocol of schema replicasorg.apache.iotdb.consensus.ratis.RatisConsensus
data_replication_factorData replication factor, no more than DataNode number1
data_region_consensus_protocol_classConsensus protocol of data replicas. Note that RatisConsensus currently does not support multiple data directoriesorg.apache.iotdb.consensus.iot.IoTConsensus

Notice: The preceding configuration parameters cannot be changed after the cluster is started. Ensure that the common configurations of all Nodes are the same. Otherwise, the Nodes cannot be started.

5.2.2 ConfigNode configuration

Open the ConfigNode configuration file ./conf/iotdb-confignode.properties, and set the following parameters based on the IP address and available port of the server or VM:

ConfigurationDescriptionDefaultUsage
cn_internal_addressInternal rpc service address of ConfigNode127.0.0.1Set to the IPV4 address or domain name of the server
cn_internal_portInternal rpc service port of ConfigNode10710Set to any unoccupied port
cn_consensus_portConfigNode replication consensus protocol communication port10720Set to any unoccupied port
cn_target_config_node_listConfigNode address to which the node is connected when it is registered to the cluster. Note that Only one ConfigNode can be configured.127.0.0.1:10710For Seed-ConfigNode, set to its own cn_internal_address:cn_internal_port; For other ConfigNodes, set to other one running ConfigNode’s cn_internal_address:cn_internal_port

Notice: The preceding configuration parameters cannot be changed after the node is started. Ensure that all ports are not occupied. Otherwise, the Node cannot be started.

5.2.3 DataNode configuration

Open the DataNode configuration file ./conf/iotdb-datanode.properties, and set the following parameters based on the IP address and available port of the server or VM:

ConfigurationDescriptionDefaultUsage
dn_rpc_addressClient RPC Service address127.0.0.1Set to the IPV4 address or domain name of the server
dn_rpc_portClient RPC Service port6667Set to any unoccupied port
dn_internal_addressControl flow address of DataNode inside cluster127.0.0.1Set to the IPV4 address or domain name of the server
dn_internal_portControl flow port of DataNode inside cluster10730Set to any unoccupied port
dn_mpp_data_exchange_portData flow port of DataNode inside cluster10740Set to any unoccupied port
dn_data_region_consensus_portData replicas communication port for consensus10750Set to any unoccupied port
dn_schema_region_consensus_portSchema replicas communication port for consensus10760Set to any unoccupied port
dn_target_config_node_listRunning ConfigNode of the Cluster127.0.0.1:10710Set to any running ConfigNode’s cn_internal_address:cn_internal_port. You can set multiple values, separate them with commas(“,”)

Notice: The preceding configuration parameters cannot be changed after the node is started. Ensure that all ports are not occupied. Otherwise, the Node cannot be started.

6. Cluster Operation

6.1 Starting the cluster

This section describes how to start a cluster that includes several ConfigNodes and DataNodes. The cluster can provide services only by starting at least one ConfigNode and no less than the number of data/schema_replication_factor DataNodes.

The total process are three steps:

  • Start the Seed-ConfigNode
  • Add ConfigNode (Optional)
  • Add DataNode

6.1.1 Start the Seed-ConfigNode

The first Node started in the cluster must be ConfigNode. The first started ConfigNode must follow the tutorial in this section.

The first ConfigNode to start is the Seed-ConfigNode, which marks the creation of the new cluster. Before start the Seed-ConfigNode, please open the common configuration file ./conf/iotdb-common.properties and check the following parameters:

ConfigurationCheck
cluster_nameIs set to the expected name
config_node_consensus_protocol_classIs set to the expected consensus protocol
schema_replication_factorIs set to the expected schema replication count
schema_region_consensus_protocol_classIs set to the expected consensus protocol
data_replication_factorIs set to the expected data replication count
data_region_consensus_protocol_classIs set to the expected consensus protocol

Notice: Please set these parameters carefully based on the Deployment RecommendationCluster Setup - 图5open in new window. These parameters are not modifiable after the Node first startup.

Then open its configuration file ./conf/iotdb-confignode.properties and check the following parameters:

ConfigurationCheck
cn_internal_addressIs set to the IPV4 address or domain name of the server
cn_internal_portThe port isn’t occupied
cn_consensus_portThe port isn’t occupied
cn_target_config_node_listIs set to its own internal communication address, which is cn_internal_address:cn_internal_port

After checking, you can run the startup script on the server:

  1. # Linux foreground
  2. bash ./sbin/start-confignode.sh
  3. # Linux background
  4. nohup bash ./sbin/start-confignode.sh >/dev/null 2>&1 &
  5. # Windows
  6. .\sbin\start-confignode.bat

For more details about other configuration parameters of ConfigNode, see the ConfigNode ConfigurationsCluster Setup - 图6open in new window.

6.1.2 Add more ConfigNodes (Optional)

The ConfigNode who isn’t the first one started must follow the tutorial in this section.

You can add more ConfigNodes to the cluster to ensure high availability of ConfigNodes. A common configuration is to add extra two ConfigNodes to make the cluster has three ConfigNodes.

Ensure that all configuration parameters in the ./conf/iotdb-common.properites are the same as those in the Seed-ConfigNode; otherwise, it may fail to start or generate runtime errors. Therefore, please check the following parameters in common configuration file:

ConfigurationCheck
cluster_nameIs consistent with the Seed-ConfigNode
config_node_consensus_protocol_classIs consistent with the Seed-ConfigNode
schema_replication_factorIs consistent with the Seed-ConfigNode
schema_region_consensus_protocol_classIs consistent with the Seed-ConfigNode
data_replication_factorIs consistent with the Seed-ConfigNode
data_region_consensus_protocol_classIs consistent with the Seed-ConfigNode

Then, please open its configuration file ./conf/iotdb-confignode.properties and check the following parameters:

ConfigurationCheck
cn_internal_addressIs set to the IPV4 address or domain name of the server
cn_internal_portThe port isn’t occupied
cn_consensus_portThe port isn’t occupied
cn_target_config_node_listIs set to the internal communication address of an other running ConfigNode. The internal communication address of the seed ConfigNode is recommended.

After checking, you can run the startup script on the server:

  1. # Linux foreground
  2. bash ./sbin/start-confignode.sh
  3. # Linux background
  4. nohup bash ./sbin/start-confignode.sh >/dev/null 2>&1 &
  5. # Windows
  6. .\sbin\start-confignode.bat

For more details about other configuration parameters of ConfigNode, see the ConfigNode ConfigurationsCluster Setup - 图7open in new window.

6.1.3 Start DataNode

Before adding DataNodes, ensure that there exists at least one ConfigNode is running in the cluster.

You can add any number of DataNodes to the cluster. Before adding a new DataNode,

please open its common configuration file ./conf/iotdb-common.properties and check the following parameters:

ConfigurationCheck
cluster_nameIs consistent with the Seed-ConfigNode

Then open its configuration file ./conf/iotdb-datanode.properties and check the following parameters:

ConfigurationCheck
dn_rpc_addressIs set to the IPV4 address or domain name of the server
dn_rpc_portThe port isn’t occupied
dn_internal_addressIs set to the IPV4 address or domain name of the server
dn_internal_portThe port isn’t occupied
dn_mpp_data_exchange_portThe port isn’t occupied
dn_data_region_consensus_portThe port isn’t occupied
dn_schema_region_consensus_portThe port isn’t occupied
dn_target_config_node_listIs set to the internal communication address of other running ConfigNodes. The internal communication address of the seed ConfigNode is recommended.

After checking, you can run the startup script on the server:

  1. # Linux foreground
  2. bash ./sbin/start-datanode.sh
  3. # Linux background
  4. nohup bash ./sbin/start-datanode.sh >/dev/null 2>&1 &
  5. # Windows
  6. .\sbin\start-datanode.bat

For more details about other configuration parameters of DataNode, see the DataNode ConfigurationsCluster Setup - 图8open in new window.

Notice: The cluster can provide services only if the number of its DataNodes is no less than the number of replicas(max{schema_replication_factor, data_replication_factor}).

6.2 Start Cli

If the cluster is in local environment, you can directly run the Cli startup script in the ./sbin directory:

  1. # Linux
  2. ./sbin/start-cli.sh
  3. # Windows
  4. .\sbin\start-cli.bat

If you want to use the Cli to connect to a cluster in the production environment, Please read the Cli manualCluster Setup - 图9open in new window.

6.3 Verify Cluster

Use a 3C3D(3 ConfigNodes and 3 DataNodes) as an example. Assumed that the IP addresses of the 3 ConfigNodes are 192.168.1.10, 192.168.1.11 and 192.168.1.12, and the default ports 10710 and 10720 are used. Assumed that the IP addresses of the 3 DataNodes are 192.168.1.20, 192.168.1.21 and 192.168.1.22, and the default ports 6667, 10730, 10740, 10750 and 10760 are used.

After starting the cluster successfully according to chapter 6.1, you can run the show cluster details command on the Cli, and you will see the following results:

  1. IoTDB> show cluster details
  2. +------+----------+-------+---------------+------------+-------------------+------------+-------+-------+-------------------+-----------------+
  3. |NodeID| NodeType| Status|InternalAddress|InternalPort|ConfigConsensusPort| RpcAddress|RpcPort|MppPort|SchemaConsensusPort|DataConsensusPort|
  4. +------+----------+-------+---------------+------------+-------------------+------------+-------+-------+-------------------+-----------------+
  5. | 0|ConfigNode|Running| 192.168.1.10| 10710| 10720| | | | | |
  6. | 2|ConfigNode|Running| 192.168.1.11| 10710| 10720| | | | | |
  7. | 3|ConfigNode|Running| 192.168.1.12| 10710| 10720| | | | | |
  8. | 1| DataNode|Running| 192.168.1.20| 10730| |192.168.1.20| 6667| 10740| 10750| 10760|
  9. | 4| DataNode|Running| 192.168.1.21| 10730| |192.168.1.21| 6667| 10740| 10750| 10760|
  10. | 5| DataNode|Running| 192.168.1.22| 10730| |192.168.1.22| 6667| 10740| 10750| 10760|
  11. +------+----------+-------+---------------+------------+-------------------+------------+-------+-------+-------------------+-----------------+
  12. Total line number = 6
  13. It costs 0.012s

If the status of all Nodes is Running, the cluster deployment is successful. Otherwise, read the run logs of the Node that fails to start and check the corresponding configuration parameters.

6.4 Stop IoTDB

This section describes how to manually shut down the ConfigNode or DataNode process of the IoTDB.

6.4.1 Stop ConfigNode by script

Run the stop ConfigNode script:

  1. # Linux
  2. ./sbin/stop-confignode.sh
  3. # Windows
  4. .\sbin\stop-confignode.bat

6.4.2 Stop DataNode by script

Run the stop DataNode script:

  1. # Linux
  2. ./sbin/stop-datanode.sh
  3. # Windows
  4. .\sbin\stop-datanode.bat

6.4.3 Kill Node process

Get the process number of the Node:

  1. jps
  2. # or
  3. ps aux | grep iotdb

Kill the process:

  1. kill -9 <pid>

Notice Some ports require root access, in which case use sudo

6.5 Shrink the Cluster

This section describes how to remove ConfigNode or DataNode from the cluster.

6.5.1 Remove ConfigNode

Before removing a ConfigNode, ensure that there is at least one active ConfigNode in the cluster after the removal. Run the remove-confignode script on an active ConfigNode:

  1. # Linux
  2. # Remove the ConfigNode with confignode_id
  3. ./sbin/remove-confignode.sh <confignode_id>
  4. # Remove the ConfigNode with address:port
  5. ./sbin/remove-confignode.sh <cn_internal_address>:<cn_internal_port>
  6. # Windows
  7. # Remove the ConfigNode with confignode_id
  8. .\sbin\remove-confignode.bat <confignode_id>
  9. # Remove the ConfigNode with address:port
  10. .\sbin\remove-confignode.bat <cn_internal_address>:<cn_internal_portcn_internal_port>

6.5.2 Remove DataNode

Before removing a DataNode, ensure that the cluster has at least the number of data/schema replicas DataNodes. Run the remove-datanode script on an active DataNode:

  1. # Linux
  2. # Remove the DataNode with datanode_id
  3. ./sbin/remove-datanode.sh <datanode_id>
  4. # Remove the DataNode with rpc address:port
  5. ./sbin/remove-datanode.sh <dn_rpc_address>:<dn_rpc_port>
  6. # Windows
  7. # Remove the DataNode with datanode_id
  8. .\sbin\remove-datanode.bat <datanode_id>
  9. # Remove the DataNode with rpc address:port
  10. .\sbin\remove-datanode.bat <dn_rpc_address>:<dn_rpc_port>

7. FAQ

See FAQCluster Setup - 图10open in new window