-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zh,en: bring relay log back #518
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
155f063
zh,en: bring relay log back
GMHDBJD a31942c
address comment
GMHDBJD c6c13f2
Update en/relay-log.md
GMHDBJD 6d6e727
Update zh/relay-log.md
GMHDBJD b94f735
Update en/source-configuration-file.md
GMHDBJD 3522eac
Update zh/source-configuration-file.md
GMHDBJD ebb7bb3
address comment
GMHDBJD 4f16bb5
Merge branch 'master' into addRelayBack
GMHDBJD 8021569
Update en/relay-log.md
GMHDBJD 7d33751
Update en/source-configuration-file.md
GMHDBJD ddca850
Merge branch 'master' into addRelayBack
GMHDBJD c3f2154
Merge branch 'master' into addRelayBack
CharLotteiu ebd3d84
Merge branch 'master' into addRelayBack
CharLotteiu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,6 @@ aliases: ['/docs-cn/tidb-data-migration/dev/relay-log/'] | |
|
||
# DM Relay Log | ||
|
||
> **注意:** | ||
> | ||
> 当前 DM v2.0 版本暂不支持开启 relay log 功能。 | ||
|
||
DM (Data Migration) 工具的 relay log 由一组有编号的文件和一个索引文件组成。这些有编号的文件包含了描述数据库更改的事件。索引文件包含所有使用过的 relay log 的文件名。 | ||
|
||
DM-worker 在启动后,会自动将上游 binlog 迁移到本地配置目录(若使用 TiUP 部署 DM,则迁移目录默认为 `<deploy_dir> / relay_log` )。DM-worker 在运行过程中,会将上游 binlog 实时迁移到本地文件。DM-worker 的 sync 处理单元会实时读取本地 relay log 的 binlog 事件,将这些事件转换为 SQL 语句,再将 SQL 语句迁移到下游数据库。 | ||
|
@@ -97,30 +93,28 @@ Relay log 的数据清理包括自动清理和手动清理这两种方法。 | |
|
||
### 自动数据清理 | ||
|
||
自动数据清理需对 DM-worker 命令行配置中的以下三项进行配置: | ||
启用自动数据清理需在 source 配置文件中进行以下配置: | ||
|
||
```yaml | ||
# relay log purge strategy | ||
purge: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
interval: 3600 | ||
expires: 24 | ||
remain-space: 15 | ||
``` | ||
|
||
- `purge-interval` | ||
- `purge.interval` | ||
- 后台自动清理的时间间隔,以秒为单位。 | ||
- 默认为 "3600",表示每 3600 秒执行一次后台清理任务。 | ||
|
||
- `purge-expires` | ||
- `purge.expires` | ||
- 当前 relay 处理单元没有写入、或已有数据迁移任务当前或未来不需要读取的 relay log 在被后台清理前可保留的小时数。 | ||
- 默认为 "0",表示不按 relay log 的更新时间执行数据清理。 | ||
|
||
- `purge-remain-space` | ||
- `purge.remain-space` | ||
- 剩余磁盘空间,单位为 GB。若剩余磁盘空间小于该配置,则指定的 DM-worker 机器会在后台尝试自动清理可被安全清理的 relay-log。若这一数字被设为 "0",则表示不按剩余磁盘空间来清理数据。 | ||
- 默认为 "15",表示可用磁盘空间小于 15GB 时,DM-master 会尝试安全地清理 relay log。 | ||
|
||
或者在 DM-woker 的配置文件中加入 purge 配置: | ||
|
||
```toml | ||
# relay log purge strategy | ||
[purge] | ||
interval = 3600 | ||
expires = 24 | ||
remain-space = 15 | ||
``` | ||
|
||
### 手动数据清理 | ||
|
||
手动数据清理是指使用 dmctl 提供的 `purge-relay` 命令,通过指定 `subdir` 和 binlog 文件名,来清理掉**指定 binlog 之前**的所有 relay log。若在命令中不填 `-subdir` 选项,则默认清理**最新 relay log 子目录之前**的所有 relay log。 | ||
|
@@ -168,13 +162,13 @@ deb76a2b-09cc-11e9-9129-5242cf3bb246.000003 | |
{{< copyable "" >}} | ||
|
||
```bash | ||
» purge-relay -w 10.128.16.223:10081 --filename mysql-bin.000001 --sub-dir e4e0e8ab-09cc-11e9-9220-82cc35207219.000002 | ||
» purge-relay -s mysql-replica-01 --filename mysql-bin.000001 --sub-dir e4e0e8ab-09cc-11e9-9220-82cc35207219.000002 | ||
``` | ||
|
||
+ 以下命令默认 `--sub-dir` 为最新的 `deb76a2b-09cc-11e9-9129-5242cf3bb246.000003` 子目录。该目录之前的 relay log 子目录为 `deb76a2b-09cc-11e9-9129-5242cf3bb246.000001` 和 `e4e0e8ab-09cc-11e9-9220-82cc35207219.000002`,所以该命令实际清空了这两个子目录,保留了 `deb76a2b-09cc-11e9-9129-5242cf3bb246.000003`。 | ||
|
||
{{< copyable "" >}} | ||
|
||
```bash | ||
» purge-relay -w 10.128.16.223:10081 --filename mysql-bin.000001 | ||
» purge-relay -s mysql-replica-01 --filename mysql-bin.000001 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for YAML, you can update the following config items, like
purge-interval
topurge.interval
.