You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ne...@apache.org on 2021/02/26 06:59:57 UTC
[iotdb] 02/02: change some user doc
This is an automated email from the ASF dual-hosted git repository.
neuyilan pushed a commit to branch change_rpc_port
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 2cc36014f32c6f76e2e181de8dd9e23fcf27dd6d
Author: HouliangQi <ne...@163.com>
AuthorDate: Fri Feb 26 14:59:26 2021 +0800
change some user doc
---
cluster/src/assembly/resources/sbin/start-node.sh | 38 ++++++------
.../java/org/apache/iotdb/cluster/ClusterMain.java | 2 +-
.../iotdb/cluster/config/ClusterDescriptor.java | 1 -
docs/UserGuide/Server/Cluster Setup.md | 67 ++++++++++------------
docs/zh/UserGuide/Server/Cluster Setup.md | 67 ++++++++++------------
.../org/apache/iotdb/db/utils/SerializeUtils.java | 2 +-
6 files changed, 78 insertions(+), 99 deletions(-)
diff --git a/cluster/src/assembly/resources/sbin/start-node.sh b/cluster/src/assembly/resources/sbin/start-node.sh
index 5f84110..d64956f 100755
--- a/cluster/src/assembly/resources/sbin/start-node.sh
+++ b/cluster/src/assembly/resources/sbin/start-node.sh
@@ -27,36 +27,33 @@ if [ -z "${IOTDB_HOME}" ]; then
export IOTDB_HOME="`dirname "$0"`/.."
fi
-IOTDB_CONF=${IOTDB_HOME}/conf
-# IOTDB_LOGS=${IOTDB_HOME}/logs
+enable_printgc=false
+if [ "$#" -ge "1" -a "$1" == "printgc" ]; then
+ enable_printgc=true;
+ shift
+fi
+
+IOTDB_CONF=$1
+if [ -z "${IOTDB_CONF}" ]; then
+ export IOTDB_CONF=${IOTDB_HOME}/conf
+fi
if [ -f "$IOTDB_CONF/iotdb-env.sh" ]; then
- if [ "$#" -ge "1" -a "$1" == "printgc" ]; then
+ if [ $enable_printgc == "true" ]; then
. "$IOTDB_CONF/iotdb-env.sh" "printgc"
- shift
else
. "$IOTDB_CONF/iotdb-env.sh"
fi
+elif [ -f "${IOTDB_HOME}/conf/iotdb-env.sh" ]; then
+ if [ $enable_printgc == "true" ]; then
+ . "${IOTDB_HOME}/conf/iotdb-env.sh" "printgc"
+ else
+ . "${IOTDB_HOME}/conf/iotdb-env.sh"
+ fi
else
echo "can't find $IOTDB_CONF/iotdb-env.sh"
fi
-is_conf_path=false
-for arg do
- shift
- if [ "$arg" == "-c" ]; then
- is_conf_path=true
- continue
- fi
-
- if [ $is_conf_path == true ]; then
- IOTDB_CONF=$arg
- is_conf_path=false
- continue
- fi
- set -- "$@" "$arg"
-done
-
CONF_PARAMS="-s "$*
if [ -n "$JAVA_HOME" ]; then
@@ -89,6 +86,7 @@ launch_service()
iotdb_parms="$iotdb_parms -DTSFILE_HOME=${IOTDB_HOME}"
iotdb_parms="$iotdb_parms -DIOTDB_CONF=${IOTDB_CONF}"
iotdb_parms="$iotdb_parms -DCLUSTER_CONF=${IOTDB_CONF}"
+ iotdb_parms="$iotdb_parms -DTSFILE_CONF=${IOTDB_CONF}"
iotdb_parms="$iotdb_parms -Dname=iotdb\.IoTDB"
exec "$JAVA" $iotdb_parms $IOTDB_JMX_OPTS -cp "$CLASSPATH" "$class" $CONF_PARAMS
return $?
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
index 4332d3c..fd424f5 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
@@ -66,7 +66,7 @@ public class ClusterMain {
if (args.length < 1) {
logger.error(
"Usage: <-s|-a|-r> "
- + "[-D{} <configure folder>] "
+ + "[-D{} <configure folder>] \n"
+ "-s: start the node as a seed\n"
+ "-a: start the node as a new node\n"
+ "-r: remove the node out of the cluster\n",
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/config/ClusterDescriptor.java b/cluster/src/main/java/org/apache/iotdb/cluster/config/ClusterDescriptor.java
index 16a181f..2c20c7e 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/config/ClusterDescriptor.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/config/ClusterDescriptor.java
@@ -123,7 +123,6 @@ public class ClusterDescriptor {
/** load an property file and set TsfileDBConfig variables. */
private void loadProps() {
-
String url = getPropsUrl();
Properties properties = System.getProperties();
if (url != null) {
diff --git a/docs/UserGuide/Server/Cluster Setup.md b/docs/UserGuide/Server/Cluster Setup.md
index 936c1de..6166fdf 100644
--- a/docs/UserGuide/Server/Cluster Setup.md
+++ b/docs/UserGuide/Server/Cluster Setup.md
@@ -35,45 +35,27 @@ To start the service of one of the nodes, you need to execute the following comm
```bash
# Unix/OS X
-> nohup sbin/start-node.sh >/dev/null 2>&1 &
-or
-> nohup sbin/start-node.sh -c <conf_path> -internal_meta_port 9003 >/dev/null 2>&1 &
+> nohup sbin/start-node.sh [printgc] [<conf_path>] >/dev/null 2>&1 &
# Windows
> sbin\start-node.bat
or
-> sbin\start-node.bat -c <conf_path> -internal_meta_port 9003
+> sbin\start-node.bat <conf_path>
```
+`printgc` means whether enable the gc and print gc logs when start the node,
+`<conf_path>` use the configuration file in the `conf_path` folder to override the default configuration file.
-`-c <conf_path>` use the configuration file in the `conf_path` folder to override the default configuration file;
-`-internal_meta_port 9003` overrides the specific configuration item `internal_meta_port`.
-The currently supported items to overwrite the original configurations when starting IoTDB are the followings :
-`internal_meta_port, internal_data_port, cluster_rpc_port, seed_nodes`.
-When both exist, the specified configuration item will overwrite the configurations in the configuration file.
-
-## Example of pseudo-distributed scaffolding for 3 nodes and 2 replicas
+## Example of pseudo-distributed scaffolding for 3 nodes and 3 replicas
```bash
-# First step (Note that this path is not suitable for Windows MinGW)
> mvn clean package -pl cluster -am -Dmaven.test.skip=true
-> cp -rf ./cluster/target/cluster-0.11.0-SNAPSHOT ./cluster/target/cluster-0.11.0-SNAPSHOT1
-> cp -rf ./cluster/target/cluster-0.11.0-SNAPSHOT ./cluster/target/cluster-0.11.0-SNAPSHOT2
-> sed -i -e 's/6667/6668/g' ./cluster/target/cluster-0.11.0-SNAPSHOT1/conf/iotdb-engine.properties
-> sed -i -e 's/6667/6669/g' ./cluster/target/cluster-0.11.0-SNAPSHOT2/conf/iotdb-engine.properties
-
-# Second step: Unix/OS X/Windows (git bash or WSL)
-> sed -i -e 's/31999/32000/g' ./cluster/target/cluster-0.11.0-SNAPSHOT1/conf/iotdb-env.sh
-> sed -i -e 's/31999/32001/g' ./cluster/target/cluster-0.11.0-SNAPSHOT2/conf/iotdb-env.sh
+> cp -rf ./cluster/target/cluster-0.12.0-SNAPSHOT ./cluster/target/cluster-0.12.0-SNAPSHOT1
+> cp -rf ./cluster/target/cluster-0.12.0-SNAPSHOT ./cluster/target/cluster-0.12.0-SNAPSHOT2
+
> chmod -R 777 ./cluster/target/
-> nohup ./cluster/target/cluster-0.11.0-SNAPSHOT/sbin/start-node.sh >/dev/null 2>&1 &
-> nohup ./cluster/target/cluster-0.11.0-SNAPSHOT1/sbin/start-node.sh -internal_meta_port 9005 -internal_data_port 40012 -cluster_rpc_port 6668 >/dev/null 2>&1 &
-> nohup ./cluster/target/cluster-0.11.0-SNAPSHOT2/sbin/start-node.sh -internal_meta_port 9007 -internal_data_port 40014 -cluster_rpc_port 6669 >/dev/null 2>&1 &
-
-# Second step: Windows (MinGW)
-> sed -i -e 's/31999/32000/g' cluster\target\cluster-0.11.0-SNAPSHOT\conf\iotdb-env.bat
-> sed -i -e 's/31999/32001/g' cluster\target\cluster-0.11.0-SNAPSHOT\conf\iotdb-env.bat
-> nohup cluster\target\cluster-0.11.0-SNAPSHOT\sbin\start-node.bat
-> nohup cluster\target\cluster-0.11.0-SNAPSHOT1\sbin\start-node.bat -internal_meta_port 9005 -internal_data_port 40012 -cluster_rpc_port 6668
-> nohup cluster\target\cluster-0.11.0-SNAPSHOT2\sbin\start-node.bat -internal_meta_port 9007 -internal_data_port 40014 -cluster_rpc_port 6669
+
+> nohup ./cluster/target/cluster-0.12.0-SNAPSHOT/sbin/start-node.sh ./cluster/target/test-classes/node1conf/ >/dev/null 2>&1 &
+> nohup ./cluster/target/cluster-0.12.0-SNAPSHOT1/sbin/start-node.sh ./cluster/target/test-classes/node2conf/ >/dev/null 2>&1 &
+> nohup ./cluster/target/cluster-0.12.0-SNAPSHOT2/sbin/start-node.sh ./cluster/target/test-classes/node3conf/ >/dev/null 2>&1 &
```
## OverWrite the configurations of Stand-alone node
@@ -106,6 +88,15 @@ What's more, Users can configure settings of TsFile (the data files), such as th
For detailed description of the two configuration files `iotdb-engine.properties`, `iotdb-env.sh`/`iotdb-env.bat`, please refer to [Configuration Manual](Config%20Manual.md).
The configuration items described below are in the `iotdb-cluster.properties` file.
+* internal\_ip
+
+|Name|internal\_ip|
+|:---:|:---|
+|Description|IP address of internal communication between nodes in IOTDB cluster, such as heartbeat, snapshot, raft log, etc|
+|Type|String|
+|Default|127.0.0.1|
+|Effective| After restart system, shall NOT change after cluster is up|
+
* internal\_meta\_port
|Name|internal\_meta\_port|
@@ -124,22 +115,22 @@ The configuration items described below are in the `iotdb-cluster.properties` fi
|Default|40010|
|Effective| After restart system, shall NOT change after cluster is up|
-* cluster\_rpc\_port
+* open\_server\_rpc\_port
-|Name|cluster\_rpc\_port|
+|Name|open\_server\_rpc\_port|
|:---:|:---|
-|Description|The port used to communicate with the clients (JDBC, CLI, Session API...), please confirm that the port is not reserved by the system and is not occupied|
-|Type|Int32|
-|Default|6667|
+|Description|whether open port for server module (for debug purpose), if true, the single's server rpc_port will be changed to `rpc_port (in iotdb-engines.properties) + 1`|
+|Type|Boolean|
+|Default|False|
|Effective| After restart system|
* seed\_nodes
|Name|seed\_nodes|
|:---:|:---|
-|Description|The address of the nodes in the cluster, `{IP/DOMAIN}:internal_meta_port:internal_data_port:cluster_rpc_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, s [...]
+|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.sh [...]
|Type|String|
-|Default|127.0.0.1:9003:40010:6667,127.0.0.1:9005:40012:6668,127.0.0.1:9007:40014:6669|
+|Default|127.0.0.1:9003,127.0.0.1:9005,127.0.0.1:9007|
|Effective| After restart system|
* rpc\_thrift\_compression\_enable
@@ -157,7 +148,7 @@ The configuration items described below are in the `iotdb-cluster.properties` fi
|:---:|:---|
|Description|Number of cluster replicas of timeseries schema and data. Storage group info is always fully replicated in all nodes.|
|Type|Int32|
-|Default|2|
+|Default|3|
|Effective| After restart system, shall NOT change after cluster is up|
* cluster\_name
diff --git a/docs/zh/UserGuide/Server/Cluster Setup.md b/docs/zh/UserGuide/Server/Cluster Setup.md
index 04c13f4..e8181f7 100644
--- a/docs/zh/UserGuide/Server/Cluster Setup.md
+++ b/docs/zh/UserGuide/Server/Cluster Setup.md
@@ -31,43 +31,25 @@ __集群模式目前是测试版!请谨慎在生产环境中使用。__
```bash
# Unix/OS X
-> nohup sbin/start-node.sh >/dev/null 2>&1 &
-or
-> nohup sbin/start-node.sh -c <conf_path> -internal_meta_port 9003 >/dev/null 2>&1 &
+> nohup sbin/start-node.sh [printgc] [<conf_path>] >/dev/null 2>&1 &
# Windows
> sbin\start-node.bat
-or
-> sbin\start-node.bat -c <conf_path> -internal_meta_port 9003
```
+`printgc`表示在启动的时候,会开启GC日志。
+`<conf_path>`使用`conf_path`文件夹里面的配置文件覆盖默认配置文件。
-`-c <conf_path>`使用`conf_path`文件夹里面的配置文件覆盖默认配置文件; `-internal_meta_port 9003`覆盖特定配置项`internal_meta_port`的配置,
-目前支持的启动覆盖原有配置的配置项有:
-`internal_meta_port、internal_data_port、cluster_rpc_port、seed_nodes`。当配置文件和配置项都被指定的时候,指定配置项的配置会覆盖配置文件中的配置。
-
-## 3节点2副本伪分布式搭建示例
+## 3节点3副本伪分布式搭建示例
```bash
-# 第一步 (注意以下路径在 Windows MinGW 中并不适用)
> mvn clean package -pl cluster -am -Dmaven.test.skip=true
-> cp -rf ./cluster/target/cluster-0.11.0-SNAPSHOT ./cluster/target/cluster-0.11.0-SNAPSHOT1
-> cp -rf ./cluster/target/cluster-0.11.0-SNAPSHOT ./cluster/target/cluster-0.11.0-SNAPSHOT2
-> sed -i -e 's/6667/6668/g' ./cluster/target/cluster-0.11.0-SNAPSHOT1/conf/iotdb-engine.properties
-> sed -i -e 's/6667/6669/g' ./cluster/target/cluster-0.11.0-SNAPSHOT2/conf/iotdb-engine.properties
-
-# 第二步: Unix/OS X/Windows (git bash or WSL)
-> sed -i -e 's/31999/32000/g' ./cluster/target/cluster-0.11.0-SNAPSHOT1/conf/iotdb-env.sh
-> sed -i -e 's/31999/32001/g' ./cluster/target/cluster-0.11.0-SNAPSHOT2/conf/iotdb-env.sh
+> cp -rf ./cluster/target/cluster-0.12.0-SNAPSHOT ./cluster/target/cluster-0.12.0-SNAPSHOT1
+> cp -rf ./cluster/target/cluster-0.12.0-SNAPSHOT ./cluster/target/cluster-0.12.0-SNAPSHOT2
+
> chmod -R 777 ./cluster/target/
-> nohup ./cluster/target/cluster-0.11.0-SNAPSHOT/sbin/start-node.sh >/dev/null 2>&1 &
-> nohup ./cluster/target/cluster-0.11.0-SNAPSHOT1/sbin/start-node.sh -internal_meta_port 9005 -internal_data_port 40012 -cluster_rpc_port 6668 >/dev/null 2>&1 &
-> nohup ./cluster/target/cluster-0.11.0-SNAPSHOT2/sbin/start-node.sh -internal_meta_port 9007 -internal_data_port 40014 -cluster_rpc_port 6669 >/dev/null 2>&1 &
-
-# 第二步: Windows (MinGW)
-> sed -i -e 's/31999/32000/g' cluster\target\cluster-0.11.0-SNAPSHOT\conf\iotdb-env.bat
-> sed -i -e 's/31999/32001/g' cluster\target\cluster-0.11.0-SNAPSHOT\conf\iotdb-env.bat
-> nohup cluster\target\cluster-0.11.0-SNAPSHOT\sbin\start-node.bat
-> nohup cluster\target\cluster-0.11.0-SNAPSHOT1\sbin\start-node.bat -internal_meta_port 9005 -internal_data_port 40012 -cluster_rpc_port 6668
-> nohup cluster\target\cluster-0.11.0-SNAPSHOT2\sbin\start-node.bat -internal_meta_port 9007 -internal_data_port 40014 -cluster_rpc_port 6669
+
+> nohup ./cluster/target/cluster-0.12.0-SNAPSHOT/sbin/start-node.sh ./cluster/target/test-classes/node1conf/ >/dev/null 2>&1 &
+> nohup ./cluster/target/cluster-0.12.0-SNAPSHOT1/sbin/start-node.sh ./cluster/target/test-classes/node2conf/ >/dev/null 2>&1 &
+> nohup ./cluster/target/cluster-0.12.0-SNAPSHOT2/sbin/start-node.sh ./cluster/target/test-classes/node3conf/ >/dev/null 2>&1 &
```
## 被覆盖的单机版选项
@@ -99,6 +81,15 @@ iotdb-engines.properties配置文件中的部分内容会不再生效:
`iotdb-engine.properties`、`iotdb-env.sh`/`iotdb-env.bat` 两个配置文件详细说明请参考[配置手册](Config%20Manual.md),下面描述的配置项是在`iotdb-cluster.properties`文件中的。
+* internal\_ip
+
+|名字|internal\_ip|
+|:---:|:---|
+|描述|IOTDB 集群各个节点之间内部通信的IP地址,比如心跳、snapshot快照、raft log等|
+|类型|String|
+|默认值|127.0.0.1|
+|改后生效方式|重启服务器生效,集群建立后不可再修改|
+
* internal\_meta\_port
|名字|internal\_meta\_port|
@@ -117,22 +108,22 @@ iotdb-engines.properties配置文件中的部分内容会不再生效:
|默认值|40010|
|改后生效方式|重启服务器生效,集群建立后不可再修改|
-* cluster\_rpc\_port
+* open\_server\_rpc\_port
-|名字|cluster\_rpc\_port|
+|名字|open\_server\_rpc\_port|
|:---:|:---|
-|描述|与客户端(JDBC,Session API, CLI等)通信的端口,请确认该端口不是系统保留端口并且未被占用|
-|类型|Int32|
-|默认值|6667|
-|改后生效方式|重启服务器生效|
+|描述|是否打开单机模块的rpc port,用于调试模式,如果设置为true,则单机模块的rpc port设置为`rpc_port (in iotdb-engines.properties) + 1`|
+|类型|Boolean|
+|默认值|false|
+|改后生效方式|重启服务器生效,集群建立后不可再修改|
* seed\_nodes
|名字|seed\_nodes|
|:---:|:---|
-|描述|集群中节点的地址,`{IP/DOMAIN}:internal_meta_port:internal_data_port:cluster_rpc_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/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:40010:6667,127.0.0.1:9005:40012:6668,127.0.0.1:9007:40014:6669|
+|默认值|127.0.0.1:9003,127.0.0.1:9005,127.0.0.1:9007|
|改后生效方式|重启服务器生效|
* rpc\_thrift\_compression\_enable
@@ -150,7 +141,7 @@ iotdb-engines.properties配置文件中的部分内容会不再生效:
|:---:|:---|
|描述|集群副本数|
|类型|Int32|
-|默认值|2|
+|默认值|3|
|改后生效方式|重启服务器生效,集群建立后不可更改|
* cluster\_name
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/SerializeUtils.java b/server/src/main/java/org/apache/iotdb/db/utils/SerializeUtils.java
index 829f399..40b49f2 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/SerializeUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/SerializeUtils.java
@@ -128,7 +128,7 @@ public class SerializeUtils {
dataOutputStream.writeInt(node.nodeIdentifier);
dataOutputStream.writeInt(node.dataPort);
dataOutputStream.writeInt(node.clientPort);
- byte[] clientIpBytes = node.ip.getBytes();
+ byte[] clientIpBytes = node.clientIp.getBytes();
dataOutputStream.writeInt(clientIpBytes.length);
dataOutputStream.write(clientIpBytes);
} catch (IOException e) {