Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tiproxy 疑问
[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed that caused the issue
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]
If multiple tiproxy instances are started (for example, 2 tiproxy instances), how can I know which one the current connection is using (tiproxy 1 or 2)?
8/28
Marking this
Looking at their old design documents, they were intended for multi-tenant use and resource isolation. They haven’t updated the documents, so it’s unclear what their future plans are.
Boss, how do I check the source IP address of client connections?
You can check the tiproxy logs for entries like [new connection] [connID=0] [client_addr=127.0.0.1:63187], and use the client_addr to find the client address.
If the proxy-protocol is not enabled, you can also use the show processlist command to see the host. The host here is the tiproxy address, because for TiDB, tiproxy is the client.
Currently, there are no other methods. Do you have any suggestions?
After enabling proxy-protocol, use select host from information_schema.processlist where id=connection_id();
This log is basically sufficient, but why doesn’t connID start from 1? It would be even better if the backend connID could be printed.
Awesome, it looks like the author himself is answering. 
This PR starts it from 1: proxy: use a real proxy conn id by xhebox · Pull Request #348 · pingcap/tiproxy · GitHub
The backend conn id can only be actively queried from the backend using select connection_id(), because the conn id sent to the client by TiDB during the handshake is truncated. There is an issue: Attach backend connection ID in the log · Issue #310 · pingcap/tiproxy · GitHub
O(∩_∩)O haha, right~
The expert has personally come to the community~
Forgive me, it seems that both of these questions have been answered at `Connection id` always `100` · Issue #345 · pingcap/tiproxy · GitHub 
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.