GreptimeTeam / gtctl

gtctl is a command-line tool for managing GreptimeDB cluster.
Apache License 2.0
35 stars 14 forks source link

use machine ip instead of localhost #211

Open leaf-potato opened 1 month ago

leaf-potato commented 1 month ago

After successfully starting the cluster using gtctl, it will print the access address of the dashboard:

image

The machine you are running on may not be your local machine, mabay a virtual machine or a remote development machine. You cannot directly click on the link in the terminal to access it. It may be more convenient to use the machine IP instead of localhost in the link.

zyy17 commented 1 month ago

@leaf-potato Sounds reasonable. Can you give it a PR to modify it?

I think we should handle the following cases:

leaf-potato commented 1 month ago
  • If the user specifies the IP, the prompt can reuse the IP and display it;

You reminded me! If the user specifies the IP address via httpAddr, access will fail using any other address.

  • How to choose the appropriate IP if the machine has multiple network devices?

Use hostname to resolve the IP address, similar to the hostname -i command in Linux and choose first. There is similar logic in Apache/bRPC.

leaf-potato commented 1 month ago

Can you give it a PR to modify it?

Sure, but I am not very familiar with the Go language, so it will take some time to modify it.

leaf-potato commented 1 month ago

@zyy17 The code submitted: https://github.com/GreptimeTeam/gtctl/pull/212/