Skip to content
Open
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
2 changes: 2 additions & 0 deletions src/.vuepress/sidebar/V2.0.x/en-Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ export const enSidebar = {
{ text: 'Schema Export', link: 'Schema-Export-Tool' },
],
},
{ text: 'Full Backup Tool', link: 'Backup-Tool' },
{ text: 'Health Check Tool', link: 'Health-Check-Tool' },
],
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/.vuepress/sidebar/V2.0.x/zh-Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ export const zhSidebar = {
{ text: '元数据导出', link: 'Schema-Export-Tool' },
],
},
{ text: '全量备份工具', link: 'Backup-Tool' },
{ text: '健康检查工具', link: 'Health-Check-Tool' },
],
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/.vuepress/sidebar_timecho/V2.0.x/en-Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ export const enSidebar = {
{ text: 'Schema Export', link: 'Schema-Export-Tool' },
],
},
{ text: 'Full Backup Tool', link: 'Backup-Tool' },
{ text: 'Health Check Tool', link: 'Health-Check-Tool' },
],
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/.vuepress/sidebar_timecho/V2.0.x/zh-Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ export const zhSidebar = {
{ text: '元数据导出', link: 'Schema-Export-Tool' },
],
},
{ text: '全量备份工具', link: 'Backup-Tool' },
{ text: '健康检查工具', link: 'Health-Check-Tool' },
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ Use the hostname for `cn_internal_address` and `dn_internal_address` in IoTDB co
3. **Unmodifiable Parameters**: Some parameters cannot be changed after the first startup. Refer to the [Parameter Configuration](#22-parameters-configuration) section.


1. **Installation Path**: Ensure the installation path contains no spaces or non-ASCII characters to prevent runtime issues.
2. **User Permissions**: Choose one of the following permissions during installation and deployment:
4. **Installation Path**: Ensure the installation path contains no spaces or non-ASCII characters to prevent runtime issues.
5. **User Permissions**: Choose one of the following permissions during installation and deployment:
- **Root User (Recommended)**: This avoids permission-related issues.
- **Non-Root User**:
- Use the same user for all operations, including starting, activating, and stopping services.
- Avoid using `sudo`, which can cause permission conflicts.

6. **Monitoring Panel**: Deploy a monitoring panel to track key performance metrics. Contact the Timecho team for access and refer to the [Monitoring Board Install and Deploy](../Deployment-and-Maintenance/Monitoring-panel-deployment.md).
6. **Health Check Tool**: Before installation, the health check tool can help inspect the operating environment of IoTDB nodes and obtain detailed inspection results. The usage method of the IoTDB health check tool can be found in:[Health Check Tool](../Tools-System/Health-Check-Tool.md).

## 2. Preparation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ Use the hostname for `cn_internal_address` and `dn_internal_address` in IoTDB co
3. **Unmodifiable Parameters**: Some parameters cannot be changed after the first startup. Refer to the [Parameter Configuration](#22-parameters-configuration) section.


1. **Installation Path**: Ensure the installation path contains no spaces or non-ASCII characters to prevent runtime issues.
2. **User Permissions**: Choose one of the following permissions during installation and deployment:
4. **Installation Path**: Ensure the installation path contains no spaces or non-ASCII characters to prevent runtime issues.
5. **User Permissions**: Choose one of the following permissions during installation and deployment:
- **Root User (Recommended)**: This avoids permission-related issues.
- **Non-Root User**:
- Use the same user for all operations, including starting, activating, and stopping services.
- Avoid using `sudo`, which can cause permission conflicts.

6. **Monitoring Panel**: Deploy a monitoring panel to track key performance metrics. Contact the Timecho team for access and refer to the [Monitoring Board Install and Deploy](../Deployment-and-Maintenance/Monitoring-panel-deployment.md).

7. **Health Check Tool**: Before installation, the health check tool can help inspect the operating environment of IoTDB nodes and obtain detailed inspection results. The usage method of the IoTDB health check tool can be found in:[Health Check Tool](../Tools-System/Health-Check-Tool.md).


## 2. Preparation

1. Obtain the TimechoDB installation package: `timechodb-{version}-bin.zip` following [IoTDB-Package](../Deployment-and-Maintenance/IoTDB-Package_timecho.md))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Use the hostname for `cn_internal_address` and `dn_internal_address` in IoTDB co
- Use the same user for all operations, including starting, activating, and stopping services.
- Avoid using `sudo`, which can cause permission conflicts.

6. **Monitoring Panel**: Deploy a monitoring panel to track key performance metrics. Contact the Timecho team for access and refer to the [Monitoring Board Install and Deploy](../Deployment-and-Maintenance/Monitoring-panel-deployment.md).
6. **Health Check Tool**: Before installation, the health check tool can help inspect the operating environment of IoTDB nodes and obtain detailed inspection results. The usage method of the IoTDB health check tool can be found in:[Health Check Tool](../Tools-System/Health-Check-Tool.md).

## 2. Installation Steps

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ Use the hostname for `cn_internal_address` and `dn_internal_address` in IoTDB co

6. **Monitoring Panel**: Deploy a monitoring panel to track key performance metrics. Contact the Timecho team for access and refer to the [Monitoring Board Install and Deploy](../Deployment-and-Maintenance/Monitoring-panel-deployment.md).

7. **Health Check Tool**: Before installation, the health check tool can help inspect the operating environment of IoTDB nodes and obtain detailed inspection results. The usage method of the IoTDB health check tool can be found in:[Health Check Tool](../Tools-System/Health-Check-Tool.md).


## 2. Installation Steps

### 2.1 Extract Installation Package
Expand Down
135 changes: 135 additions & 0 deletions src/UserGuide/Master/Table/Tools-System/Backup-Tool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<!--

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.

-->

# Backup Tool

## 1. Overview

The IoTDB Full Backup Tool is designed to create a full backup of a single IoTDB node’s data via hard links to a specified local directory. The backup can then be directly started and joined to the original cluster. The tool offers two modes: **Quick Mirror Mode** and **Manual Backup Path Mode**.

> **Notes**:
>
> * **Stop the IoTDB service before starting the backup**.
> * The script runs in the background by default, and logs are saved to log files during execution.


## 2. Backup Modes

### 2.1 Mode 1: Quick Mirror Mode

#### Usage

```bash
backup.sh/backup.bat -quick -node xxx
# Optional values for xxx are shown in the following examples

backup.sh/backup.bat -quick -node
# Back up all nodes to the default path

backup.sh/backup.bat -quick -node all
# Back up all nodes to the default path

backup.sh/backup.bat -quick -node confignode
# Back up only the ConfigNode to the default path

backup.sh/backup.bat -quick -node datanode
# Back up only the DataNode to the default path
```

#### Parameter Descriptions

| **Parameter** | **Description** | **Required** |
| ----------------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ---------------------- |
| `-quick` | Enables Quick Mirror Mode. | No |
| `-node` | Specifies the node type to back up. Options: `all`, `datanode`, or `confignode`. Default: `all`. <br>`all`: Back up both DataNode and ConfigNode. <br>`datanode`: Back up only the DataNode. <br>`confignode`: Back up only the ConfigNode. | No |

**Process Details**:

1. Check if the `_backup` folder already exists in the current IoTDB directory or paths specified in the configuration file. If it exists, the tool exits with the error: `The backup folder already exists`.
> When the backup folder already exists, you can try the following solutions:
> * Delete the existing _backup folder and retry the backup.
> * Modify the backup path to avoid conflicts.

2. Create hard links from the original `dn_data_dirs` paths to the corresponding `_backup` paths.
* Example: If `dn_data_dirs=/data/iotdb/data/datanode/data`, the backup data will be stored in `/data/iotdb/data/datanode/data_backup`.
3. Copy other files from the IoTDB directory (e.g., `/data/iotdb`) to the `_backup` path (e.g., `/data/iotdb_backup`).


### 2.2 Mode 2: Manual Backup Path Mode

#### Usage

```bash
backup.sh -node xxx -targetdir xxx -targetdatadir xxx -targetwaldir xxx
```

#### Parameter Descriptions

| **Parameter** | **Description** | **Required** |
| ----------------------- | -------------------------------------------------------------------------------------------- | ---------------------- |
| `-node` | Node type to back up (`all`, `datanode`, or `confignode`). Default: `all`. | No |
| `-targetdir` | Target directory for backing up the IoTDB folder. | **Yes** |
| `-targetdatadir` | Target path for `dn_data_dirs` files. Default: `targetdir/data/datanode/data`. | No |
| `-targetwaldir` | Target path for `dn_wal_dirs` files. Default: `targetdir/data/datanode/wal`. | No |

**Process Details**:

1. The `-targetdir` parameter is mandatory. If missing, the tool exits with the error: `-targetdir cannot be empty. The backup folder must be specified`.
2. Validate consistency between configuration paths (`dn_data_dirs`, `dn_wal_dirs`) and parameters (`-targetdatadir`, `-targetwaldir`):

* If `-targetdatadir` or `-targetwaldir` is a single path, it is considered consistent.
* If the number of source paths (from configuration) does not match the target paths, the tool exits with the error: `-targetdatadir parameter exception: the number of original paths does not match the specified paths`.
3. Check if `-targetdatadir` paths are on the same disk as the original paths:

* **Same disk**: Attempt to create hard links. If hard links fail, copy files instead.
* **Different disk**: Copy files directly.
4. Path Matching Rules

* **Many-to-One**: Multiple source paths can be backed up to a single target path.
* **One-to-One**: A single source path can be backed up to a single target path.
* **Many-to-Many**: Multiple source paths can be backed up to multiple target paths, but the pattern must match.

#### Examples

| **Configuration Paths** | **`-targetdatadir` Paths** | **Result** |
| ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| `/data/iotdb/data/datanode/data` | `/data/iotdb_backup/data/datanode/data` |**Consistent** |
| `/data/iotdb/data/datanode/data` | `/data/iotdb_backup/data/datanode/data1,/data/iotdb_backup/data/datanode/data2` | **Inconsistent** |
| `/data/iotdb/data/datanode/data1,/data/iotdb/data/datanode/data2` | `/data/iotdb_backup/data/datanode/data` | **Consistent** |
| `/data/iotdb/data/datanode/data1,/data/iotdb/data/datanode/data2` | `/data/iotdb_backup/data/datanode/data3,/data/iotdb_backup/data/datanode/data4` | **Consistent** |
| `/data/iotdb/data/datanode/data1,/data/iotdb/data/datanode/data2;/data/iotdb/data/datanode/data3` | `/data/iotdb_backup/data/datanode/data` | **Consistent** |
| `/data/iotdb/data/datanode/data1,/data/iotdb/data/datanode/data2;/data/iotdb/data/datanode/data3` | `/data/iotdb_backup/data/datanode/data1;/data/iotdb_backup/data/datanode/data1` | **Consistent** |
| `/data/iotdb/data/datanode/data1,/data/iotdb/data/datanode/data2;/data/iotdb/data/datanode/data3` | `/data/iotdb_backup/data/datanode/data1,/data/iotdb_backup/data/datanode/data3;/data/iotdb_backup/data/datanode/data` | **Consistent** |
| `/data/iotdb/data/datanode/data1,/data/iotdb/data/datanode/data2;/data/iotdb/data/datanode/data3` | `/data/iotdb_backup/data/datanode/data1,/data/iotdb_backup/data/datanode/data3;/data/iotdb_backup/data/datanode/data1,/data/iotdb_backup/data/datanode/data4` | **Inconsistent** |

#### Path Matching Rules Summary

* **Paths separated by `;` only**:
* `-targetdatadir` can be a single path (no `;` or `,`).
* `-targetdatadir` can also use `;` to split paths, but the count must match the source paths.
* **Paths separated by `,` only**:
* `-targetdatadir` can be a single path (no `;` or `,`).
* `-targetdatadir` can also use `,` to split paths, but the count must match the source paths.
* **Paths with both `;` and `,`**:
* `-targetdatadir` can be a single path (no `;` or `,`).
* Split paths first by `;`, then by `,`. The number of paths at each level must match.

> **Note**: The `dn_wal_dirs` parameter (for WAL paths) follows the same rules as `dn_data_dirs`.
Loading