3. Network Configuration
Deploying on AWS
Change the Hostname
Set a hostname for your Ambari server and nodes of the Hadoop cluster. Change the hostname to the Private DNS. Run this command, for example, as root to set a new hostname:
hostnamectl set-hostname ip-172-31-3-54.ca-central-1.compute.internal
Repeat this on all hosts!
Deploying OVA on ESXi
Configure Network
The Hadoop VM is set to use DHCP by default. If a static IP is desired, you may choose either of these options:
Option 1 Use this utility:
/root/setup/network_setup.sh
Option 2 Manually update file
/etc/sysconfig/network-scripts/ifcfg-eth0
. Below, is an example of a static IP setting:BOOTPROTO=static IPADDR=10.3.16.227 NETMASK=255.255.0.0 GATEWAY=10.3.30.254 DNS1=10.3.110.224 DNS2=10.3.110.104 NM_CONTROLLED=no
Then restart the network service or reboot the server for the changes to take effect. Command to restart the network:
systemctl restart network
Set the Hostname
To set a hostname for your Ambari server, run the command:
hostnamectl set-hostname <hostname>
In the above command, substitute the <hostname>
variable for the actual hostname of your Ambari server. For example: Set a hostname for your Ambari server and nodes of the Hadoop cluster. Change the hostname to the Private DNS. Run this command, for example, as root to set a new hostname:
hostnamectl set-hostname node1.hadoop-server.company.com
This hostname must be configured for both forward and reverse DNS. The Ambari and Hadoop applications must be able to translate the hostname to its IP address and back in order to work properly.
Update /etc/hosts file
Note
This step is optional if the hostname resolution is done by your DNS.
Update the /etc/hosts
file by adding, for each node, one entry of IP address and hostname. You will need to repeat this procedure in every cluster node.
Warning
The /etc/hosts
file on ALL nodes must have the hostname and IP of ALL nodes in the Hadoop cluster.
Example of how your /etc/hosts
file should look like:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.1.1.1 node1.hadoop-server.company.com
10.1.1.2 node2.hadoop-server.company.com
10.1.1.3 node3.hadoop-server.company.com
10.1.1.4 node4.hadoop-server.company.com
10.1.1.5 node5.hadoop-server.company.com
Where 10.1.1.1
is the IP address of the node1 with hostname node1.hadoop-server.company.com
. The following line applies to a node2 in the same fashion, and so forth. The /etc/hosts
file in this example is identical in node1, node2, node3, node4 and node5.
Tip
If you are using DHCP, the IP address can be obtained using the ifconfig
command.
Caution
Do NOT set 127.0.0.1
to the hostname of the node VM. Hadoop host registration will fail.
Deploying on Azure
Change the Hostname
Set a hostname for your Ambari server and the nodes of the Hadoop cluster. Change the hostname so that it uses the name of the VM name with the Azure's default DNS suffix (internal.cloudapp.net).
Run this command, for example, as root to set a new hostname:
hostnamectl set-hostname tdp316-56-master.internal.cloudapp.net
Repeat this on all hosts!