You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mysql/README.md
+75-1Lines changed: 75 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ The MySQL integration tracks the performance of your MySQL instances. It collect
8
8
9
9
Enable [Database Monitoring][32] (DBM) for enhanced insights into query performance and database health. In addition to the standard integration, Datadog DBM provides query-level metrics, live and historical query snapshots, wait event analysis, database load, and query explain plans.
10
10
11
-
MySQL version 5.6, 5.7, 8.0, and MariaDB versions 10.5, 10.6, 10.11 and 11.1 are supported.
11
+
MySQL version 5.6, 5.7, 8.0, MariaDB versions 10.5, 10.6, 10.11 and 11.1, and TiDB version 5.0+ are supported.
12
12
13
13
## Setup
14
14
@@ -68,6 +68,24 @@ mysql> GRANT PROCESS ON *.* TO 'datadog'@'%';
68
68
Query OK, 0 rows affected (0.00 sec)
69
69
```
70
70
71
+
##### TiDB-specific setup
72
+
73
+
For TiDB databases, the user setup is similar but with some differences:
74
+
75
+
- TiDB does not have `performance_schema`, so skip the performance_schema grant
76
+
- TiDB does not support the `REPLICATION CLIENT` privilege, but this is not needed as TiDB uses different replication mechanisms
77
+
- The `innodb_index_stats` table is not available in TiDB
78
+
79
+
For TiDB, create the user with these commands:
80
+
81
+
```shell
82
+
mysql> CREATE USER 'datadog'@'%' IDENTIFIED BY '<UNIQUEPASSWORD>';
83
+
Query OK, 0 rows affected (0.00 sec)
84
+
85
+
mysql> GRANT PROCESS ON *.* TO 'datadog'@'%';
86
+
Query OK, 0 rows affected (0.00 sec)
87
+
```
88
+
71
89
Verify the replication client. Replace `<UNIQUEPASSWORD>` with the password you created above:
72
90
73
91
```shell
@@ -141,6 +159,27 @@ For a full list of available configuration options, see the [sample `mysql.d/con
141
159
142
160
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].
143
161
162
+
##### TiDB Configuration
163
+
164
+
For TiDB instances, some configuration options should be adjusted:
165
+
166
+
```yaml
167
+
init_config:
168
+
169
+
instances:
170
+
- host: 127.0.0.1
171
+
username: datadog
172
+
password: "<YOUR_CHOSEN_PASSWORD>"
173
+
port: 4000 # Default TiDB port
174
+
options:
175
+
replication: false # TiDB uses different replication mechanisms
176
+
galera_cluster: false
177
+
extra_status_metrics: true
178
+
extra_innodb_metrics: false # TiDB doesn't have InnoDB
179
+
disable_innodb_metrics: true # Disable InnoDB metrics for TiDB
180
+
extra_performance_metrics: false # TiDB doesn't have performance_schema
181
+
```
182
+
144
183
**Note**: The `datadog` user should be set up in the MySQL integration configuration as `host: 127.0.0.1` instead of `localhost`. Alternatively, you may also use `sock`.
145
184
146
185
[Restart the Agent][10] to start sending MySQL metrics to Datadog.
See [Autodiscovery template variables][12] for details on using `<UNIQUEPASSWORD>` as an environment variable instead of a label.
255
302
256
303
#### Log collection
@@ -551,6 +598,24 @@ The check does not collect all metrics by default. Set the following boolean con
551
598
| ---------------------- | ----------- |
552
599
| mysql.info.schema.size | GAUGE |
553
600
601
+
#### TiDB limitations
602
+
603
+
When using this integration with TiDB, be aware of the following limitations:
604
+
605
+
- **InnoDB metrics**: TiDB doesn't use the InnoDB storage engine, so all InnoDB-related metrics are unavailable
606
+
- **Performance Schema**: TiDB doesn't have MySQL's `performance_schema`, so performance metrics requiring it are unavailable
607
+
- **Replication metrics**: TiDB uses a different replication mechanism (Raft consensus), so traditional MySQL replication metrics don't apply
608
+
- **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
610
+
- **Statement metrics**: TiDB uses `information_schema.cluster_statements_summary` instead of `performance_schema.events_statements_summary_by_digest`
611
+
- **Activity monitoring**: TiDB uses `information_schema.cluster_processlist` instead of `performance_schema.events_statements_current`
612
+
613
+
For Database Monitoring features:
614
+
- 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
618
+
554
619
### Events
555
620
556
621
The MySQL check does not include any events.
@@ -571,6 +636,15 @@ See [service_checks.json][22] for a list of service checks provided by this inte
571
636
- [Database user lacks privileges][29]
572
637
- [How to collect metrics with a SQL Stored Procedure?][30]
573
638
639
+
### TiDB-specific troubleshooting
640
+
641
+
**Missing metrics**: If you see warnings about missing InnoDB or performance_schema metrics when monitoring TiDB:
642
+
- This is expected behavior. Set `disable_innodb_metrics: true` and `extra_performance_metrics: false` in your configuration.
643
+
644
+
**Connection issues**: TiDB typically runs on port 4000 instead of MySQL's default 3306. Make sure to specify the correct port in your configuration.
645
+
646
+
**High metric collection time**: The `CLUSTER_*` tables in TiDB aggregate data from all TiDB nodes, which can be slow in large clusters. Consider increasing the collection interval if needed.
647
+
574
648
## Further Reading
575
649
576
650
Additional helpful documentation, links, and articles:
0 commit comments