Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/.vuepress/sidebar/V1.3.3/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,15 @@ export const enSidebar = {
{ text: 'Stream Processing', link: 'Streaming_apache' },
],
},
{ text: 'Maintenance SQL', link: 'Maintennance' },
{
text: 'Maintenance SQL',
collapsible: true,
children: [
{ text: 'Query Performance Analysis', link: 'Query-Performance-Analysis' },
{ text: 'Load Balance', link: 'Load-Balance' },
{ text: 'Data Recovery', link: 'Data-Recovery' },
],
},
],
},
{
Expand Down
10 changes: 9 additions & 1 deletion src/.vuepress/sidebar/V1.3.3/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@ export const zhSidebar = {
{ text: '流处理框架', link: 'Streaming_apache' },
],
},
{ text: '运维语句', link: 'Maintennance' },
{
text: '运维语句',
collapsible: true,
children: [
{ text: '查询性能分析', link: 'Query-Performance-Analysis' },
{ text: '负载均衡', link: 'Load-Balance' },
{ text: '数据修复', link: 'Data-Recovery' },
],
},
],
},
{
Expand Down
10 changes: 9 additions & 1 deletion src/.vuepress/sidebar_timecho/V1.3.3/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,15 @@ export const enSidebar = {
{ text: 'Stream Processing', link: 'Streaming_timecho' },
],
},
{ text: 'Maintenance SQL', link: 'Maintennance' },
{
text: 'Maintenance SQL',
collapsible: true,
children: [
{ text: 'Query Performance Analysis', link: 'Query-Performance-Analysis' },
{ text: 'Load Balance', link: 'Load-Balance' },
{ text: 'Data Recovery', link: 'Data-Recovery' },
],
},
],
},
{
Expand Down
10 changes: 9 additions & 1 deletion src/.vuepress/sidebar_timecho/V1.3.3/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,15 @@ export const zhSidebar = {
{ text: '流处理框架', link: 'Streaming_timecho' },
],
},
{ text: '运维语句', link: 'Maintennance' },
{
text: '运维语句',
collapsible: true,
children: [
{ text: '查询性能分析', link: 'Query-Performance-Analysis' },
{ text: '负载均衡', link: 'Load-Balance' },
{ text: '数据修复', link: 'Data-Recovery' },
],
},
],
},
{
Expand Down
10 changes: 9 additions & 1 deletion src/.vuepress/sidebar_timecho/V2.0.1/zh-Tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,15 @@ export const zhSidebar = {
{ text: '流处理框架', link: 'Streaming_timecho' },
],
},
{ text: '运维语句', link: 'Maintennance' },
{
text: '运维语句',
collapsible: true,
children: [
{ text: '查询性能分析', link: 'Query-Performance-Analysis' },
{ text: '负载均衡', link: 'Load-Balance' },
{ text: '数据修复', link: 'Data-Recovery' },
],
},
],
},
{
Expand Down
47 changes: 47 additions & 0 deletions src/UserGuide/Master/Tree/User-Manual/Data-Recovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

-->

## Data Recovery

Used to fix issues in data, such as data in sequential space not being arranged in chronological order.

### START REPAIR DATA

Start a repair task to scan all files created before current time.
The repair task will scan all tsfiles and repair some bad files.

```sql
IoTDB> START REPAIR DATA
IoTDB> START REPAIR DATA ON LOCAL
IoTDB> START REPAIR DATA ON CLUSTER
```

### STOP REPAIR DATA

Stop the running repair task. To restart the stopped task.
If there is a stopped repair task, it can be restart and recover the repair progress by executing SQL `START REPAIR DATA`.

```sql
IoTDB> STOP REPAIR DATA
IoTDB> STOP REPAIR DATA ON LOCAL
IoTDB> STOP REPAIR DATA ON CLUSTER
```

95 changes: 95 additions & 0 deletions src/UserGuide/Master/Tree/User-Manual/Load-Balance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

-->

## 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.


### 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)。

Under normal operation of the cluster, IoTDB will automatically perform load balancing on data. However, in scenarios where a new DataNode node is added to the cluster or where the hard disk of the machine where the DataNode is located is damaged and data needs to be recovered, manual region migration can be used to finely adjust the cluster load and operations.

Here is a schematic diagram of the region migration process :


![](https://alioss.timecho.com/docs/img/region%E8%BF%81%E7%A7%BB%E7%A4%BA%E6%84%8F%E5%9B%BE20241210.png)

### 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 will occupy system resources such as hard drives and network bandwidth, and it is recommended to perform it during low business loads.
4. The region migration process will occupy WAL files, blocking the deletion of WAL files in this consensus group. If the total number of WAL files reaches `wal_file_size_threshold_in_byte`, writing will be blocked.

### Instructions for use

- **Grammar definition** :

Submit an asynchronous task to migrate a region from one DataNode to another.


```SQL
migrateRegion
: MIGRATE REGION regionId=INTEGER_LITERAL FROM fromId=INTEGER_LITERAL TO toId=INTEGER_LITERAL
;
```

- **Example** :

Migrating region 1 from DataNode 2 to DataNode 3:

```SQL
IoTDB> migrate region 1 from 2 to 3
Msg: The statement is executed successfully.
```

"The statement is executed successfully" only represents the successful submission of the region migration task, not the completion of execution. The execution status of the task can be viewed through the CLI command `show regions `.
- **Related configuration** :
- Migration speed control : modify `iotdb-system.properties `parameters `region_migration_speed_limit_bytes_per_second `control region migration speed.
- **Time cost estimation** :
- If there are no concurrent writes during the migration process, the time consumption can be simply estimated by dividing the region data volume by the data transfer speed. For example, for a 1TB region, the hard disk internet bandwidth and speed limit parameters jointly determine that the data transfer speed is 100MB/s, so it takes about 3 hours to complete the migration.
- If there are concurrent writes in the migration process, the time consumption will increase, and the specific time consumption depends on various factors such as write pressure and system resources. It can be simply estimated as `no concurrent write time × 1.5 `.
- **Migration progress observation** : During the migration process, the state changes can be observed through the CLI command `show regions `. Taking the 2 replicas as an example, the state of the consensus group where the region is located will go through the following process:
- Before migration starts: `Running `, `Running `.
- Expansion phase: `Running `, `Running `, `Adding `. Due to the large number of file transfers involved, it may take a long time. If using IoTConsensus, the specific file transfer progress can be searched in the DataNode log `[SNAPSHOT TRANSMISSION] `.
- Stages: `Removing `, `Running `, `Running `.
- Migration complete: `Running `, `Running `.

Taking the expansion phase as an example, the result of `show regions` may be:

```Plain
IoTDB> show regions
+--------+------------+-------+--------+-------------+-----------+----------+----------+-------+---------------+--------+-----------------------+
|RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort|InternalAddress| Role| CreateTime|
+--------+------------+-------+--------+-------------+-----------+----------+----------+-------+---------------+--------+-----------------------+
| 0|SchemaRegion|Running| root.ln| 1| 0| 1| 0.0.0.0| 6668| 127.0.0.1| Leader|2024-04-15T18:55:17.691|
| 0|SchemaRegion|Running| root.ln| 1| 0| 2| 0.0.0.0| 6668| 127.0.0.1| Leader|2024-04-15T18:55:17.691|
| 0|SchemaRegion|Running| root.ln| 1| 0| 3| 0.0.0.0| 6668| 127.0.0.1| Leader|2024-04-15T18:55:17.691|
| 1| DataRegion|Running| root.ln| 1| 1| 1| 0.0.0.0| 6667| 127.0.0.1| Leader|2024-04-15T18:55:19.457|
| 1| DataRegion|Running| root.ln| 1| 1| 2| 0.0.0.0| 6668| 127.0.0.1|Follower|2024-04-15T18:55:19.457|
| 1| DataRegion| Adding| root.ln| 1| 1| 3| 0.0.0.0| 6668| 127.0.0.1|Follower|2024-04-15T18:55:19.457|
+--------+------------+-------+--------+-------------+-----------+----------+----------+-------+---------------+--------+-----------------------+
Total line number = 3
It costs 0.003s
```
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# Maintennance

## Explain/Explain Analyze Statements
## Query Performance Analysis

The purpose of query analysis is to assist users in understanding the execution mechanism and performance bottlenecks of queries, thereby facilitating query optimization and performance enhancement. This is crucial not only for the efficiency of query execution but also for the user experience of applications and the efficient utilization of resources. For effective query analysis, IoTDB versions V1.3.2 and above offer the query analysis statements: Explain and Explain Analyze.

Expand Down Expand Up @@ -346,27 +346,3 @@ Observing the results, we found that it is because the query did not add a time

The final optimization plan is: Add a time filtering condition to avoid a full table scan.


## Start/Stop Repair Data Statements
Used to repair the unsorted data generate by system bug.
### START REPAIR DATA

Start a repair task to scan all files created before current time.
The repair task will scan all tsfiles and repair some bad files.

```sql
IoTDB> START REPAIR DATA
IoTDB> START REPAIR DATA ON LOCAL
IoTDB> START REPAIR DATA ON CLUSTER
```

### STOP REPAIR DATA

Stop the running repair task. To restart the stopped task.
If there is a stopped repair task, it can be restart and recover the repair progress by executing SQL `START REPAIR DATA`.

```sql
IoTDB> STOP REPAIR DATA
IoTDB> STOP REPAIR DATA ON LOCAL
IoTDB> STOP REPAIR DATA ON CLUSTER
```
47 changes: 47 additions & 0 deletions src/UserGuide/V2.0.1/Tree/User-Manual/Data-Recovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

-->

## Data Recovery

Used to fix issues in data, such as data in sequential space not being arranged in chronological order.

### START REPAIR DATA

Start a repair task to scan all files created before current time.
The repair task will scan all tsfiles and repair some bad files.

```sql
IoTDB> START REPAIR DATA
IoTDB> START REPAIR DATA ON LOCAL
IoTDB> START REPAIR DATA ON CLUSTER
```

### STOP REPAIR DATA

Stop the running repair task. To restart the stopped task.
If there is a stopped repair task, it can be restart and recover the repair progress by executing SQL `START REPAIR DATA`.

```sql
IoTDB> STOP REPAIR DATA
IoTDB> STOP REPAIR DATA ON LOCAL
IoTDB> STOP REPAIR DATA ON CLUSTER
```

Loading
Loading