-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sql statement about pump and drainer (#3324)
- Loading branch information
1 parent
682d1b6
commit bca4998
Showing
6 changed files
with
260 additions
and
0 deletions.
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
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 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 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 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 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) |