Troubleshoot TiProxy
This document describes some common problems, causes, and solutions for TiProxy.
Cannot connect to TiProxy
You can troubleshoot the issue by following these steps:
- Check if the connector version is supported. If the connector is not in the list, check if the connector supports authentication plugins.
- If the client reports
No available TiDB instances, please make sure TiDB is available
, check if there is a TiDB server and if the SQL port and HTTP status port of the TiDB server can be connected normally. - If the client reports
Require TLS enabled on TiProxy when require-backend-tls=true
, check if TiProxy is correctly configured with TLS certificates. - If the client reports
Verify TiDB capability failed, please upgrade TiDB
, check if the TiDB server version is v6.5.0 or later. - If the client reports
TiProxy fails to connect to TiDB, please make sure TiDB is available
, check if the TiProxy node can connect to the TiDB server. - If the client reports
Require TLS enabled on TiDB when require-backend-tls=true
, check if TiDB is correctly configured with TLS certificates. - If the client reports
TiProxy fails to connect to TiDB, please make sure TiDB proxy-protocol is set correctly
, check ifproxy.proxy-protocol
is enabled on TiProxy andproxy-protocol
is not enabled on the TiDB server. - Check if TiProxy is configured with
max-connections
and if the number of connections on TiProxy exceeds the maximum connection limit. - Check the TiProxy log for error messages.
TiProxy does not migrate connections
You can troubleshoot the issue by following these steps:
- Whether the TiProxy limitations are not met. You can further confirm this by checking the TiProxy log.
- Whether
security.session-token-signing-cert
,security.session-token-signing-key
, andgraceful-wait-before-shutdown
are correctly configured on TiDB.
Unbalanced CPU usage on TiDB server
You can troubleshoot the issue by following these steps:
- Check if there is a significant difference in CPU usage among TiDB servers. TiProxy does not guarantee identical CPU usage across TiDB servers. It only performs load balancing when the CPU usage difference is large enough to affect query latency.
- If the connection count of a TiDB server gradually drops to zero, it might be affected by other load balancing policies. You can check the
Session Migration Reasons
metric in Grafana to see if there are migrations based on other policies. - Check if the TiProxy configuration item
policy
is set tolocation
. If location-based prioritization is enabled, TiProxy does not balance CPU usage across different locations. - Check the version of TiProxy. Only v1.1.0 and later versions support CPU-based load balancing. Earlier versions use a load balancing policy based on minimum connection count.
- If none of the preceding situations apply, the connection migration might have failed. To troubleshoot further, see TiProxy does not migrate connections.
Latency is significantly increased
You can troubleshoot the issue by following these steps:
- Check the latency on TiProxy through Grafana. If the latency on TiProxy is not high, it means that the client load is high or the network latency between the client and TiProxy is high.
- Check the latency on the TiDB server through Grafana. If the latency on the TiDB server is high, follow the steps in Latency increases significantly to troubleshoot.
- Check the network duration between TiProxy and TiDB server through Grafana.
- Check the CPU usage on TiProxy. If the CPU usage is over 90%, you need to scale out TiProxy.