Once the instances are created, set a hostname for each node and then add an entry to /etc/hosts file so that the nodes can locate each other. You can also use DNS if it’s available in your environment.
- use hostnamectl command to set a hostname:
- If a DNS server is available, register your hostname(s) using the server. If there is not a DNS server available, using /etc/hosts is recommended to resolve the hostnames.
- Add the following lines to the /etc/hosts file so that node-a and node-b can be resolved to an IP address(es).
- Create a backup of /etc/hosts, edit the file and confirm the changes.
- Make sure you can ping these nodes by name.