Setting up name resolution and having the nodes resolve to IP addresses is required in xCAT. xCAT provides several tools to help with this. The first step is to choose the domain for the hostnames of your nodes:
chdef -t site domain=cluster.com
All of the nodes should be in the /etc/hosts file. You can either edit the /etc/hosts file by hand, or use makehosts. If you edit the file by hand, it should look similar to:
127.0.0.1 localhost localhost.localdomain
50.1.2.3 mgmtnode-public mgmtnode-public.cluster.com
10.0.0.100 mgmtnode mgmtnode.cluster.com
10.0.0.1 node1 node1.cluster.com
10.0.0.2 node2 node2.cluster.com
If your node names and IP addresses follow a regular pattern, you can easily populate /etc/hosts by putting a regular expression in the xCAT hosts table and then running makehosts. To do this, you need to first create an initial definition of the nodes in the database, if you haven't done that already:
mkdef node[01-80] groups=compute,all
Next, put a regular expression in the hosts table. The following example will associate IP address 10.0.0.1 with node1, 10.0.0.2 with node2, etc:
chdef -t group -o compute ip='|node(\d+)|10.0.0.($1+0)|'
Then run
makehosts compute
and the following entries will be added to /etc/hosts:
10.0.0.1 node01 node01.cluster.com
10.0.0.2 node02 node02.cluster.com
10.0.0.3 node03 node03.cluster.com
...
For an explanation of the regular expressions, see the xCAT database man page.
Note that it is the normal convention of xCAT that the short hostname is the primary hostname for the node, and the long hostname is an alias. If you really prefer to have the long hostname be the primary hostname, you can use the -l option on the makehosts command.
There are many different ways to configure name resolution in your cluster. Some of the common choices are:
Each of these common choices will be discussed in turn. Hopefully, these examples will also show you how the pieces fit together, in case you want to configure name resolution slightly differently in your cluster.
This is the most common set up. In this configuration, a DNS running on the management node handles all name resolution requests for cluster node names. A separate DNS in your site handles requests for non-cluster hostnames.
Once /etc/hosts is populated with all of the nodes' hostnames and IP addresses, configure DNS on the management node and start it:
makedns
service named start # linux
startsrc -s named # AIX
Set site.nameservers to the cluster facing IP address of the management node so all nodes will use that as their name server:
chdef -t site nameservers=10.0.0.100
Set site.forwarders to DNS servers outside of the cluster that can resolve non-cluster hostnames. The management node DNS will automatically forward requests that it can't handle to these name servers:
chdef -t site forwarders=50.1.2.254,50.1.3.254
If you already have a DNS on your site network and you want to use that for your cluster node names too, you can point all of the nodes to it. You must ensure that your nodes have IP connectivity to the DNS, and you must manually configure your DNS with the node hostnames and IP addresses.
chdef -t site nameservers=50.1.2.254
When you have service nodes, the recommended configuration is to run DNS on the management node and all of the service nodes. The DNS on the management node is the only one configured with all of the node hostname/IP address pairs. The DNS servers on the service nodes are simply forwarding/caching servers.
Once /etc/hosts is populated with all of the nodes' hostnames and IP addresses, configure DNS on the management node and start it:
makedns
service named start # linux
startsrc -s named # AIX
Set site.nameservers to "<xcatmaster>" to indicate that each node should use the node that it is managed by (either management node or service node) as its DNS server:
chdef -t site nameservers='<xcatmaster>'
Set site.forwarders to DNS servers outside of the cluster that can resolve non-cluster hostnames. The management node DNS will automatically forward requests that it can't handle to these name servers:
chdef -t site forwarders=50.1.2.254,50.1.3.254
Note: only the DNS on the management node will use the forwarders setting. The DNS servers on the service nodes will always forward requests to the management node.
Make sure that the DNS service on the service nodes will be set up by xCAT. Assuming you have all of your service nodes in a group called "service":
chdef -t group service setupnameserver=1
If you have not yet installed or diskless booted your service nodes, xCAT will take care of configuring and starting DNS on the service nodes at that time. If the service nodes are already running, restarting xcatd on them will cause xCAT to recognize the above setting and configure/start DNS:
xdsh service 'service xcatd restart' # linux
xdsh service 'restartxcatd' # AIX
If you choose to use a fully populated /etc/hosts file on every node, you must ensure that the file gets updated throughout the cluster everytime a node is added or and hostname or IP address changes. The easiest way to do this is with xCAT sync files.
Assuming you want to sync the management node's /etc/hosts file to the compute nodes, create a sync file like:
/etc/hosts -> /etc/hosts
The file can be put anywhere, but let's assume you name it /install/custom/compute-image/synclist .
Make sure you have an OS image object in the xCAT database associated with your nodes:
mkdef -t osimage compute-image synclists=/install/custom/compute-image/synclist
chdef -t group compute profile=compute-image
Each time you install or diskless boot a compute node, xCAT will automatically sync the /etc/hosts file to the node. If you make changes to /etc/hosts while the nodes are running, you must push those changes to the nodes:
updatenode compute -F
Note: If all of your nodes are statelite nodes, you can accomplish this more easily by adding /etc/hosts to the litefile table with the "ro" option and adding the place it can be mounted from to the litetree table. With this approach, changes to the common hosts file on the management node will automatically be available to the nodes via NFS. See the statelite doc for details.