describe
Official website cluster configuration example: official documentation
Prepare 2 servers, and they can ping each other and the relevant ports are open:
- 192.168.1.1
- 192.168.1.2
For relevant introduction, please check the official website and related documents.
Configuration
1. Download iotdb version 0.13 (skip if it is already installed), enter the opt directory and download.
cd /opt
wget https://dlcdn.apache.org/iotdb/0.13.4/apache-iotdb-0.13.4-all-bin.zip --no-check-certificate
2. Unzip and enter the folder
unzip apache-iotdb-0.13.4-all-bin.zip
cd apache-iotdb-0.13.4-all-bin
3. Modify the configuration file:iotdb-cluster.properties
vi conf/iotdb-cluster.properties
internal_ip
Is the local IP of the current server, and modify the following configuration
internal_meta_port
And internal_data_port
if it is pseudo-distributed, it must be modified as needed, and the default is enough for real machine clusters.
seed_nodes
It is the IP and iotdb port of all clusters. Multiple clusters are separated by commas.
At this point, the iotdb cluster configuration is completed. Other clusters are the same as this configuration, but need to be modified internal_ip
to the local IP.
但是需要注意:如果往其他机器上配置集群,请勿直接用scp复制已修改的iotdb到其他机器,因为有问题,这个坑我填了很久,一定要复制下载好的iotdb.zip的压缩包或重新下载iotdb包到其他机器。
start up
apache-iotdb-0.13.3-all-bin
Execute in the directory on the 192.168.1.1 machine
./sbin/start-node.sh
If this happens, don't worry. It's because other nodes behind the cluster have not started and a connection timeout exception is thrown.
apache-iotdb-0.13.3-all-bin
Execute in the directory on the 192.168.1.2 machine
./sbin/start-node.sh
At this time 192.168.1.1
, the machine log output is normal.
At this time, 192.168.1.2
the machine log output is normal.
test
1. Open a new xshell window and connect to any server, as long as this server can ping the first two servers and has iotdb.
2. 192.168.1.1
Machine test
Enter apache-iotdb-0.13.3-all-bin
the directory and execute
./sbin/start-cli.sh -h 192.168.1.1
Connection successful, view data
2. 192.168.1.2
Machine test
Enter apache-iotdb-0.13.3-all-bin
the directory and execute
./sbin/start-cli.sh -h 192.168.1.2
Connection successful, view data
3. Test machine data synchronization after inserting data
Currently 192.168.1.2
inserting data is performed on the machine
insert into root.ln.wf02.wt02(timestamp,test) values(1, '测试')
The insertion is successful and there is data.
Log in to 192.168.1.1
the machine to check whether the data is synchronized and written
The data is successfully written and synchronized, and that's it.