diff --git a/src/UserGuide/Master/Table/User-Manual/Load-Balance.md b/src/UserGuide/Master/Table/User-Manual/Load-Balance.md index 69b08b4d4..8514dcf55 100644 --- a/src/UserGuide/Master/Table/User-Manual/Load-Balance.md +++ b/src/UserGuide/Master/Table/User-Manual/Load-Balance.md @@ -225,13 +225,147 @@ After the migration is complete, the Region data in the system will be redistrib ![](/img/cluster-extention-9-en.png) +## 2. Node Management +Node management is mainly used to remove and add ConfigNodes and DataNodes in a cluster. It is a basic operation to ensure cluster high availability and achieve load balancing. -## 2. Load Balance +### 2.1 ConfigNode Maintenance +ConfigNode maintenance includes two operations: adding and removing ConfigNodes. There are two common usage scenarios: + +- **Cluster scaling**: When there is only 1 ConfigNode in the cluster and you want to increase the high availability of ConfigNodes, you can add 2 more ConfigNodes so that the cluster has 3 ConfigNodes. +- **Cluster fault recovery**: When the machine hosting a ConfigNode fails and the ConfigNode cannot run properly, you can remove the faulty ConfigNode and add a new ConfigNode to the cluster. + +> ❗️ Note: After completing ConfigNode maintenance, ensure the cluster has **1 or 3 normally running ConfigNodes**. +> 2 ConfigNodes do not provide high availability, and more than 3 ConfigNodes will cause performance degradation. + +#### 2.1.1 Adding a ConfigNode + +**Script commands:** + +```bash +# Linux / MacOS +# First switch to the IoTDB root directory +sbin/start-confignode.sh + +# Windows +# First switch to the IoTDB root directory +# Before V2.0.4.x +sbin\start-confignode.bat + +# V2.0.4.x and later +sbin\windows\start-confignode.bat +``` + +**Parameter description:** + +| Param | Description | Required | +|-------|-------------|----------| +| -v | Show version information | No | +| -f | Run the script in the foreground, not in the background | No | +| -d | Start in daemon mode (run in the background) | No | +| -p | Specify a file to store the process ID for process management | No | +| -c | Specify the path of the configuration folder to load configuration files | No | +| -g | Print detailed garbage collection (GC) information | No | +| -H | Specify the path for Java heap dump files on JVM out-of-memory | No | +| -E | Specify the path for JVM error log files | No | +| -D | Define system properties in the format `key=value` | No | +| -X | Directly pass `-XX` parameters to the JVM | No | +| -h | Show help | No | + +#### 2.1.2 Removing a ConfigNode +First connect to the cluster via CLI and use `show confignodes` to confirm the NodeID of the ConfigNode to be removed: + +```sql +IoTDB> show confignodes ++------+-------+---------------+------------+--------+ +|NodeID| Status|InternalAddress|InternalPort| Role| ++------+-------+---------------+------------+--------+ +| 0|Running| 127.0.0.1| 10710| Leader| +| 1|Running| 127.0.0.1| 10711|Follower| +| 2|Running| 127.0.0.1| 10712|Follower| ++------+-------+---------------+------------+--------+ +Total line number = 3 +It costs 0.030s +``` + +Then remove the ConfigNode using the following SQL command: + +```sql +REMOVE CONFIGNODE [confignode_id]; +``` + +### 2.2 DataNode Maintenance +There are two common scenarios for DataNode maintenance: + +- **Cluster scaling**: Add new DataNodes to the cluster to expand cluster capacity. +- **Cluster fault recovery**: When the machine hosting a DataNode fails and the DataNode cannot run properly, remove the faulty DataNode and add a new DataNode to the cluster. + +> ❗️ Note: To ensure normal cluster operation, during and after DataNode maintenance, the number of normally running DataNodes must **not be less than the data replication factor (usually 2) or the metadata replication factor (usually 3)**. + +#### 2.2.1 Adding a DataNode + +**Script commands:** + +```bash +# Linux / MacOS +# First switch to the IoTDB root directory +sbin/start-datanode.sh + +# Windows +# First switch to the IoTDB root directory +# Before V2.0.4.x +sbin\start-datanode.bat + +# V2.0.4.x and later +tools\windows\start-datanode.bat +``` + +**Parameter description:** + +| Param | Description | Required | +|-------|-------------|----------| +| -v | Show version information | No | +| -f | Run the script in the foreground, not in the background | No | +| -d | Start in daemon mode (run in the background) | No | +| -p | Specify a file to store the process ID for process management | No | +| -c | Specify the path of the configuration folder to load configuration files | No | +| -g | Print detailed garbage collection (GC) information | No | +| -H | Specify the path for Java heap dump files on JVM out-of-memory | No | +| -E | Specify the path for JVM error log files | No | +| -D | Define system properties in the format `key=value` | No | +| -X | Directly pass `-XX` parameters to the JVM | No | +| -h | Show help | No | + +**Note:** After adding a DataNode, as new writes arrive (and old data expires if TTL is set), the cluster load will gradually balance toward the new DataNode, eventually achieving balanced storage and computing resources across all nodes. + +#### 2.2.2 Removing a DataNode +First connect to the cluster via CLI and use `show datanodes` to confirm the NodeID of the DataNode to be removed: + +```sql +IoTDB> show datanodes ++------+-------+----------+-------+-------------+---------------+ +|NodeID| Status|RpcAddress|RpcPort|DataRegionNum|SchemaRegionNum| ++------+-------+----------+-------+-------------+---------------+ +| 1|Running| 0.0.0.0| 6667| 0| 0| +| 2|Running| 0.0.0.0| 6668| 1| 1| +| 3|Running| 0.0.0.0| 6669| 1| 0| ++------+-------+----------+-------+-------------+---------------+ +Total line number = 3 +It costs 0.110s +``` + +Then remove the DataNode using the following SQL command: + +```sql +REMOVE DATANODE [datanode_id]; +``` + + +## 3. Load Balance Region migration belongs to advanced operations and maintenance functions, which have certain operational costs. It is recommended to read the entire document before using this function. If you have any questions about the solution design, please contact the IoTDB team for technical support. -### 2.1 Feature introduction +### 3.1 Feature introduction IoTDB is a distributed database, and the balanced distribution of data plays an important role in load balancing the disk space and write pressure of the cluster. Region is the basic unit for distributed storage of data in IoTDB cluster, and the specific concept can be seen in [region](../Background-knowledge/Cluster-Concept.md)。 @@ -242,14 +376,14 @@ Here is a schematic diagram of the region migration process : ![](/img/region%E8%BF%81%E7%A7%BB%E7%A4%BA%E6%84%8F%E5%9B%BE20241210.png) -### 2.2 Notes +### 3.2 Notes 1. It is recommended to only use the Region Migration feature on IoTDB 1.3.3 and higher versions. 2. Region migration is only supported when the consensus protocol is IoTConsus or Ratis (in iotdb system. properties, the `schema_region_consensus_protocol_class` and`data_region_consensus_protocol_class`). 3. Region migration consumes system resources such as disk space and network bandwidth. It is recommended to perform the migration during periods of low business load. 4. Under ideal circumstances, Region migration does not affect user-side read or write operations. In special cases, Region migration may block writes. For detailed identification and handling of such situations, please refer to the user guide. -### 2.3 Instructions for use +### 3.3 Instructions for use - **Grammar definition** : diff --git a/src/UserGuide/Master/Tree/User-Manual/Load-Balance.md b/src/UserGuide/Master/Tree/User-Manual/Load-Balance.md index 69b08b4d4..e34001346 100644 --- a/src/UserGuide/Master/Tree/User-Manual/Load-Balance.md +++ b/src/UserGuide/Master/Tree/User-Manual/Load-Balance.md @@ -224,14 +224,146 @@ After the migration is complete, the Region data in the system will be redistrib ![](/img/cluster-extention-9-en.png) +## 2. Node Management +Node management is mainly used to remove and add ConfigNodes and DataNodes in a cluster. It is a basic operation to ensure cluster high availability and achieve load balancing. +### 2.1 ConfigNode Maintenance +ConfigNode maintenance includes two operations: adding and removing ConfigNodes. There are two common usage scenarios: -## 2. Load Balance +- **Cluster scaling**: When there is only 1 ConfigNode in the cluster and you want to increase the high availability of ConfigNodes, you can add 2 more ConfigNodes so that the cluster has 3 ConfigNodes. +- **Cluster fault recovery**: When the machine hosting a ConfigNode fails and the ConfigNode cannot run properly, you can remove the faulty ConfigNode and add a new ConfigNode to the cluster. + +> ❗️ Note: After completing ConfigNode maintenance, ensure the cluster has **1 or 3 normally running ConfigNodes**. +> 2 ConfigNodes do not provide high availability, and more than 3 ConfigNodes will cause performance degradation. + +#### 2.1.1 Adding a ConfigNode + +**Script commands:** + +```bash +# Linux / MacOS +# First switch to the IoTDB root directory +sbin/start-confignode.sh + +# Windows +# First switch to the IoTDB root directory +# Before V2.0.4.x +sbin\start-confignode.bat + +# V2.0.4.x and later +sbin\windows\start-confignode.bat +``` + +**Parameter description:** + +| Param | Description | Required | +|-------|-------------|----------| +| -v | Show version information | No | +| -f | Run the script in the foreground, not in the background | No | +| -d | Start in daemon mode (run in the background) | No | +| -p | Specify a file to store the process ID for process management | No | +| -c | Specify the path of the configuration folder to load configuration files | No | +| -g | Print detailed garbage collection (GC) information | No | +| -H | Specify the path for Java heap dump files on JVM out-of-memory | No | +| -E | Specify the path for JVM error log files | No | +| -D | Define system properties in the format `key=value` | No | +| -X | Directly pass `-XX` parameters to the JVM | No | +| -h | Show help | No | + +#### 2.1.2 Removing a ConfigNode +First connect to the cluster via CLI and use `show confignodes` to confirm the NodeID of the ConfigNode to be removed: + +```sql +IoTDB> show confignodes ++------+-------+---------------+------------+--------+ +|NodeID| Status|InternalAddress|InternalPort| Role| ++------+-------+---------------+------------+--------+ +| 0|Running| 127.0.0.1| 10710| Leader| +| 1|Running| 127.0.0.1| 10711|Follower| +| 2|Running| 127.0.0.1| 10712|Follower| ++------+-------+---------------+------------+--------+ +Total line number = 3 +It costs 0.030s +``` + +Then remove the ConfigNode using the following SQL command: + +```sql +REMOVE CONFIGNODE [confignode_id]; +``` + +### 2.2 DataNode Maintenance +There are two common scenarios for DataNode maintenance: + +- **Cluster scaling**: Add new DataNodes to the cluster to expand cluster capacity. +- **Cluster fault recovery**: When the machine hosting a DataNode fails and the DataNode cannot run properly, remove the faulty DataNode and add a new DataNode to the cluster. + +> ❗️ Note: To ensure normal cluster operation, during and after DataNode maintenance, the number of normally running DataNodes must **not be less than the data replication factor (usually 2) or the metadata replication factor (usually 3)**. + +#### 2.2.1 Adding a DataNode + +**Script commands:** + +```bash +# Linux / MacOS +# First switch to the IoTDB root directory +sbin/start-datanode.sh + +# Windows +# First switch to the IoTDB root directory +# Before V2.0.4.x +sbin\start-datanode.bat + +# V2.0.4.x and later +tools\windows\start-datanode.bat +``` + +**Parameter description:** + +| Param | Description | Required | +|-------|-------------|----------| +| -v | Show version information | No | +| -f | Run the script in the foreground, not in the background | No | +| -d | Start in daemon mode (run in the background) | No | +| -p | Specify a file to store the process ID for process management | No | +| -c | Specify the path of the configuration folder to load configuration files | No | +| -g | Print detailed garbage collection (GC) information | No | +| -H | Specify the path for Java heap dump files on JVM out-of-memory | No | +| -E | Specify the path for JVM error log files | No | +| -D | Define system properties in the format `key=value` | No | +| -X | Directly pass `-XX` parameters to the JVM | No | +| -h | Show help | No | + +**Note:** After adding a DataNode, as new writes arrive (and old data expires if TTL is set), the cluster load will gradually balance toward the new DataNode, eventually achieving balanced storage and computing resources across all nodes. + +#### 2.2.2 Removing a DataNode +First connect to the cluster via CLI and use `show datanodes` to confirm the NodeID of the DataNode to be removed: + +```sql +IoTDB> show datanodes ++------+-------+----------+-------+-------------+---------------+ +|NodeID| Status|RpcAddress|RpcPort|DataRegionNum|SchemaRegionNum| ++------+-------+----------+-------+-------------+---------------+ +| 1|Running| 0.0.0.0| 6667| 0| 0| +| 2|Running| 0.0.0.0| 6668| 1| 1| +| 3|Running| 0.0.0.0| 6669| 1| 0| ++------+-------+----------+-------+-------------+---------------+ +Total line number = 3 +It costs 0.110s +``` + +Then remove the DataNode using the following SQL command: + +```sql +REMOVE DATANODE [datanode_id]; +``` + +## 3. Load Balance Region migration belongs to advanced operations and maintenance functions, which have certain operational costs. It is recommended to read the entire document before using this function. If you have any questions about the solution design, please contact the IoTDB team for technical support. -### 2.1 Feature introduction +### 3.1 Feature introduction IoTDB is a distributed database, and the balanced distribution of data plays an important role in load balancing the disk space and write pressure of the cluster. Region is the basic unit for distributed storage of data in IoTDB cluster, and the specific concept can be seen in [region](../Background-knowledge/Cluster-Concept.md)。 @@ -242,14 +374,14 @@ Here is a schematic diagram of the region migration process : ![](/img/region%E8%BF%81%E7%A7%BB%E7%A4%BA%E6%84%8F%E5%9B%BE20241210.png) -### 2.2 Notes +### 3.2 Notes 1. It is recommended to only use the Region Migration feature on IoTDB 1.3.3 and higher versions. 2. Region migration is only supported when the consensus protocol is IoTConsus or Ratis (in iotdb system. properties, the `schema_region_consensus_protocol_class` and`data_region_consensus_protocol_class`). 3. Region migration consumes system resources such as disk space and network bandwidth. It is recommended to perform the migration during periods of low business load. 4. Under ideal circumstances, Region migration does not affect user-side read or write operations. In special cases, Region migration may block writes. For detailed identification and handling of such situations, please refer to the user guide. -### 2.3 Instructions for use +### 3.3 Instructions for use - **Grammar definition** : diff --git a/src/UserGuide/latest-Table/User-Manual/Load-Balance.md b/src/UserGuide/latest-Table/User-Manual/Load-Balance.md index 69b08b4d4..8514dcf55 100644 --- a/src/UserGuide/latest-Table/User-Manual/Load-Balance.md +++ b/src/UserGuide/latest-Table/User-Manual/Load-Balance.md @@ -225,13 +225,147 @@ After the migration is complete, the Region data in the system will be redistrib ![](/img/cluster-extention-9-en.png) +## 2. Node Management +Node management is mainly used to remove and add ConfigNodes and DataNodes in a cluster. It is a basic operation to ensure cluster high availability and achieve load balancing. -## 2. Load Balance +### 2.1 ConfigNode Maintenance +ConfigNode maintenance includes two operations: adding and removing ConfigNodes. There are two common usage scenarios: + +- **Cluster scaling**: When there is only 1 ConfigNode in the cluster and you want to increase the high availability of ConfigNodes, you can add 2 more ConfigNodes so that the cluster has 3 ConfigNodes. +- **Cluster fault recovery**: When the machine hosting a ConfigNode fails and the ConfigNode cannot run properly, you can remove the faulty ConfigNode and add a new ConfigNode to the cluster. + +> ❗️ Note: After completing ConfigNode maintenance, ensure the cluster has **1 or 3 normally running ConfigNodes**. +> 2 ConfigNodes do not provide high availability, and more than 3 ConfigNodes will cause performance degradation. + +#### 2.1.1 Adding a ConfigNode + +**Script commands:** + +```bash +# Linux / MacOS +# First switch to the IoTDB root directory +sbin/start-confignode.sh + +# Windows +# First switch to the IoTDB root directory +# Before V2.0.4.x +sbin\start-confignode.bat + +# V2.0.4.x and later +sbin\windows\start-confignode.bat +``` + +**Parameter description:** + +| Param | Description | Required | +|-------|-------------|----------| +| -v | Show version information | No | +| -f | Run the script in the foreground, not in the background | No | +| -d | Start in daemon mode (run in the background) | No | +| -p | Specify a file to store the process ID for process management | No | +| -c | Specify the path of the configuration folder to load configuration files | No | +| -g | Print detailed garbage collection (GC) information | No | +| -H | Specify the path for Java heap dump files on JVM out-of-memory | No | +| -E | Specify the path for JVM error log files | No | +| -D | Define system properties in the format `key=value` | No | +| -X | Directly pass `-XX` parameters to the JVM | No | +| -h | Show help | No | + +#### 2.1.2 Removing a ConfigNode +First connect to the cluster via CLI and use `show confignodes` to confirm the NodeID of the ConfigNode to be removed: + +```sql +IoTDB> show confignodes ++------+-------+---------------+------------+--------+ +|NodeID| Status|InternalAddress|InternalPort| Role| ++------+-------+---------------+------------+--------+ +| 0|Running| 127.0.0.1| 10710| Leader| +| 1|Running| 127.0.0.1| 10711|Follower| +| 2|Running| 127.0.0.1| 10712|Follower| ++------+-------+---------------+------------+--------+ +Total line number = 3 +It costs 0.030s +``` + +Then remove the ConfigNode using the following SQL command: + +```sql +REMOVE CONFIGNODE [confignode_id]; +``` + +### 2.2 DataNode Maintenance +There are two common scenarios for DataNode maintenance: + +- **Cluster scaling**: Add new DataNodes to the cluster to expand cluster capacity. +- **Cluster fault recovery**: When the machine hosting a DataNode fails and the DataNode cannot run properly, remove the faulty DataNode and add a new DataNode to the cluster. + +> ❗️ Note: To ensure normal cluster operation, during and after DataNode maintenance, the number of normally running DataNodes must **not be less than the data replication factor (usually 2) or the metadata replication factor (usually 3)**. + +#### 2.2.1 Adding a DataNode + +**Script commands:** + +```bash +# Linux / MacOS +# First switch to the IoTDB root directory +sbin/start-datanode.sh + +# Windows +# First switch to the IoTDB root directory +# Before V2.0.4.x +sbin\start-datanode.bat + +# V2.0.4.x and later +tools\windows\start-datanode.bat +``` + +**Parameter description:** + +| Param | Description | Required | +|-------|-------------|----------| +| -v | Show version information | No | +| -f | Run the script in the foreground, not in the background | No | +| -d | Start in daemon mode (run in the background) | No | +| -p | Specify a file to store the process ID for process management | No | +| -c | Specify the path of the configuration folder to load configuration files | No | +| -g | Print detailed garbage collection (GC) information | No | +| -H | Specify the path for Java heap dump files on JVM out-of-memory | No | +| -E | Specify the path for JVM error log files | No | +| -D | Define system properties in the format `key=value` | No | +| -X | Directly pass `-XX` parameters to the JVM | No | +| -h | Show help | No | + +**Note:** After adding a DataNode, as new writes arrive (and old data expires if TTL is set), the cluster load will gradually balance toward the new DataNode, eventually achieving balanced storage and computing resources across all nodes. + +#### 2.2.2 Removing a DataNode +First connect to the cluster via CLI and use `show datanodes` to confirm the NodeID of the DataNode to be removed: + +```sql +IoTDB> show datanodes ++------+-------+----------+-------+-------------+---------------+ +|NodeID| Status|RpcAddress|RpcPort|DataRegionNum|SchemaRegionNum| ++------+-------+----------+-------+-------------+---------------+ +| 1|Running| 0.0.0.0| 6667| 0| 0| +| 2|Running| 0.0.0.0| 6668| 1| 1| +| 3|Running| 0.0.0.0| 6669| 1| 0| ++------+-------+----------+-------+-------------+---------------+ +Total line number = 3 +It costs 0.110s +``` + +Then remove the DataNode using the following SQL command: + +```sql +REMOVE DATANODE [datanode_id]; +``` + + +## 3. Load Balance Region migration belongs to advanced operations and maintenance functions, which have certain operational costs. It is recommended to read the entire document before using this function. If you have any questions about the solution design, please contact the IoTDB team for technical support. -### 2.1 Feature introduction +### 3.1 Feature introduction IoTDB is a distributed database, and the balanced distribution of data plays an important role in load balancing the disk space and write pressure of the cluster. Region is the basic unit for distributed storage of data in IoTDB cluster, and the specific concept can be seen in [region](../Background-knowledge/Cluster-Concept.md)。 @@ -242,14 +376,14 @@ Here is a schematic diagram of the region migration process : ![](/img/region%E8%BF%81%E7%A7%BB%E7%A4%BA%E6%84%8F%E5%9B%BE20241210.png) -### 2.2 Notes +### 3.2 Notes 1. It is recommended to only use the Region Migration feature on IoTDB 1.3.3 and higher versions. 2. Region migration is only supported when the consensus protocol is IoTConsus or Ratis (in iotdb system. properties, the `schema_region_consensus_protocol_class` and`data_region_consensus_protocol_class`). 3. Region migration consumes system resources such as disk space and network bandwidth. It is recommended to perform the migration during periods of low business load. 4. Under ideal circumstances, Region migration does not affect user-side read or write operations. In special cases, Region migration may block writes. For detailed identification and handling of such situations, please refer to the user guide. -### 2.3 Instructions for use +### 3.3 Instructions for use - **Grammar definition** : diff --git a/src/UserGuide/latest/User-Manual/Load-Balance.md b/src/UserGuide/latest/User-Manual/Load-Balance.md index 69b08b4d4..e34001346 100644 --- a/src/UserGuide/latest/User-Manual/Load-Balance.md +++ b/src/UserGuide/latest/User-Manual/Load-Balance.md @@ -224,14 +224,146 @@ After the migration is complete, the Region data in the system will be redistrib ![](/img/cluster-extention-9-en.png) +## 2. Node Management +Node management is mainly used to remove and add ConfigNodes and DataNodes in a cluster. It is a basic operation to ensure cluster high availability and achieve load balancing. +### 2.1 ConfigNode Maintenance +ConfigNode maintenance includes two operations: adding and removing ConfigNodes. There are two common usage scenarios: -## 2. Load Balance +- **Cluster scaling**: When there is only 1 ConfigNode in the cluster and you want to increase the high availability of ConfigNodes, you can add 2 more ConfigNodes so that the cluster has 3 ConfigNodes. +- **Cluster fault recovery**: When the machine hosting a ConfigNode fails and the ConfigNode cannot run properly, you can remove the faulty ConfigNode and add a new ConfigNode to the cluster. + +> ❗️ Note: After completing ConfigNode maintenance, ensure the cluster has **1 or 3 normally running ConfigNodes**. +> 2 ConfigNodes do not provide high availability, and more than 3 ConfigNodes will cause performance degradation. + +#### 2.1.1 Adding a ConfigNode + +**Script commands:** + +```bash +# Linux / MacOS +# First switch to the IoTDB root directory +sbin/start-confignode.sh + +# Windows +# First switch to the IoTDB root directory +# Before V2.0.4.x +sbin\start-confignode.bat + +# V2.0.4.x and later +sbin\windows\start-confignode.bat +``` + +**Parameter description:** + +| Param | Description | Required | +|-------|-------------|----------| +| -v | Show version information | No | +| -f | Run the script in the foreground, not in the background | No | +| -d | Start in daemon mode (run in the background) | No | +| -p | Specify a file to store the process ID for process management | No | +| -c | Specify the path of the configuration folder to load configuration files | No | +| -g | Print detailed garbage collection (GC) information | No | +| -H | Specify the path for Java heap dump files on JVM out-of-memory | No | +| -E | Specify the path for JVM error log files | No | +| -D | Define system properties in the format `key=value` | No | +| -X | Directly pass `-XX` parameters to the JVM | No | +| -h | Show help | No | + +#### 2.1.2 Removing a ConfigNode +First connect to the cluster via CLI and use `show confignodes` to confirm the NodeID of the ConfigNode to be removed: + +```sql +IoTDB> show confignodes ++------+-------+---------------+------------+--------+ +|NodeID| Status|InternalAddress|InternalPort| Role| ++------+-------+---------------+------------+--------+ +| 0|Running| 127.0.0.1| 10710| Leader| +| 1|Running| 127.0.0.1| 10711|Follower| +| 2|Running| 127.0.0.1| 10712|Follower| ++------+-------+---------------+------------+--------+ +Total line number = 3 +It costs 0.030s +``` + +Then remove the ConfigNode using the following SQL command: + +```sql +REMOVE CONFIGNODE [confignode_id]; +``` + +### 2.2 DataNode Maintenance +There are two common scenarios for DataNode maintenance: + +- **Cluster scaling**: Add new DataNodes to the cluster to expand cluster capacity. +- **Cluster fault recovery**: When the machine hosting a DataNode fails and the DataNode cannot run properly, remove the faulty DataNode and add a new DataNode to the cluster. + +> ❗️ Note: To ensure normal cluster operation, during and after DataNode maintenance, the number of normally running DataNodes must **not be less than the data replication factor (usually 2) or the metadata replication factor (usually 3)**. + +#### 2.2.1 Adding a DataNode + +**Script commands:** + +```bash +# Linux / MacOS +# First switch to the IoTDB root directory +sbin/start-datanode.sh + +# Windows +# First switch to the IoTDB root directory +# Before V2.0.4.x +sbin\start-datanode.bat + +# V2.0.4.x and later +tools\windows\start-datanode.bat +``` + +**Parameter description:** + +| Param | Description | Required | +|-------|-------------|----------| +| -v | Show version information | No | +| -f | Run the script in the foreground, not in the background | No | +| -d | Start in daemon mode (run in the background) | No | +| -p | Specify a file to store the process ID for process management | No | +| -c | Specify the path of the configuration folder to load configuration files | No | +| -g | Print detailed garbage collection (GC) information | No | +| -H | Specify the path for Java heap dump files on JVM out-of-memory | No | +| -E | Specify the path for JVM error log files | No | +| -D | Define system properties in the format `key=value` | No | +| -X | Directly pass `-XX` parameters to the JVM | No | +| -h | Show help | No | + +**Note:** After adding a DataNode, as new writes arrive (and old data expires if TTL is set), the cluster load will gradually balance toward the new DataNode, eventually achieving balanced storage and computing resources across all nodes. + +#### 2.2.2 Removing a DataNode +First connect to the cluster via CLI and use `show datanodes` to confirm the NodeID of the DataNode to be removed: + +```sql +IoTDB> show datanodes ++------+-------+----------+-------+-------------+---------------+ +|NodeID| Status|RpcAddress|RpcPort|DataRegionNum|SchemaRegionNum| ++------+-------+----------+-------+-------------+---------------+ +| 1|Running| 0.0.0.0| 6667| 0| 0| +| 2|Running| 0.0.0.0| 6668| 1| 1| +| 3|Running| 0.0.0.0| 6669| 1| 0| ++------+-------+----------+-------+-------------+---------------+ +Total line number = 3 +It costs 0.110s +``` + +Then remove the DataNode using the following SQL command: + +```sql +REMOVE DATANODE [datanode_id]; +``` + +## 3. Load Balance Region migration belongs to advanced operations and maintenance functions, which have certain operational costs. It is recommended to read the entire document before using this function. If you have any questions about the solution design, please contact the IoTDB team for technical support. -### 2.1 Feature introduction +### 3.1 Feature introduction IoTDB is a distributed database, and the balanced distribution of data plays an important role in load balancing the disk space and write pressure of the cluster. Region is the basic unit for distributed storage of data in IoTDB cluster, and the specific concept can be seen in [region](../Background-knowledge/Cluster-Concept.md)。 @@ -242,14 +374,14 @@ Here is a schematic diagram of the region migration process : ![](/img/region%E8%BF%81%E7%A7%BB%E7%A4%BA%E6%84%8F%E5%9B%BE20241210.png) -### 2.2 Notes +### 3.2 Notes 1. It is recommended to only use the Region Migration feature on IoTDB 1.3.3 and higher versions. 2. Region migration is only supported when the consensus protocol is IoTConsus or Ratis (in iotdb system. properties, the `schema_region_consensus_protocol_class` and`data_region_consensus_protocol_class`). 3. Region migration consumes system resources such as disk space and network bandwidth. It is recommended to perform the migration during periods of low business load. 4. Under ideal circumstances, Region migration does not affect user-side read or write operations. In special cases, Region migration may block writes. For detailed identification and handling of such situations, please refer to the user guide. -### 2.3 Instructions for use +### 3.3 Instructions for use - **Grammar definition** : diff --git a/src/zh/UserGuide/Master/Table/User-Manual/Load-Balance.md b/src/zh/UserGuide/Master/Table/User-Manual/Load-Balance.md index 3bb2edf46..b174e7eb5 100644 --- a/src/zh/UserGuide/Master/Table/User-Manual/Load-Balance.md +++ b/src/zh/UserGuide/Master/Table/User-Manual/Load-Balance.md @@ -220,12 +220,150 @@ migrate region 3 from 1 to 6 ![](/img/cluster-extention-9.png) +## 2. 节点管理 -## 2. 负载均衡 +节点管理主要用于对集群中的 ConfigNode 和 DataNode 进行移除和添加,是保障集群高可用、实现负载均衡的基础运维操作。 + +### 2.1 ConfigNode 节点维护 + +ConfigNode 节点维护分为 ConfigNod e添加和移除两种操作,有两个常见使用场景: + +* 集群扩展:如集群中只有1个 ConfigNode 时,希望增加 ConfigNode 以提升 ConfigNode 节点高可用性,则可以添加2个 ConfigNode,使得集群中有3个 ConfigNode。 +* 集群故障恢复:1个 ConfigNode 所在机器发生故障,使得该 ConfigNode 无法正常运行,此时可以移除该 ConfigNode,然后添加一个新的 ConfigNode 进入集群。 + +> ❗️注意,在完成 ConfigNode 节点维护后,需要保证集群中有1或者3个正常运行的 ConfigNode。2个 ConfigNode 不具备高可用性,超过3个 ConfigNode 会导致性能损失。 + +#### 2.1.1 添加 ConfigNode 节点 + +脚本命令: + +```Bash +# Linux / MacOS +# 首先切换到IoTDB根目录 +sbin/start-confignode.sh + +# Windows +# 首先切换到IoTDB根目录 +# V2.0.4.x 版本之前 +sbin\start-confignode.bat + +# V2.0.4.x 版本及之后 +sbin\windows\start-confignode.bat +``` + +参数介绍: + +| 参数 | 描述 | 是否为必填项 | +| ------ | ------------------------------------------------ | -------------- | +| -v | 显示版本信息 | 否 | +| -f | 在前台运行脚本,不将其放到后台 | 否 | +| -d | 以守护进程模式启动,即在后台运行 | 否 | +| -p | 指定一个文件来存放进程ID,用于进程管理 | 否 | +| -c | 指定配置文件夹的路径,脚本会从这里加载配置文件 | 否 | +| -g | 打印垃圾回收(GC)的详细信息 | 否 | +| -H | 指定Java堆转储文件的路径,当JVM内存溢出时使用 | 否 | +| -E | 指定JVM错误日志文件的路径 | 否 | +| -D | 定义系统属性,格式为 key=value | 否 | +| -X | 直接传递 -XX 参数给 JVM | 否 | +| -h | 帮助指令 | 否 | + +#### 2.1.2 移除 ConfigNode 节点 + +首先通过 CLI 连接集群,通过 show confignodes 确认想要移除 ConfigNode 的 NodeID: + +```SQL +IoTDB> show confignodes ++------+-------+---------------+------------+--------+ +|NodeID| Status|InternalAddress|InternalPort| Role| ++------+-------+---------------+------------+--------+ +| 0|Running| 127.0.0.1| 10710| Leader| +| 1|Running| 127.0.0.1| 10711|Follower| +| 2|Running| 127.0.0.1| 10712|Follower| ++------+-------+---------------+------------+--------+ +Total line number = 3 +It costs 0.030s +``` + +然后使用 SQL 将 ConfigNode 移除,SQL 命令: + +```Bash +remove confignode [confignode_id] +``` + +### 2.2 DataNode 节点维护 + +DataNode 节点维护有两个常见场景: + +* 集群扩容:出于集群能力扩容等目的,添加新的DataNode进入集群 +* 集群故障恢复:一个DataNode所在机器出现故障,使得该DataNode无法正常运行,此时可以移除该DataNode,并添加新的DataNode进入集群 + +> ❗️注意,为了使集群能正常工作,在DataNode节点维护过程中以及维护完成后,正常运行的DataNode总数不得少于数据副本数(通常为2),也不得少于元数据副本数(通常为3)。 + +#### 2.2.1 添加DataNode节点 + +脚本命令: + +```Bash +# Linux / MacOS +# 首先切换到IoTDB根目录 +sbin/start-datanode.sh + +# Windows +# 首先切换到IoTDB根目录 +# V2.0.4.x 版本之前 +sbin\start-datanode.bat + +# V2.0.4.x 版本及之后 +tools\windows\start-datanode.bat +``` + +参数介绍: + +| 缩写 | 描述 | 是否为必填项 | +| ------ | ------------------------------------------------ | -------------- | +| -v | 显示版本信息 | 否 | +| -f | 在前台运行脚本,不将其放到后台 | 否 | +| -d | 以守护进程模式启动,即在后台运行 | 否 | +| -p | 指定一个文件来存放进程ID,用于进程管理 | 否 | +| -c | 指定配置文件夹的路径,脚本会从这里加载配置文件 | 否 | +| -g | 打印垃圾回收(GC)的详细信息 | 否 | +| -H | 指定Java堆转储文件的路径,当JVM内存溢出时使用 | 否 | +| -E | 指定JVM错误日志文件的路径 | 否 | +| -D | 定义系统属性,格式为 key=value | 否 | +| -X | 直接传递 -XX 参数给 JVM | 否 | +| -h | 帮助指令 | 否 | + +说明:在添加DataNode后,随着新的写入到来(以及旧数据过期,如果设置了TTL),集群负载会逐渐向新的DataNode均衡,最终在所有节点上达到存算资源的均衡。 + +#### 2.2.2 移除DataNode节点 + +首先通过CLI连接集群,通过`show datanodes`确认想要移除的DataNode的NodeID: + +```SQL +IoTDB> show datanodes ++------+-------+----------+-------+-------------+---------------+ +|NodeID| Status|RpcAddress|RpcPort|DataRegionNum|SchemaRegionNum| ++------+-------+----------+-------+-------------+---------------+ +| 1|Running| 0.0.0.0| 6667| 0| 0| +| 2|Running| 0.0.0.0| 6668| 1| 1| +| 3|Running| 0.0.0.0| 6669| 1| 0| ++------+-------+----------+-------+-------------+---------------+ +Total line number = 3 +It costs 0.110s +``` + +然后使用SQL将DataNode移除,SQL命令: + +```Bash +remove datanode [datanode_id] +``` + + +## 3. 负载均衡 Region 迁移属于高级运维功能,具有一定操作成本,建议完整阅读后再使用该功能。如有疑问请联系 IoTDB 团队寻求技术支持。 -### 2.1 功能介绍 +### 3.1 功能介绍 IoTDB 是一个分布式数据库,数据的均衡分布对集群的磁盘空间、写入压力的负载均衡有着重要作用,region 是数据在 IoTDB 集群中进行分布式存储的基本单元,具体概念可见[region](../Background-knowledge/Cluster-Concept.md)。 @@ -236,14 +374,14 @@ IoTDB 是一个分布式数据库,数据的均衡分布对集群的磁盘空 ![](/img/region%E8%BF%81%E7%A7%BB%E7%A4%BA%E6%84%8F%E5%9B%BE20241210.png) -### 2.2 注意事项 +### 3.2 注意事项 1. 推荐仅在 IoTDB 1.3.3 以及更高版本使用 Region 迁移功能。 2. 仅在共识协议为 IoTConsensus、Ratis 时支持 Region 迁移(iotdb-system.properties中的`schema_region_consensus_protocol_class` 和 `data_region_consensus_protocol_class`)。 3. Region 迁移会占用硬盘和网络带宽等系统资源,推荐在低业务负载时进行。 4. 在理想情况下,Region 迁移不影响用户侧读写。特殊情况下,Region 迁移可能阻塞写入,这种情况的具体鉴别与处理方式见使用说明。 -### 2.3 使用说明 +### 3.3 使用说明 - **语法定义**: diff --git a/src/zh/UserGuide/Master/Tree/User-Manual/Load-Balance.md b/src/zh/UserGuide/Master/Tree/User-Manual/Load-Balance.md index 3bb2edf46..b929c949c 100644 --- a/src/zh/UserGuide/Master/Tree/User-Manual/Load-Balance.md +++ b/src/zh/UserGuide/Master/Tree/User-Manual/Load-Balance.md @@ -221,11 +221,150 @@ migrate region 3 from 1 to 6 ![](/img/cluster-extention-9.png) -## 2. 负载均衡 +## 2. 节点管理 + +节点管理主要用于对集群中的 ConfigNode 和 DataNode 进行移除和添加,是保障集群高可用、实现负载均衡的基础运维操作。 + +### 2.1 ConfigNode 节点维护 + +ConfigNode 节点维护分为 ConfigNod e添加和移除两种操作,有两个常见使用场景: + +* 集群扩展:如集群中只有1个 ConfigNode 时,希望增加 ConfigNode 以提升 ConfigNode 节点高可用性,则可以添加2个 ConfigNode,使得集群中有3个 ConfigNode。 +* 集群故障恢复:1个 ConfigNode 所在机器发生故障,使得该 ConfigNode 无法正常运行,此时可以移除该 ConfigNode,然后添加一个新的 ConfigNode 进入集群。 + +> ❗️注意,在完成 ConfigNode 节点维护后,需要保证集群中有1或者3个正常运行的 ConfigNode。2个 ConfigNode 不具备高可用性,超过3个 ConfigNode 会导致性能损失。 + +#### 2.1.1 添加 ConfigNode 节点 + +脚本命令: + +```Bash +# Linux / MacOS +# 首先切换到IoTDB根目录 +sbin/start-confignode.sh + +# Windows +# 首先切换到IoTDB根目录 +# V2.0.4.x 版本之前 +sbin\start-confignode.bat + +# V2.0.4.x 版本及之后 +sbin\windows\start-confignode.bat +``` + +参数介绍: + +| 参数 | 描述 | 是否为必填项 | +| ------ | ------------------------------------------------ | -------------- | +| -v | 显示版本信息 | 否 | +| -f | 在前台运行脚本,不将其放到后台 | 否 | +| -d | 以守护进程模式启动,即在后台运行 | 否 | +| -p | 指定一个文件来存放进程ID,用于进程管理 | 否 | +| -c | 指定配置文件夹的路径,脚本会从这里加载配置文件 | 否 | +| -g | 打印垃圾回收(GC)的详细信息 | 否 | +| -H | 指定Java堆转储文件的路径,当JVM内存溢出时使用 | 否 | +| -E | 指定JVM错误日志文件的路径 | 否 | +| -D | 定义系统属性,格式为 key=value | 否 | +| -X | 直接传递 -XX 参数给 JVM | 否 | +| -h | 帮助指令 | 否 | + +#### 2.1.2 移除 ConfigNode 节点 + +首先通过 CLI 连接集群,通过 show confignodes 确认想要移除 ConfigNode 的 NodeID: + +```SQL +IoTDB> show confignodes ++------+-------+---------------+------------+--------+ +|NodeID| Status|InternalAddress|InternalPort| Role| ++------+-------+---------------+------------+--------+ +| 0|Running| 127.0.0.1| 10710| Leader| +| 1|Running| 127.0.0.1| 10711|Follower| +| 2|Running| 127.0.0.1| 10712|Follower| ++------+-------+---------------+------------+--------+ +Total line number = 3 +It costs 0.030s +``` + +然后使用 SQL 将 ConfigNode 移除,SQL 命令: + +```Bash +remove confignode [confignode_id] +``` + +### 2.2 DataNode 节点维护 + +DataNode 节点维护有两个常见场景: + +* 集群扩容:出于集群能力扩容等目的,添加新的DataNode进入集群 +* 集群故障恢复:一个DataNode所在机器出现故障,使得该DataNode无法正常运行,此时可以移除该DataNode,并添加新的DataNode进入集群 + +> ❗️注意,为了使集群能正常工作,在DataNode节点维护过程中以及维护完成后,正常运行的DataNode总数不得少于数据副本数(通常为2),也不得少于元数据副本数(通常为3)。 + +#### 2.2.1 添加DataNode节点 + +脚本命令: + +```Bash +# Linux / MacOS +# 首先切换到IoTDB根目录 +sbin/start-datanode.sh + +# Windows +# 首先切换到IoTDB根目录 +# V2.0.4.x 版本之前 +sbin\start-datanode.bat + +# V2.0.4.x 版本及之后 +tools\windows\start-datanode.bat +``` + +参数介绍: + +| 缩写 | 描述 | 是否为必填项 | +| ------ | ------------------------------------------------ | -------------- | +| -v | 显示版本信息 | 否 | +| -f | 在前台运行脚本,不将其放到后台 | 否 | +| -d | 以守护进程模式启动,即在后台运行 | 否 | +| -p | 指定一个文件来存放进程ID,用于进程管理 | 否 | +| -c | 指定配置文件夹的路径,脚本会从这里加载配置文件 | 否 | +| -g | 打印垃圾回收(GC)的详细信息 | 否 | +| -H | 指定Java堆转储文件的路径,当JVM内存溢出时使用 | 否 | +| -E | 指定JVM错误日志文件的路径 | 否 | +| -D | 定义系统属性,格式为 key=value | 否 | +| -X | 直接传递 -XX 参数给 JVM | 否 | +| -h | 帮助指令 | 否 | + +说明:在添加DataNode后,随着新的写入到来(以及旧数据过期,如果设置了TTL),集群负载会逐渐向新的DataNode均衡,最终在所有节点上达到存算资源的均衡。 + +#### 2.2.2 移除DataNode节点 + +首先通过CLI连接集群,通过`show datanodes`确认想要移除的DataNode的NodeID: + +```SQL +IoTDB> show datanodes ++------+-------+----------+-------+-------------+---------------+ +|NodeID| Status|RpcAddress|RpcPort|DataRegionNum|SchemaRegionNum| ++------+-------+----------+-------+-------------+---------------+ +| 1|Running| 0.0.0.0| 6667| 0| 0| +| 2|Running| 0.0.0.0| 6668| 1| 1| +| 3|Running| 0.0.0.0| 6669| 1| 0| ++------+-------+----------+-------+-------------+---------------+ +Total line number = 3 +It costs 0.110s +``` + +然后使用SQL将DataNode移除,SQL命令: + +```Bash +remove datanode [datanode_id] +``` + + +## 3. 负载均衡 Region 迁移属于高级运维功能,具有一定操作成本,建议完整阅读后再使用该功能。如有疑问请联系 IoTDB 团队寻求技术支持。 -### 2.1 功能介绍 +### 3.1 功能介绍 IoTDB 是一个分布式数据库,数据的均衡分布对集群的磁盘空间、写入压力的负载均衡有着重要作用,region 是数据在 IoTDB 集群中进行分布式存储的基本单元,具体概念可见[region](../Background-knowledge/Cluster-Concept.md)。 @@ -236,14 +375,14 @@ IoTDB 是一个分布式数据库,数据的均衡分布对集群的磁盘空 ![](/img/region%E8%BF%81%E7%A7%BB%E7%A4%BA%E6%84%8F%E5%9B%BE20241210.png) -### 2.2 注意事项 +### 3.2 注意事项 1. 推荐仅在 IoTDB 1.3.3 以及更高版本使用 Region 迁移功能。 2. 仅在共识协议为 IoTConsensus、Ratis 时支持 Region 迁移(iotdb-system.properties中的`schema_region_consensus_protocol_class` 和 `data_region_consensus_protocol_class`)。 3. Region 迁移会占用硬盘和网络带宽等系统资源,推荐在低业务负载时进行。 4. 在理想情况下,Region 迁移不影响用户侧读写。特殊情况下,Region 迁移可能阻塞写入,这种情况的具体鉴别与处理方式见使用说明。 -### 2.3 使用说明 +### 3.3 使用说明 - **语法定义**: diff --git a/src/zh/UserGuide/latest-Table/User-Manual/Load-Balance.md b/src/zh/UserGuide/latest-Table/User-Manual/Load-Balance.md index 3bb2edf46..b174e7eb5 100644 --- a/src/zh/UserGuide/latest-Table/User-Manual/Load-Balance.md +++ b/src/zh/UserGuide/latest-Table/User-Manual/Load-Balance.md @@ -220,12 +220,150 @@ migrate region 3 from 1 to 6 ![](/img/cluster-extention-9.png) +## 2. 节点管理 -## 2. 负载均衡 +节点管理主要用于对集群中的 ConfigNode 和 DataNode 进行移除和添加,是保障集群高可用、实现负载均衡的基础运维操作。 + +### 2.1 ConfigNode 节点维护 + +ConfigNode 节点维护分为 ConfigNod e添加和移除两种操作,有两个常见使用场景: + +* 集群扩展:如集群中只有1个 ConfigNode 时,希望增加 ConfigNode 以提升 ConfigNode 节点高可用性,则可以添加2个 ConfigNode,使得集群中有3个 ConfigNode。 +* 集群故障恢复:1个 ConfigNode 所在机器发生故障,使得该 ConfigNode 无法正常运行,此时可以移除该 ConfigNode,然后添加一个新的 ConfigNode 进入集群。 + +> ❗️注意,在完成 ConfigNode 节点维护后,需要保证集群中有1或者3个正常运行的 ConfigNode。2个 ConfigNode 不具备高可用性,超过3个 ConfigNode 会导致性能损失。 + +#### 2.1.1 添加 ConfigNode 节点 + +脚本命令: + +```Bash +# Linux / MacOS +# 首先切换到IoTDB根目录 +sbin/start-confignode.sh + +# Windows +# 首先切换到IoTDB根目录 +# V2.0.4.x 版本之前 +sbin\start-confignode.bat + +# V2.0.4.x 版本及之后 +sbin\windows\start-confignode.bat +``` + +参数介绍: + +| 参数 | 描述 | 是否为必填项 | +| ------ | ------------------------------------------------ | -------------- | +| -v | 显示版本信息 | 否 | +| -f | 在前台运行脚本,不将其放到后台 | 否 | +| -d | 以守护进程模式启动,即在后台运行 | 否 | +| -p | 指定一个文件来存放进程ID,用于进程管理 | 否 | +| -c | 指定配置文件夹的路径,脚本会从这里加载配置文件 | 否 | +| -g | 打印垃圾回收(GC)的详细信息 | 否 | +| -H | 指定Java堆转储文件的路径,当JVM内存溢出时使用 | 否 | +| -E | 指定JVM错误日志文件的路径 | 否 | +| -D | 定义系统属性,格式为 key=value | 否 | +| -X | 直接传递 -XX 参数给 JVM | 否 | +| -h | 帮助指令 | 否 | + +#### 2.1.2 移除 ConfigNode 节点 + +首先通过 CLI 连接集群,通过 show confignodes 确认想要移除 ConfigNode 的 NodeID: + +```SQL +IoTDB> show confignodes ++------+-------+---------------+------------+--------+ +|NodeID| Status|InternalAddress|InternalPort| Role| ++------+-------+---------------+------------+--------+ +| 0|Running| 127.0.0.1| 10710| Leader| +| 1|Running| 127.0.0.1| 10711|Follower| +| 2|Running| 127.0.0.1| 10712|Follower| ++------+-------+---------------+------------+--------+ +Total line number = 3 +It costs 0.030s +``` + +然后使用 SQL 将 ConfigNode 移除,SQL 命令: + +```Bash +remove confignode [confignode_id] +``` + +### 2.2 DataNode 节点维护 + +DataNode 节点维护有两个常见场景: + +* 集群扩容:出于集群能力扩容等目的,添加新的DataNode进入集群 +* 集群故障恢复:一个DataNode所在机器出现故障,使得该DataNode无法正常运行,此时可以移除该DataNode,并添加新的DataNode进入集群 + +> ❗️注意,为了使集群能正常工作,在DataNode节点维护过程中以及维护完成后,正常运行的DataNode总数不得少于数据副本数(通常为2),也不得少于元数据副本数(通常为3)。 + +#### 2.2.1 添加DataNode节点 + +脚本命令: + +```Bash +# Linux / MacOS +# 首先切换到IoTDB根目录 +sbin/start-datanode.sh + +# Windows +# 首先切换到IoTDB根目录 +# V2.0.4.x 版本之前 +sbin\start-datanode.bat + +# V2.0.4.x 版本及之后 +tools\windows\start-datanode.bat +``` + +参数介绍: + +| 缩写 | 描述 | 是否为必填项 | +| ------ | ------------------------------------------------ | -------------- | +| -v | 显示版本信息 | 否 | +| -f | 在前台运行脚本,不将其放到后台 | 否 | +| -d | 以守护进程模式启动,即在后台运行 | 否 | +| -p | 指定一个文件来存放进程ID,用于进程管理 | 否 | +| -c | 指定配置文件夹的路径,脚本会从这里加载配置文件 | 否 | +| -g | 打印垃圾回收(GC)的详细信息 | 否 | +| -H | 指定Java堆转储文件的路径,当JVM内存溢出时使用 | 否 | +| -E | 指定JVM错误日志文件的路径 | 否 | +| -D | 定义系统属性,格式为 key=value | 否 | +| -X | 直接传递 -XX 参数给 JVM | 否 | +| -h | 帮助指令 | 否 | + +说明:在添加DataNode后,随着新的写入到来(以及旧数据过期,如果设置了TTL),集群负载会逐渐向新的DataNode均衡,最终在所有节点上达到存算资源的均衡。 + +#### 2.2.2 移除DataNode节点 + +首先通过CLI连接集群,通过`show datanodes`确认想要移除的DataNode的NodeID: + +```SQL +IoTDB> show datanodes ++------+-------+----------+-------+-------------+---------------+ +|NodeID| Status|RpcAddress|RpcPort|DataRegionNum|SchemaRegionNum| ++------+-------+----------+-------+-------------+---------------+ +| 1|Running| 0.0.0.0| 6667| 0| 0| +| 2|Running| 0.0.0.0| 6668| 1| 1| +| 3|Running| 0.0.0.0| 6669| 1| 0| ++------+-------+----------+-------+-------------+---------------+ +Total line number = 3 +It costs 0.110s +``` + +然后使用SQL将DataNode移除,SQL命令: + +```Bash +remove datanode [datanode_id] +``` + + +## 3. 负载均衡 Region 迁移属于高级运维功能,具有一定操作成本,建议完整阅读后再使用该功能。如有疑问请联系 IoTDB 团队寻求技术支持。 -### 2.1 功能介绍 +### 3.1 功能介绍 IoTDB 是一个分布式数据库,数据的均衡分布对集群的磁盘空间、写入压力的负载均衡有着重要作用,region 是数据在 IoTDB 集群中进行分布式存储的基本单元,具体概念可见[region](../Background-knowledge/Cluster-Concept.md)。 @@ -236,14 +374,14 @@ IoTDB 是一个分布式数据库,数据的均衡分布对集群的磁盘空 ![](/img/region%E8%BF%81%E7%A7%BB%E7%A4%BA%E6%84%8F%E5%9B%BE20241210.png) -### 2.2 注意事项 +### 3.2 注意事项 1. 推荐仅在 IoTDB 1.3.3 以及更高版本使用 Region 迁移功能。 2. 仅在共识协议为 IoTConsensus、Ratis 时支持 Region 迁移(iotdb-system.properties中的`schema_region_consensus_protocol_class` 和 `data_region_consensus_protocol_class`)。 3. Region 迁移会占用硬盘和网络带宽等系统资源,推荐在低业务负载时进行。 4. 在理想情况下,Region 迁移不影响用户侧读写。特殊情况下,Region 迁移可能阻塞写入,这种情况的具体鉴别与处理方式见使用说明。 -### 2.3 使用说明 +### 3.3 使用说明 - **语法定义**: diff --git a/src/zh/UserGuide/latest/User-Manual/Load-Balance.md b/src/zh/UserGuide/latest/User-Manual/Load-Balance.md index 3bb2edf46..b929c949c 100644 --- a/src/zh/UserGuide/latest/User-Manual/Load-Balance.md +++ b/src/zh/UserGuide/latest/User-Manual/Load-Balance.md @@ -221,11 +221,150 @@ migrate region 3 from 1 to 6 ![](/img/cluster-extention-9.png) -## 2. 负载均衡 +## 2. 节点管理 + +节点管理主要用于对集群中的 ConfigNode 和 DataNode 进行移除和添加,是保障集群高可用、实现负载均衡的基础运维操作。 + +### 2.1 ConfigNode 节点维护 + +ConfigNode 节点维护分为 ConfigNod e添加和移除两种操作,有两个常见使用场景: + +* 集群扩展:如集群中只有1个 ConfigNode 时,希望增加 ConfigNode 以提升 ConfigNode 节点高可用性,则可以添加2个 ConfigNode,使得集群中有3个 ConfigNode。 +* 集群故障恢复:1个 ConfigNode 所在机器发生故障,使得该 ConfigNode 无法正常运行,此时可以移除该 ConfigNode,然后添加一个新的 ConfigNode 进入集群。 + +> ❗️注意,在完成 ConfigNode 节点维护后,需要保证集群中有1或者3个正常运行的 ConfigNode。2个 ConfigNode 不具备高可用性,超过3个 ConfigNode 会导致性能损失。 + +#### 2.1.1 添加 ConfigNode 节点 + +脚本命令: + +```Bash +# Linux / MacOS +# 首先切换到IoTDB根目录 +sbin/start-confignode.sh + +# Windows +# 首先切换到IoTDB根目录 +# V2.0.4.x 版本之前 +sbin\start-confignode.bat + +# V2.0.4.x 版本及之后 +sbin\windows\start-confignode.bat +``` + +参数介绍: + +| 参数 | 描述 | 是否为必填项 | +| ------ | ------------------------------------------------ | -------------- | +| -v | 显示版本信息 | 否 | +| -f | 在前台运行脚本,不将其放到后台 | 否 | +| -d | 以守护进程模式启动,即在后台运行 | 否 | +| -p | 指定一个文件来存放进程ID,用于进程管理 | 否 | +| -c | 指定配置文件夹的路径,脚本会从这里加载配置文件 | 否 | +| -g | 打印垃圾回收(GC)的详细信息 | 否 | +| -H | 指定Java堆转储文件的路径,当JVM内存溢出时使用 | 否 | +| -E | 指定JVM错误日志文件的路径 | 否 | +| -D | 定义系统属性,格式为 key=value | 否 | +| -X | 直接传递 -XX 参数给 JVM | 否 | +| -h | 帮助指令 | 否 | + +#### 2.1.2 移除 ConfigNode 节点 + +首先通过 CLI 连接集群,通过 show confignodes 确认想要移除 ConfigNode 的 NodeID: + +```SQL +IoTDB> show confignodes ++------+-------+---------------+------------+--------+ +|NodeID| Status|InternalAddress|InternalPort| Role| ++------+-------+---------------+------------+--------+ +| 0|Running| 127.0.0.1| 10710| Leader| +| 1|Running| 127.0.0.1| 10711|Follower| +| 2|Running| 127.0.0.1| 10712|Follower| ++------+-------+---------------+------------+--------+ +Total line number = 3 +It costs 0.030s +``` + +然后使用 SQL 将 ConfigNode 移除,SQL 命令: + +```Bash +remove confignode [confignode_id] +``` + +### 2.2 DataNode 节点维护 + +DataNode 节点维护有两个常见场景: + +* 集群扩容:出于集群能力扩容等目的,添加新的DataNode进入集群 +* 集群故障恢复:一个DataNode所在机器出现故障,使得该DataNode无法正常运行,此时可以移除该DataNode,并添加新的DataNode进入集群 + +> ❗️注意,为了使集群能正常工作,在DataNode节点维护过程中以及维护完成后,正常运行的DataNode总数不得少于数据副本数(通常为2),也不得少于元数据副本数(通常为3)。 + +#### 2.2.1 添加DataNode节点 + +脚本命令: + +```Bash +# Linux / MacOS +# 首先切换到IoTDB根目录 +sbin/start-datanode.sh + +# Windows +# 首先切换到IoTDB根目录 +# V2.0.4.x 版本之前 +sbin\start-datanode.bat + +# V2.0.4.x 版本及之后 +tools\windows\start-datanode.bat +``` + +参数介绍: + +| 缩写 | 描述 | 是否为必填项 | +| ------ | ------------------------------------------------ | -------------- | +| -v | 显示版本信息 | 否 | +| -f | 在前台运行脚本,不将其放到后台 | 否 | +| -d | 以守护进程模式启动,即在后台运行 | 否 | +| -p | 指定一个文件来存放进程ID,用于进程管理 | 否 | +| -c | 指定配置文件夹的路径,脚本会从这里加载配置文件 | 否 | +| -g | 打印垃圾回收(GC)的详细信息 | 否 | +| -H | 指定Java堆转储文件的路径,当JVM内存溢出时使用 | 否 | +| -E | 指定JVM错误日志文件的路径 | 否 | +| -D | 定义系统属性,格式为 key=value | 否 | +| -X | 直接传递 -XX 参数给 JVM | 否 | +| -h | 帮助指令 | 否 | + +说明:在添加DataNode后,随着新的写入到来(以及旧数据过期,如果设置了TTL),集群负载会逐渐向新的DataNode均衡,最终在所有节点上达到存算资源的均衡。 + +#### 2.2.2 移除DataNode节点 + +首先通过CLI连接集群,通过`show datanodes`确认想要移除的DataNode的NodeID: + +```SQL +IoTDB> show datanodes ++------+-------+----------+-------+-------------+---------------+ +|NodeID| Status|RpcAddress|RpcPort|DataRegionNum|SchemaRegionNum| ++------+-------+----------+-------+-------------+---------------+ +| 1|Running| 0.0.0.0| 6667| 0| 0| +| 2|Running| 0.0.0.0| 6668| 1| 1| +| 3|Running| 0.0.0.0| 6669| 1| 0| ++------+-------+----------+-------+-------------+---------------+ +Total line number = 3 +It costs 0.110s +``` + +然后使用SQL将DataNode移除,SQL命令: + +```Bash +remove datanode [datanode_id] +``` + + +## 3. 负载均衡 Region 迁移属于高级运维功能,具有一定操作成本,建议完整阅读后再使用该功能。如有疑问请联系 IoTDB 团队寻求技术支持。 -### 2.1 功能介绍 +### 3.1 功能介绍 IoTDB 是一个分布式数据库,数据的均衡分布对集群的磁盘空间、写入压力的负载均衡有着重要作用,region 是数据在 IoTDB 集群中进行分布式存储的基本单元,具体概念可见[region](../Background-knowledge/Cluster-Concept.md)。 @@ -236,14 +375,14 @@ IoTDB 是一个分布式数据库,数据的均衡分布对集群的磁盘空 ![](/img/region%E8%BF%81%E7%A7%BB%E7%A4%BA%E6%84%8F%E5%9B%BE20241210.png) -### 2.2 注意事项 +### 3.2 注意事项 1. 推荐仅在 IoTDB 1.3.3 以及更高版本使用 Region 迁移功能。 2. 仅在共识协议为 IoTConsensus、Ratis 时支持 Region 迁移(iotdb-system.properties中的`schema_region_consensus_protocol_class` 和 `data_region_consensus_protocol_class`)。 3. Region 迁移会占用硬盘和网络带宽等系统资源,推荐在低业务负载时进行。 4. 在理想情况下,Region 迁移不影响用户侧读写。特殊情况下,Region 迁移可能阻塞写入,这种情况的具体鉴别与处理方式见使用说明。 -### 2.3 使用说明 +### 3.3 使用说明 - **语法定义**: