In a production deployment, the instances which you use run on separate machines, therefore each machine must have a unique host name and be able to resolve the host names of the other machines which run server instances. If this is not the case, you can:
Configure each machine to map the IP of each other machine to a host name. See your operating system documentation for details. This is the recommended solution.
Set up a DNS service.
report_hostvariable in the MySQL configuration of each instance to a suitable externally reachable address.
AdminAPI supports using IP addresses instead of host names.
From MySQL Shell 8.0.18, AdminAPI supports IPv6 addresses if
the target MySQL Server version is higher than 8.0.13. When
using MySQL Shell 8.0.18 or higher, if all cluster instances are
running 8.0.14 or higher, then you can use an IPv6 address or a
hostname that resolves to an IPv6 address in connection strings
and with options such as
ipAllowlist. For more information on using
IPv6 see Support For IPv6 And For Mixed IPv6 And IPv4 Groups.
Previous versions support IPv4 addresses only.
To verify whether the hostname of a MySQL server is correctly configured, execute the following query to see how the instance reports its own address to other servers and try to connect to that MySQL server from other hosts using the returned address:
SELECT coalesce(@@report_host, @@hostname);