HAProxy Configuration for High Availability: User Lacks Permission to Access TiDB

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

Original topic: haproxy配置高可用,用户没有权限访问tidb

| username: kuweilong666

[TiDB Usage Environment] Production Environment
[TiDB Version] 4.0
[Reproduction Path] Operations performed that led to the issue
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachment: Screenshot/Logs/Monitoring]

Configured high availability according to

User test’s machine:
test connects to without permission, TiDB shows test@ without permission

| username: 胡杨树旁 | Original post link

The official documentation says that the configured HA port is 8000. How about trying port 8000?

| username: wakaka | Original post link

Please provide the configuration of HAProxy and a screenshot of connecting to port 4001 separately.

| username: tidb菜鸟一只 | Original post link

Create the user separately and see.

| username: kuweilong666 | Original post link

HAProxy cannot obtain the real IP.

| username: db_user | Original post link

The reason the real IP is not displayed is that you have not configured IP passthrough.

Configure the HAProxy IP according to this setup.

Follow the detailed steps in the article:

| username: kuweilong666 | Original post link

Configured it, but encountered another issue. I wrote a post about it here:
haproxy无法获取真实ip - TiDB 的问答社区