Unable to Connect to TiDB Dashboard Using Public IP

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

Original topic: 无法用公网IP连接TIDB Dashboard

| username: TiDBer_q94Ko9tU

[Test Environment for TiDB] Testing
[TiDB Version]
[Reproduction Path] Error when trying to access TiDB Dashboard via public address
First, install TiDB according to the quick start guide

Then, access via public address fails

| username: zhanggame1 | Original post link

Is the IP you are accessing the PD? Is this IP a public address? Can you ping it?

| username: 啦啦啦啦啦 | Original post link

Have you opened the security group? Try using telnet to check if the local connection to the public address of PD on port 2379 is accessible.

| username: Kongdom | Original post link

It seems to be the firewall. For cloud servers, you need to open the ports in the cloud management console.

| username: TiDBer_q94Ko9tU | Original post link

The public IP is reachable, and it can be pinged.

| username: TiDBer_q94Ko9tU | Original post link

The firewall is not enabled, and ports 4000 and 2379 are open.

| username: 像风一样的男子 | Original post link

The 2379 port might not be open. You can test it with telnet.

| username: TiDBer_q94Ko9tU | Original post link

The security group has been opened.

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

Try using telnet with the public IP and port 2379 to see the response.

| username: Kongdom | Original post link

The firewall of the cloud server is not the firewall of CentOS. The firewall of the cloud service should not be turned off.

Additionally, I think the configuration file should not contain 127.0.0.1, but the actual IP instead.

| username: TiDBer_q94Ko9tU | Original post link

Telnet is refusing connections from external networks, but it works with 127.0.0.1. The firewall and security group ports are all open.

Checking the port number, I found that only 127.0.0.1 can access it, not all IPs.

For MySQL, you can perform this operation. How can it be done for TiDB?

| username: MrSylar | Original post link

When deploying the cluster, should we use the specified --host? By default, it is 127.0.0.1, which is intended for deployment on a local computer. Our scenario involves connecting to Alibaba Cloud servers via the public network.

| username: TiDBer_oHSwKxOH | Original post link

The public network is inaccessible; you need to use Nginx for reverse proxy.

| username: jansu-dev | Original post link

I used FRP to perform intranet penetration on my Tencent Cloud.

  1. Proof: If your request to access the public network can correctly reach the HTTP port of the TiDB Dashboard on PD, then TiDB supports access.
  2. I feel that the reverse proxy mentioned above is a possibility.
  3. However, I couldn’t test further because my cloud server’s configuration is not enough to even start the playground. :joy:
  4. But I feel that there might be an issue with the settings on the cloud side (security, firewall, etc…).

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

You are using TiUP Playground to generate the test environment. TiUP Playground listens on 127.0.0.1 by default, making the service accessible only locally. If you need the service to be accessible externally, you can use the --host parameter to specify the network interface binding to an externally accessible IP.

| username: TiDBer_q94Ko9tU | Original post link

–host should also be the internal network, I am using the public network and cannot access it at all.

| username: Kongdom | Original post link

Using the environment generated by Playground, that makes sense. I previously set one up on Alibaba Cloud following the standard procedure, and it was just a matter of opening the port in the cloud management console. With this method, you probably really need to specify --host as the external IP.

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

–host directly specifying 0.0.0.0 will listen to all network interfaces, and then using public network access will naturally map over.

| username: Kongdom | Original post link

:+1::+1::+1: I’ll give it a try when I get the chance. My previous cloud server has expired.

| username: Fly-bird | Original post link

Using telnet with the public IP and port will let you know if the connection is successful.