This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.12 by this push:
new 962fe28 [To rel/0.12][IOTDB-2333] Add an example for Cluster setup on
3 nodes (#4656)
962fe28 is described below
commit 962fe2887344fb16241b5c72bd85086f654fa2c1
Author: Mrquan <[email protected]>
AuthorDate: Wed Dec 29 23:20:53 2021 +0800
[To rel/0.12][IOTDB-2333] Add an example for Cluster setup on 3 nodes
(#4656)
* fix the client ip bug in cluster
* fix a typo
* Add an example for Cluster setup on 3 nodes
Co-authored-by: 权思屹 <[email protected]>
---
docs/UserGuide/Cluster/Cluster-Setup-Example.md | 107 ++++++++++++++++++--
docs/zh/UserGuide/Cluster/Cluster-Setup-Example.md | 108 +++++++++++++++++++--
2 files changed, 203 insertions(+), 12 deletions(-)
diff --git a/docs/UserGuide/Cluster/Cluster-Setup-Example.md
b/docs/UserGuide/Cluster/Cluster-Setup-Example.md
index 2570a61..1d7075a 100644
--- a/docs/UserGuide/Cluster/Cluster-Setup-Example.md
+++ b/docs/UserGuide/Cluster/Cluster-Setup-Example.md
@@ -186,23 +186,66 @@ nohup ./sbin/start-node.sh ./node3_conf/ >/dev/null 2>&1 &
## Example of distributed configurations for 3 nodes and 3 replicas
Suppose we need to deploy the distributed IoTDB on three physical nodes, A, B,
and C, whose public network IP is *A\_public\_IP*, *B\_public\_IP*, and
*C\_public\_IP*, and private network IP is *A\_private\_IP*, *B\_private\_IP*,
and *C\_private\_IP*.
-Note: If there is no public network IP or private network IP, both can be set
to the same, just need to ensure that the client can access the server.
+
+Note: If there is no public network IP or private network IP, both can be
**set to the same**, just need to ensure that the client can access the server.
The private ip corresponds to configuration item` internal_ ip `in
iotdb-cluster.properties, and the public ip corresponds to configuration item`
rpc_ address` in iotdb-engine.properties.
### Configurations
+**NodeA**:
+
+***iotdb-cluster.properties***
+
+```
+seed_nodes = A_private_Ip:9003,B_private_Ip:9003,C_private_Ip:9003
+default_replica_num = 3
+internal_meta_port = 9003
+internal_data_port = 40010
+internal_ip = A_private_Ip
+```
+
+***iotdb-engine.properties***
-**Each Node:**
+```
+rpc_port = 6667
+rpc_address = A_public_ip
+```
+
+**NodeB**:
***iotdb-cluster.properties***
-seed\_nodes = *A\_private\_Ip*:9003,*B\_private\_Ip*:9003,*C\_private\_Ip*:9003
+```
+seed_nodes = A_private_Ip:9003,B_private_Ip:9003,C_private_Ip:9003
+default_replica_num = 3
+internal_meta_port = 9003
+internal_data_port = 40010
+internal_ip = B_private_Ip
+```
+
+***iotdb-engine.properties***
+
+```
+rpc_port = 6667
+rpc_address = B_public_ip
+```
-default\_replica\_num = 3
+**NodeC**:
+
+***iotdb-cluster.properties***
-internal\_ip = *A\_private\_Ip* (or *B\_private\_Ip*, *C\_private\_Ip*)
+```
+seed_nodes = A_private_Ip:9003,B_private_Ip:9003,C_private_Ip:9003
+default_replica_num = 3
+internal_meta_port = 9003
+internal_data_port = 40010
+internal_ip = C_private_Ip
+```
***iotdb-engine.properties***
-rpc\_address = *A\_public\_Ip* (or *B\_public\_Ip*, *C\_public\_Ip*)
+```
+rpc_port = 6667
+rpc_address = C_public_ip
+```
### Start IoTDB cluster
@@ -215,3 +258,55 @@ The operation steps are as follows:
* Modify the configuration items.
* Run sh sbin/start-node.sh on each of the three nodes (or run in the
background).
+
+
+
+### Compile from source code:
+
+```
+mvn clean package -DskipTests
+chmod -R 777 ./cluster/target/
+cd cluster/target/iotdb-cluster-0.13.0-SNAPSHOT/
+```
+### Use the official website release version:
+
+Download the release version:
+```
+curl -O
https://downloads.apache.org/iotdb/0.12.4/apache-iotdb-0.12.4-cluster-bin.zip
+```
+
+Unzip the package:
+
+```
+unzip apache-iotdb-0.12.4-cluster-bin.zip
+```
+
+Enter IoTDB cluster root directory:
+
+```
+cd apache-iotdb-0.12.4-cluster-bin
+```
+
+Set default\_replica\_num = 3: default value of this configuration item is 3
+
+Set internal\_ip = private ip of node (e.g. 192.168.1.1)
+```
+sed -i -e 's/^internal_ip=127.0.0.1$/internal_ip=192.168.1.1/g'
conf/iotdb-cluster.properties
+```
+Set seed\_node = A_private_Ip:9003,B_private_Ip:9003,C_private_Ip:9003 (e.g.
private ip of all three nodes are 192.168.1.1,192.168.1.2,192.168.1.3)
+```
+sed -i -e
's/^seed_nodes=127.0.0.1:9003,127.0.0.1:9005,127.0.0.1:9007$/seed_nodes=192.168.1.1:9003,192.168.1.2:9003,192.168.1.3:9003/g'
conf/iotdb-cluster.properties
+```
+Set rpc\_address = public ip of node (e.g. 192.168.1.1)
+```
+sed -i -e 's/^rpc_address=127.0.0.1$/rpc_address=192.168.1.1/g'
conf/iotdb-engine.properties
+```
+
+
+**You can modify the configuration items by yourself instead of using "sed"
command**
+
+Start the three nodes with their configurations:
+
+```
+nohup ./sbin/start-node.sh >/dev/null 2>&1 &
+```
\ No newline at end of file
diff --git a/docs/zh/UserGuide/Cluster/Cluster-Setup-Example.md
b/docs/zh/UserGuide/Cluster/Cluster-Setup-Example.md
index a556cf0..f0afc2b 100644
--- a/docs/zh/UserGuide/Cluster/Cluster-Setup-Example.md
+++ b/docs/zh/UserGuide/Cluster/Cluster-Setup-Example.md
@@ -188,23 +188,67 @@ nohup ./sbin/start-node.sh >/dev/null 2>&1 &nohup
./sbin/start-node.sh ./node2_c
## 3 节点 3 副本分布式搭建示例
假设我们需要在三个物理节点上部署分布式 IoTDB,这三个节点分别为 A, B 和 C,其公网 ip 分别为 A\_public\_IP*,
*B\_public\_IP*, and *C\_public\_IP*,私网 ip 分别为 *A\_private\_IP*,
*B\_private\_IP*, and *C\_private\_IP*.
-注:如果没有公网 ip 或者私网 ip 则两者设置成一致即可,只需要保证客户端能够访问到服务端即可。
+注:如果没有公网 ip 或者私网 ip 则两者**设置成一致**即可,只需要保证客户端能够访问到服务端即可。
私网ip对应iotdb-cluster.properties中的`internal_ip`配置项,公网ip对应iotdb-engine.properties中的`rpc_address`配置项。
### 配置
-**各个节点:**
+**节点A**:
***iotdb-cluster.properties***
-seed\_nodes = *A\_private\_Ip*:9003,*B\_private\_Ip*:9003,*C\_private\_Ip*:9003
+```
+seed_nodes = A_private_Ip:9003,B_private_Ip:9003,C_private_Ip:9003
+default_replica_num = 3
+internal_meta_port = 9003
+internal_data_port = 40010
+internal_ip = A_private_Ip
+```
+
+***iotdb-engine.properties***
+
+```
+rpc_port = 6667
+rpc_address = A_public_ip
+```
+
+**节点B**:
+
+***iotdb-cluster.properties***
+
+```
+seed_nodes = A_private_Ip:9003,B_private_Ip:9003,C_private_Ip:9003
+default_replica_num = 3
+internal_meta_port = 9003
+internal_data_port = 40010
+internal_ip = B_private_Ip
+```
+
+***iotdb-engine.properties***
+
+```
+rpc_port = 6667
+rpc_address = B_public_ip
+```
-default\_replica\_num = 3
+**节点C**:
+
+***iotdb-cluster.properties***
-internal\_ip = *A\_private\_Ip* (or *B\_private\_Ip*, *C\_private\_Ip*)
+```
+seed_nodes = A_private_Ip:9003,B_private_Ip:9003,C_private_Ip:9003
+default_replica_num = 3
+internal_meta_port = 9003
+internal_data_port = 40010
+internal_ip = C_private_Ip
+```
***iotdb-engine.properties***
-rpc\_address = *A\_public\_Ip* (or *B\_public\_Ip*, *C\_public\_Ip*)
+```
+rpc_port = 6667
+rpc_address = C_public_ip
+```
+
### 启动IoTDB集群
@@ -218,3 +262,55 @@ rpc\_address = *A\_public\_Ip* (or *B\_public\_Ip*,
*C\_public\_Ip*)
* 修改配置项。
* 在 3 个节点上分别运行 sh sbin/start-node.sh 即可(后台运行也可)。
+
+
+### 源码编译:
+**在三个节点上分别执行操作**
+```
+mvn clean package -DskipTests
+chmod -R 777 ./cluster/target/
+cd cluster/target/iotdb-cluster-0.13.0-SNAPSHOT/
+```
+
+### 使用官网发布版本:
+**在三个节点上分别执行操作**
+
+下载发布版本:
+
+```
+curl -O
https://downloads.apache.org/iotdb/0.12.4/apache-iotdb-0.12.4-cluster-bin.zip
+```
+
+解压压缩包:
+
+```
+unzip apache-iotdb-0.12.4-cluster-bin.zip
+```
+
+进入IoTDB集群根目录:
+
+```
+cd apache-iotdb-0.12.4-cluster-bin
+```
+
+设置 default\_replica\_num = 3: 配置文件中默认为3,无需修改
+
+设置 internal\_ip = 节点的私有ip (以192.168.1.1为例)
+```
+sed -i -e 's/^internal_ip=127.0.0.1$/internal_ip=192.168.1.1/g'
conf/iotdb-cluster.properties
+```
+设置 seed\_node = A_private_Ip:9003,B_private_Ip:9003,C_private_Ip:9003
(三个节点ip分别为192.168.1.1,192.168.1.2,192.168.1.3为例)
+```
+sed -i -e
's/^seed_nodes=127.0.0.1:9003,127.0.0.1:9005,127.0.0.1:9007$/seed_nodes=192.168.1.1:9003,192.168.1.2:9003,192.168.1.3:9003/g'
conf/iotdb-cluster.properties
+```
+设置 rpc\_address = 节点的公有ip (以192.168.1.1为例)
+```
+sed -i -e 's/^rpc_address=127.0.0.1$/rpc_address=192.168.1.1/g'
conf/iotdb-engine.properties
+```
+**你可以自己修改配置项而不使用“sed”命令**
+
+根据配置文件路径启动三个节点:
+
+```
+nohup ./sbin/start-node.sh >/dev/null 2>&1 &
+```