Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 求助:tidb v4.0.9 怎么精确定位query的来源?
[TiDB Usage Environment] Production Environment
[TiDB Version] v4.0.9
[Encountered Problem: Phenomenon and Impact]
When using tidb show processlist
, it does not display the source HOST:port information like MySQL does. Currently, there is a very slow SQL query, and I want to accurately locate its source. How can I do that? A group member mentioned that the new version will display this information, but I can’t upgrade the cluster at the moment. Can anyone suggest a way to locate the specific IP+port information? Thanks~~
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]
Did you use HAProxy?
You can enable IP transparency HAProxy Best Practices in TiDB | PingCAP Docs
Does it mean that it’s not a version issue, but using HAProxy that causes the port information not to be displayed?
I looked at the documentation, are the following configuration steps needed:
- HAProxy configuration
server tidb-1 10.9.18.229:4000 send-proxy check inter 2000 rise 2 fall 3
server tidb-2 10.9.39.208:4000 send-proxy check inter 2000 rise 2 fall 3
server tidb-3 10.9.64.166:4000 send-proxy check inter 2000 rise 2 fall 3
- TiDB configuration modification:
proxy-protocol.networks: 192.168.241.54,192.168.241.55 #This configuration is for my HAProxy addresses
Is there any problem with my above configuration?
Yes, that’s the configuration. However, it’s best to have your HAProxy on a separate machine. Mixing it with other components might lead to accessibility issues.
It is a standalone node, but I have 2 nodes for Haproxy, which are master and slave to each other using keepalived.
I followed the method mentioned above and can now display the actual IP, but the port information is still not showing. How can I get the port to display? Is this a version issue? Any solutions?
In version 4.0, there is no port information; it only starts to appear in version 5.0.
However, having the IP is already enough to determine the source.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.