Skip to content

Commit 48bec2a

Browse files
committed
improve documentation for TiDB
1 parent a8c9bbd commit 48bec2a

File tree

1 file changed

+9
-39
lines changed

1 file changed

+9
-39
lines changed

mysql/README.md

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ Query OK, 0 rows affected (0.00 sec)
7070

7171
##### TiDB-specific setup
7272

73-
For TiDB databases, the user setup is similar but with some differences:
73+
For TiDB databases, the user setup is similar to other database like MySQL, MariaDB and so on but with some differences:
7474

7575
- TiDB does not have `performance_schema`, so skip the performance_schema grant
7676
- TiDB does not support the `REPLICATION CLIENT` privilege, but this is not needed as TiDB uses different replication mechanisms
7777
- The `innodb_index_stats` table is not available in TiDB
78+
- TiDB does not have STORED_PROCEDURE, so do not need to create procedure for explain.
7879

7980
For TiDB, create the user with these commands:
8081

@@ -86,37 +87,6 @@ mysql> GRANT PROCESS ON *.* TO 'datadog'@'%';
8687
Query OK, 0 rows affected (0.00 sec)
8788
```
8889

89-
Verify the replication client. Replace `<UNIQUEPASSWORD>` with the password you created above:
90-
91-
```shell
92-
mysql -u datadog --password=<UNIQUEPASSWORD> -e "show slave status" && \
93-
echo -e "\033[0;32mMySQL grant - OK\033[0m" || \
94-
echo -e "\033[0;31mMissing REPLICATION CLIENT grant\033[0m"
95-
```
96-
97-
If enabled, metrics can be collected from the `performance_schema` database by granting an additional privilege:
98-
99-
```shell
100-
mysql> show databases like 'performance_schema';
101-
+-------------------------------+
102-
| Database (performance_schema) |
103-
+-------------------------------+
104-
| performance_schema |
105-
+-------------------------------+
106-
1 row in set (0.00 sec)
107-
108-
mysql> GRANT SELECT ON performance_schema.* TO 'datadog'@'%';
109-
Query OK, 0 rows affected (0.00 sec)
110-
```
111-
112-
To collect index metrics, grant the `datadog` user an additional privilege:
113-
114-
```shell
115-
116-
mysql> GRANT SELECT ON mysql.innodb_index_stats TO 'datadog'@'%';
117-
Query OK, 0 rows affected (0.00 sec)
118-
```
119-
12090
### Configuration
12191

12292
Follow the instructions below to configure this check for an Agent running on a host. For containerized environments, see the [Docker](?tab=docker#docker), [Kubernetes](?tab=kubernetes#kubernetes), or [ECS](?tab=ecs#ecs) sections.
@@ -159,7 +129,7 @@ For a full list of available configuration options, see the [sample `mysql.d/con
159129
160130
To collect `extra_performance_metrics`, your MySQL server must have `performance_schema` enabled - otherwise set `extra_performance_metrics` to `false`. For more information on `performance_schema`, see [MySQL Performance Schema Quick Start][9].
161131

162-
##### TiDB Configuration
132+
##### TiDB configuration
163133

164134
For TiDB instances, some configuration options should be adjusted:
165135

@@ -600,21 +570,21 @@ The check does not collect all metrics by default. Set the following boolean con
600570

601571
#### TiDB limitations
602572

603-
When using this integration with TiDB, be aware of the following limitations:
573+
When using some extra integration with TiDB, be aware of the following limitations for TiDB:
604574

605575
- **InnoDB metrics**: TiDB doesn't use the InnoDB storage engine, so all InnoDB-related metrics are unavailable
606576
- **Performance Schema**: TiDB doesn't have MySQL's `performance_schema`, so performance metrics requiring it are unavailable
607577
- **Replication metrics**: TiDB uses a different replication mechanism (Raft consensus), so traditional MySQL replication metrics don't apply
608578
- **MyISAM metrics**: TiDB doesn't support MyISAM, so key cache metrics are unavailable
609-
- **Binary log metrics**: TiDB has a different binlog implementation, so traditional MySQL binlog metrics may not be accurate
579+
- **Binary log metrics**: TiDB has a different binlog implementation, so traditional MySQL binlog metrics may not be available
610580
- **Statement metrics**: TiDB uses `information_schema.cluster_statements_summary` instead of `performance_schema.events_statements_summary_by_digest`
611581
- **Activity monitoring**: TiDB uses `information_schema.cluster_processlist` instead of `performance_schema.events_statements_current`
612582

613583
For Database Monitoring features:
614584
- Query samples and explain plans are collected from `cluster_statements_summary` with some approximations
615-
- Wait events are not available as TiDB doesn't track them in the same way as MySQL
616-
- Some query metrics are approximated (e.g., rows examined is estimated from keys processed)
617-
- TiDB explain plans are retrieved from the `PLAN` column in `information_schema.cluster_statements_summary` table, which contains pre-collected execution plans in text format with embedded execution statistics
585+
- Wait events are not available as TiDB doesn't track them in the same way as MySQL. We set 'N/A' for all.
586+
- Some query metrics are approximated (for example, rows examined is estimated from keys processed)
587+
- TiDB explain plans are retrieved from the `PLAN` column in `information_schema.cluster_statements_summary` table, which contains pre-collected execution plans in text format with embedded execution statistics. Please be sure it's not realtime explain plan like other database like MySQL, MariaDB.
618588

619589
### Events
620590

@@ -638,7 +608,7 @@ See [service_checks.json][22] for a list of service checks provided by this inte
638608

639609
### TiDB-specific troubleshooting
640610

641-
**Missing metrics**: If you see warnings about missing InnoDB or performance_schema metrics when monitoring TiDB:
611+
**Missing metrics**: If you see warnings about missing InnoDB or `performance_schema` metrics when monitoring TiDB:
642612
- This is expected behavior. Set `disable_innodb_metrics: true` and `extra_performance_metrics: false` in your configuration.
643613

644614
**Connection issues**: TiDB typically runs on port 4000 instead of MySQL's default 3306. Make sure to specify the correct port in your configuration.

0 commit comments

Comments
 (0)