Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: sql路由节点查询
【TiDB Usage Environment】Test environment
【TiDB Version】v6.0.0
【Encountered Problem】We have deployed 9 TiDB instances and 1 Haproxy for load balancing. I want to know to which TiDB instance the database connection is forwarded by Haproxy. Does TiDB internally store this metadata? Can it be queried directly through SQL?
【Reproduction Path】
【Problem Phenomenon and Impact】
【Attachments】
Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.
You can check HAProxy’s monitoring to see which TiDB server it is forwarding to. You can also view the global process list on the TiDB server using select * from information_schema.cluster_processlist;
.
Do you want to see the real client request address on TiDB?
If the SQL itself is not traceable when proxied to other TiDB through HAProxy, you should only be able to see which TiDB it is forwarded to through HAProxy’s logs and monitoring.
HAProxy logs: https://blog.51cto.com/u_11886307/2406609
Yes, the above answer better meets my needs: select * from information_schema.cluster_processlist;
This topic was automatically closed 1 minute after the last reply. No new replies are allowed.