Dual active usually refers to two independent machines (or clusters) that perform real-time mirror synchronization. Their configurations are completely independent and can simultaneously receive external writes. Each independent machine (or cluster) can synchronize the data written to itself to another machine (or cluster), and the data of the two machines (or clusters) can achieve final consistency.
It is recommended to prioritize using hostname
for IP configuration during deployment to avoid the problem of database failure caused by modifying the host IP in the later stage. To set the hostname, you need to configure /etc/hosts
on the target server. If the local IP is 192.168.1.3 and the hostname is iotdb-1, you can use the following command to set the server‘s hostname and configure IoTDB’s cn_internal-address
and dn_internal-address
using the hostname.
echo "192.168.1.3 iotdb-1" >> /etc/hosts
Some parameters cannot be modified after the first startup, please refer to the “Installation Steps” section below to set them.
Recommend deploying a monitoring panel, which can monitor important operational indicators and keep track of database operation status at any time. The monitoring panel can be obtained by contacting the business department. The steps for deploying the monitoring panel can be referred to Monitoring Panel Deployment
Taking the dual active version IoTDB built by two single machines A and B as an example, the IP addresses of A and B are 192.168.1.3 and 192.168.1.4, respectively. Here, we use hostname to represent different hosts. The plan is as follows:
Machine | Machine IP | Host Name |
---|---|---|
A | 192.168.1.3 | iotdb-1 |
B | 192.168.1.4 | iotdb-2 |
Install IoTDB on two machines separately, and refer to the deployment documentation for the standalone version Stand-Alone Deployment,The deployment document for the cluster version can be referred to Cluster Deployment。It is recommended that the configurations of clusters A and B remain consistent to achieve the best dual active effect
Create a data synchronization process on machine A, where the data on machine A is automatically synchronized to machine B. Use the cli tool in the sbin directory to connect to the IoTDB database on machine A:
./sbin/start-cli.sh -h iotdb-1
Create and start the data synchronization command with the following SQL:
create pipe AB with source ( 'source.forwarding-pipe-requests' = 'false' ) with sink ( 'sink'='iotdb-thrift-sink', 'sink.ip'='iotdb-2', 'sink.port'='6667' )
Note: To avoid infinite data loops, it is necessary to set the parameter source. forwarding pipe questions
on both A and B to false
, indicating that data transmitted from another pipe will not be forwarded.
Create a data synchronization process on machine B, where the data on machine B is automatically synchronized to machine A. Use the cli tool in the sbin directory to connect to the IoTDB database on machine B
./sbin/start-cli.sh -h iotdb-2
Create and start the pipe with the following SQL:
create pipe BA with source ( 'source.forwarding-pipe-requests' = 'false' ) with sink ( 'sink'='iotdb-thrift-sink', 'sink.ip'='iotdb-1', 'sink.port'='6667' )
Note: To avoid infinite data loops, it is necessary to set the parameter source. forwarding pipe questions
on both A and B to false
, indicating that data transmitted from another pipe will not be forwarded.
After the above data synchronization process is created, the dual active cluster can be started.
#Execute the show cluster command on two nodes respectively to check the status of IoTDB service show cluster
Machine A:
Machine B:
Ensure that every Configurable Node and DataNode is in the Running state.
show pipes
show pipes
Ensure that every pipe is in the RUNNING state.
Execute the following command on machine A:
./sbin/start-cli.sh -h iotdb-1 #Log in to CLI IoTDB> stop pipe AB #Stop the data synchronization process ./sbin/stop-standalone.sh #Stop database service
Execute the following command on machine B:
./sbin/start-cli.sh -h iotdb-2 #Log in to CLI IoTDB> stop pipe BA #Stop the data synchronization process ./sbin/stop-standalone.sh #Stop database service