HAProxy Unable to Retrieve Real IP

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: haproxy无法获取真实ip

| username: kuweilong666

【TiDB Usage Environment】Production Environment
【TiDB Version】4.0.0
【Reproduction Path】Operations performed that led to the issue
【Encountered Issue: Phenomenon and Impact】
【Resource Configuration】Navigate to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
【Attachments: Screenshots/Logs/Monitoring】
haproxy: 192.168.1.62:4000
tidb: 192.168.1.62:4001, 192.168.1.135:4001
Machine where user dts is located: 192.168.1.130
conf/tidb.toml


haproxy configuration

Test results

Port 4001 can be used normally, but 4000 cannot be used.

| username: 裤衩儿飞上天 | Original post link

Your HAProxy machine and the TiDB server on port 4000 are on the same machine. Try placing them on different machines and configure the IP of HAProxy in proxy-protocol-networks.

| username: db_user | Original post link

This IP can only be the IP of HAProxy, not the IP of TiDB, otherwise it won’t work.

| username: Min_Chen | Original post link

Hello,

It should be written like this:

[proxy-protocol]
networks = "192.168.1.62"
fallbackable = true
| username: kuweilong666 | Original post link

I can connect to port 4001, but it gets interrupted.

| username: Min_Chen | Original post link

Hello,

Can you reconnect successfully after completely disconnecting?

| username: kuweilong666 | Original post link

The issue has been resolved. The reason was that the timeout setting for HAProxy was too short. However, some database connections are still reporting errors: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (invalid sequence 88 != 1).

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.