HAProxy Unable to Retrieve Real IP

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】
Machine where user dts is located:

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


It should be written like this:

networks = ""
fallbackable = true
| username: kuweilong666 | Original post link

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

| username: Min_Chen | Original post link


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.