-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add sql statement about pump and drainer #3324
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
Merged
sre-bot
merged 21 commits into
pingcap:docs-special-week
from
WangXiangUSTC:xiang/tools_sql
May 26, 2020
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
12b5051
add sql statement about pump and drainer
WangXiangUSTC 6dd5eaf
minor update
WangXiangUSTC 169e748
update toc
WangXiangUSTC c0d62a4
Merge branch 'docs-special-week' into xiang/tools_sql
WangXiangUSTC e33f41e
add show master status
WangXiangUSTC 16a67f0
Merge branch 'xiang/tools_sql' of https://github.com/WangXiangUSTC/do…
WangXiangUSTC 08db095
Merge branch 'docs-special-week' into xiang/tools_sql
WangXiangUSTC ae23638
merge and resolve conflicts
WangXiangUSTC b9a7197
Merge branch 'xiang/tools_sql' of https://github.com/WangXiangUSTC/do…
WangXiangUSTC 336ae37
Merge branch 'docs-special-week' into xiang/tools_sql
WangXiangUSTC f977d2a
Apply suggestions from code review
WangXiangUSTC 34bf3ec
add sql
WangXiangUSTC 56665e7
Merge branch 'docs-special-week' into xiang/tools_sql
WangXiangUSTC c737fd4
Merge branch 'docs-special-week' into xiang/tools_sql
WangXiangUSTC b3cfa72
Update sql-statements/sql-statement-change-drainer.md
WangXiangUSTC 1b4daca
Update sql-statements/sql-statement-change-pump.md
WangXiangUSTC c66c23f
Merge branch 'docs-special-week' into xiang/tools_sql
WangXiangUSTC ed5d8c4
Apply suggestions from code review
WangXiangUSTC bb3f2b6
Merge branch 'docs-special-week' into xiang/tools_sql
bb7133 e4334ea
Merge branch 'docs-special-week' into xiang/tools_sql
yikeke 1aefe43
Merge branch 'docs-special-week' into xiang/tools_sql
sre-bot 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| --- | ||
| title: CHANGE DRAINER | ||
| summary: TiDB 数据库中 CHANGE DRAINER 的使用概况。 | ||
| category: reference | ||
| --- | ||
|
|
||
| # CHANGE DRAINER | ||
|
|
||
| `CHANGE DRAINER` 语句用于修改集群中 Drainer 的状态信息。 | ||
|
|
||
| > **注意:** | ||
| > | ||
| > Drainer 在正常运行时会自动上报状态到 PD,仅在 Drainer 处于异常情况导致实际状态与 PD 中保存的状态信息不一致时,使用该语句修改 PD 中存储的 Drainer 状态信息。 | ||
|
|
||
| ## 示例 | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| SHOW DRAINER STATUS; | ||
| ``` | ||
|
|
||
| ```sql | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| | NodeID | Address | State | Max_Commit_Ts | Update_Time | | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| | drainer1 | 127.0.0.3:8249 | Online | 408553768673342532 | 2019-04-30 00:00:03 | | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| | drainer2 | 127.0.0.4:8249 | Online | 408553768673345531 | 2019-05-01 00:00:04 | | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| 2 rows in set (0.00 sec) | ||
| ``` | ||
|
|
||
| 可以看出 `drainer1` 已经超过一天没有更新状态,该 Drainer 处于异常状态,但是 State 仍然为 `Online`,使用 `CHANGE DRAINER` 将该 Drainer 状态修改为 `paused`: | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| CHANGE DRAINER TO NODE_STATE ='paused' FOR NODE_ID 'drainer1'; | ||
| ``` | ||
|
|
||
| ```sql | ||
| Query OK, 0 rows affected (0.01 sec) | ||
| ``` | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| SHOW DRAINER STATUS; | ||
| ``` | ||
|
|
||
| ```sql | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| | NodeID | Address | State | Max_Commit_Ts | Update_Time | | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| | drainer1 | 127.0.0.3:8249 | Paused | 408553768673342532 | 2019-04-30 00:00:03 | | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| | drainer2 | 127.0.0.4:8249 | Online | 408553768673345531 | 2019-05-01 00:00:04 | | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| 2 rows in set (0.00 sec) | ||
| ``` | ||
|
|
||
| ## MySQL 兼容性 | ||
|
|
||
| MySQL 无此功能。 | ||
|
|
||
| ## 另请参阅 | ||
|
|
||
| * [SHOW PUMP STATUS](/sql-statements/sql-statement-show-pump-status.md) | ||
| * [SHOW DRAINER STATUS](/sql-statements/sql-statement-show-drainer-status.md) | ||
| * [CHANGE PUMP STATUS](/sql-statements/sql-statement-change-pump.md) | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| --- | ||
| title: CHANGE PUMP | ||
| summary: TiDB 数据库中 CHANGE PUMP 的使用概况。 | ||
| category: reference | ||
| --- | ||
|
|
||
| # CHANGE PUMP | ||
|
|
||
| `CHANGE PUMP` 语句用于修改集群中 Pump 的状态信息。 | ||
|
|
||
| > **注意:** | ||
| > | ||
| > Pump 在正常运行时会自动上报状态到 PD,仅在 Pump 处于异常情况导致实际状态与 PD 中保存的状态信息不一致时,使用该语句修改 PD 中存储的 Pump 状态信息。 | ||
|
|
||
| ## 示例 | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| SHOW PUMP STATUS; | ||
| ``` | ||
|
|
||
| ```sql | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| | NodeID | Address | State | Max_Commit_Ts | Update_Time | | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| | pump1 | 127.0.0.1:8250 | Online | 408553768673342237 | 2019-04-30 00:00:01 | | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| | pump2 | 127.0.0.2:8250 | Online | 408553768673342335 | 2019-05-01 00:00:02 | | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| 2 rows in set (0.00 sec) | ||
| ``` | ||
|
|
||
| 可以看出 `pump1` 已经超过一天没有更新状态,该 Pump 处于异常状态,但是 State 仍然为 `Online`,使用 `CHANGE PUMP` 将该 Pump 状态修改为 `paused`: | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| CHANGE PUMP TO NODE_STATE ='paused' FOR NODE_ID 'pump1'; | ||
| ``` | ||
|
|
||
| ```sql | ||
| Query OK, 0 rows affected (0.01 sec) | ||
| ``` | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| SHOW PUMP STATUS; | ||
| ``` | ||
|
|
||
| ```sql | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| | NodeID | Address | State | Max_Commit_Ts | Update_Time | | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| | pump1 | 127.0.0.1:8250 | Paused | 408553768673342237 | 2019-04-30 00:00:01 | | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| | pump2 | 127.0.0.2:8250 | Online | 408553768673342335 | 2019-05-01 00:00:02 | | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| 2 rows in set (0.00 sec) | ||
| ``` | ||
|
|
||
| ## MySQL 兼容性 | ||
|
|
||
| MySQL 无此功能。 | ||
|
|
||
| ## 另请参阅 | ||
|
|
||
| * [SHOW PUMP STATUS](/sql-statements/sql-statement-show-pump-status.md) | ||
| * [SHOW DRAINER STATUS](/sql-statements/sql-statement-show-drainer-status.md) | ||
| * [CHANGE DRAINER STATUS](/sql-statements/sql-statement-change-drainer.md) |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| --- | ||
| title: SHOW DRAINER STATUS | ||
| summary: TiDB 数据库中 SHOW DRAINER STATUS 的使用概况。 | ||
| category: reference | ||
| --- | ||
|
|
||
| # SHOW DRAINER STATUS | ||
|
|
||
| `SHOW DRAINER STATUS` 语句用于显示集群中所有 Drainer 的状态信息。 | ||
|
|
||
| ## 示例 | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| SHOW DRAINER STATUS; | ||
| ``` | ||
|
|
||
| ```sql | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| | NodeID | Address | State | Max_Commit_Ts | Update_Time | | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| | drainer1 | 127.0.0.3:8249 | Online | 408553768673342532 | 2019-05-01 00:00:03 | | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| | drainer2 | 127.0.0.4:8249 | Online | 408553768673345531 | 2019-05-01 00:00:04 | | ||
| +----------|----------------|--------|--------------------|---------------------| | ||
| 2 rows in set (0.00 sec) | ||
| ``` | ||
|
|
||
| ## MySQL 兼容性 | ||
|
|
||
| MySQL 无此功能。 | ||
|
|
||
| ## 另请参阅 | ||
|
|
||
| * [SHOW PUMP STATUS](/sql-statements/sql-statement-show-pump-status.md) | ||
| * [CHANGE PUMP STATUS](/sql-statements/sql-statement-change-pump.md) | ||
| * [CHANGE DRAINER STATUS](/sql-statements/sql-statement-change-drainer.md) |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| --- | ||
| title: SHOW MASTER STATUS | ||
| summary: TiDB 数据库中 SHOW MASTER STATUS 的使用概况。 | ||
| category: reference | ||
| --- | ||
|
|
||
| # SHOW MASTER STATUS | ||
|
|
||
| `SHOW MASTER STATUS` 语句用于显示集群当前最新的 TSO 信息。 | ||
|
|
||
| ## 示例 | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| SHOW MASTER STATUS; | ||
| ``` | ||
|
|
||
| ```sql | ||
| +-------------+--------------------+--------------+------------------+-------------------+ | ||
| | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | | ||
| +-------------+--------------------+--------------+------------------+-------------------+ | ||
| | tidb-binlog | 416916363252072450 | | | | | ||
| +-------------+--------------------+--------------+------------------+-------------------+ | ||
| 1 row in set (0.00 sec) | ||
| ``` | ||
|
|
||
| ## MySQL 兼容性 | ||
|
|
||
| `SHOW MASTER STATUS` 语句与 MySQL 兼容,但是执行结果有差异,在 MySQL 中执行结果为 binlog 的位置信息,而在 TiDB 中为最新的 TSO 信息。 | ||
|
|
||
| ## 另请参阅 | ||
|
|
||
| * [SHOW PUMP STATUS](/sql-statements/sql-statement-show-pump-status.md) | ||
| * [SHOW DRAINER STATUS](/sql-statements/sql-statement-show-drainer-status.md) | ||
| * [CHANGE PUMP STATUS](/sql-statements/sql-statement-change-pump.md) | ||
| * [CHANGE DRAINER STATUS](/sql-statements/sql-statement-change-drainer.md) |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| --- | ||
| title: SHOW PUMP STATUS | ||
| summary: TiDB 数据库中 SHOW PUMP STATUS 的使用概况。 | ||
| category: reference | ||
| --- | ||
|
|
||
| # SHOW PUMP STATUS | ||
|
|
||
| `SHOW PUMP STATUS` 语句用于显示集群中所有 Pump 的状态信息。 | ||
|
|
||
| ## 示例 | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| SHOW PUMP STATUS; | ||
| ``` | ||
|
|
||
| ```sql | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| | NodeID | Address | State | Max_Commit_Ts | Update_Time | | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| | pump1 | 127.0.0.1:8250 | Online | 408553768673342237 | 2019-05-01 00:00:01 | | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| | pump2 | 127.0.0.2:8250 | Online | 408553768673342335 | 2019-05-01 00:00:02 | | ||
| +--------|----------------|--------|--------------------|---------------------| | ||
| 2 rows in set (0.00 sec) | ||
| ``` | ||
|
|
||
| ## MySQL 兼容性 | ||
|
|
||
| MySQL 无此功能。 | ||
|
|
||
| ## 另请参阅 | ||
|
|
||
| * [SHOW DRAINER STATUS](/sql-statements/sql-statement-show-drainer-status.md) | ||
| * [CHANGE PUMP STATUS](/sql-statements/sql-statement-change-pump.md) | ||
| * [CHANGE DRAINER STATUS](/sql-statements/sql-statement-change-drainer.md) |
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.
Uh oh!
There was an error while loading. Please reload this page.