This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 063ad74  [IoTDB-2223]Add an example for Cluster setup on 3 nodes 
(#4655)
063ad74 is described below

commit 063ad74b7e97c2dc389c15aea3db888246f2b66a
Author: Mrquan <[email protected]>
AuthorDate: Wed Dec 29 21:20:47 2021 +0800

    [IoTDB-2223]Add an example for Cluster setup on 3 nodes (#4655)
---
 docs/UserGuide/Cluster/Cluster-Setup-Example.md    | 107 ++++++++++++++++++--
 docs/UserGuide/Cluster/Cluster-Setup.md            |   4 +-
 docs/zh/UserGuide/Cluster/Cluster-Setup-Example.md | 108 +++++++++++++++++++--
 docs/zh/UserGuide/Cluster/Cluster-Setup.md         |   4 +-
 4 files changed, 207 insertions(+), 16 deletions(-)

diff --git a/docs/UserGuide/Cluster/Cluster-Setup-Example.md 
b/docs/UserGuide/Cluster/Cluster-Setup-Example.md
index 48e62d6..8ac6702 100644
--- a/docs/UserGuide/Cluster/Cluster-Setup-Example.md
+++ b/docs/UserGuide/Cluster/Cluster-Setup-Example.md
@@ -167,23 +167,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
+```
 
-default\_replica\_num = 3
+***iotdb-engine.properties***
 
-internal\_ip = *A\_private\_Ip* (or *B\_private\_Ip*, *C\_private\_Ip*)
+```
+rpc_port = 6667
+rpc_address = B_public_ip 
+```
+
+**NodeC**:
+
+***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 = 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
 
@@ -196,3 +239,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/UserGuide/Cluster/Cluster-Setup.md 
b/docs/UserGuide/Cluster/Cluster-Setup.md
index 8830f65..67382a1 100644
--- a/docs/UserGuide/Cluster/Cluster-Setup.md
+++ b/docs/UserGuide/Cluster/Cluster-Setup.md
@@ -208,7 +208,7 @@ To stop the services of all the nodes on a single machine, 
you need to execute t
 
 | Name        | internal\_ip                                                 |
 | ----------- | ------------------------------------------------------------ |
-| Description | IP address of internal communication between nodes in IOTDB 
cluster, such as heartbeat, snapshot, raft log, etc |
+| Description | IP address of internal communication between nodes in IOTDB 
cluster, such as heartbeat, snapshot, raft log, etc. **`internal_ip` is a 
private ip.** |
 | Type        | String                                                       |
 | Default     | 127.0.0.1                                                    |
 | Effective   | After restart system, shall NOT change after cluster is up   |
@@ -253,7 +253,7 @@ To stop the services of all the nodes on a single machine, 
you need to execute t
 
 | Name        | seed\_nodes                                                  |
 | ----------- | ------------------------------------------------------------ |
-| Description | The address of the nodes in the cluster, 
`{IP/DOMAIN}:internal_meta_port` format, separated by commas; for the 
pseudo-distributed mode, you can fill in `localhost`, or `127.0.0.1` or mixed, 
but the real ip address cannot appear; for the distributed mode, real ip or 
hostname is supported, but `localhost` or `127.0.0.1` cannot appear. When used 
by `start-node.sh(.bat)`, this configuration means the nodes that will form the 
initial cluster, so every node that use `start-node [...]
+| Description | The address(internal ip) of the nodes in the cluster, 
`{IP/DOMAIN}:internal_meta_port` format, separated by commas; for the 
pseudo-distributed mode, you can fill in `localhost`, or `127.0.0.1` or mixed, 
but the real ip address cannot appear; for the distributed mode, real ip or 
hostname is supported, but `localhost` or `127.0.0.1` cannot appear. When used 
by `start-node.sh(.bat)`, this configuration means the nodes that will form the 
initial cluster, so every node that us [...]
 | Type        | String                                                       |
 | Default     | 127.0.0.1:9003,127.0.0.1:9005,127.0.0.1:9007                 |
 | Effective   | After restart system                                         |
diff --git a/docs/zh/UserGuide/Cluster/Cluster-Setup-Example.md 
b/docs/zh/UserGuide/Cluster/Cluster-Setup-Example.md
index 72cad8d..490d639 100644
--- a/docs/zh/UserGuide/Cluster/Cluster-Setup-Example.md
+++ b/docs/zh/UserGuide/Cluster/Cluster-Setup-Example.md
@@ -170,23 +170,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 
+```
 
-default\_replica\_num = 3
+**节点B**:
 
-internal\_ip = *A\_private\_Ip* (or *B\_private\_Ip*, *C\_private\_Ip*)
+***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\_address = *A\_public\_Ip* (or *B\_public\_Ip*, *C\_public\_Ip*)
+```
+rpc_port = 6667
+rpc_address = B_public_ip 
+```
+
+**节点C**:
+
+***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 = C_private_Ip
+```
+
+***iotdb-engine.properties***
+
+```
+rpc_port = 6667
+rpc_address = C_public_ip 
+```
+
 
 ### 启动IoTDB集群
 
@@ -200,3 +244,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 &
+```
diff --git a/docs/zh/UserGuide/Cluster/Cluster-Setup.md 
b/docs/zh/UserGuide/Cluster/Cluster-Setup.md
index f205e55..6cd5b81 100644
--- a/docs/zh/UserGuide/Cluster/Cluster-Setup.md
+++ b/docs/zh/UserGuide/Cluster/Cluster-Setup.md
@@ -205,7 +205,7 @@ iotdb-engines.properties 配置文件中的部分内容会不再生效:
 
 | 名字         | internal_ip                                                  |
 | ------------ | ------------------------------------------------------------ |
-| 描述         | IOTDB 集群各个节点之间内部通信的 IP 地址,比如心跳、snapshot 快照、raft log 等 |
+| 描述         | IOTDB 集群各个节点之间内部通信的 IP 地址,比如心跳、snapshot 快照、raft log 
等。**`internal_ip`是集群内部的私有ip** |
 | 类型         | String                                                       |
 | 默认值       | 127.0.0.1                                                    |
 | 改后生效方式 | 重启服务生效,集群建立后不可再修改                           |
@@ -250,7 +250,7 @@ iotdb-engines.properties 配置文件中的部分内容会不再生效:
 
 | 名字         | seed_nodes                                                   |
 | ------------ | ------------------------------------------------------------ |
-| 描述         | 
集群中节点的地址,`{IP/DOMAIN}:internal_meta_port`格式,用逗号分割;对于伪分布式模式,可以都填写`localhost`,或是`127.0.0.1`
 或是混合填写,但是不能够出现真实的 ip 地址;对于分布式模式,支持填写 real ip 或是 
hostname,但是不能够出现`localhost`或是`127.0.0.1`。当使用`start-node.sh(.bat)`启动节点时,此配置意味着形成初始群集的节点,每个节点的`seed_nodes`应该一致,否则群集将初始化失败;当使用`add-node.sh(.bat)`添加节点到集群中时,此配置项可以是集群中已经存在的任何节点,不需要是用`start-node.sh(bat)`构建初始集群的节点。
 |
+| 描述         | 
集群中节点的地址(私有ip),`{IP/DOMAIN}:internal_meta_port`格式,用逗号分割;对于伪分布式模式,可以都填写`localhost`,或是`127.0.0.1`
 或是混合填写,但是不能够出现真实的 ip 地址;对于分布式模式,支持填写 real ip 或是 
hostname,但是不能够出现`localhost`或是`127.0.0.1`。当使用`start-node.sh(.bat)`启动节点时,此配置意味着形成初始群集的节点,每个节点的`seed_nodes`应该一致,否则群集将初始化失败;当使用`add-node.sh(.bat)`添加节点到集群中时,此配置项可以是集群中已经存在的任何节点,不需要是用`start-node.sh(bat)`构建初始集群的节点。
 |
 | 类型         | String                                                       |
 | 默认值       | 127.0.0.1:9003,127.0.0.1:9005,127.0.0.1:9007                 |
 | 改后生效方式 | 重启服务生效                                                 |

Reply via email to