Question by Traf, 6 months 3 weeks ago
In VMs I created earlier, the host name was the local IP address, with dashes instead of dots, something like 10-0-0-6.openstacklocal.
Since today (1/14/2014), when I create a new CentOS 6.3 VM, it has the name I specify as the instance name, but I'm having trouble with this new name, for example when I try to start Hadoop.
On the old VM, I get the following:
hostname -f
10-0-0-6.openstacklocal
On the new VM, created today, I get this:
[demouser@demovm13 ~]$ hostname
demovm13
[demouser@demovm13 ~]$ hostname -f
hostname: Unknown host
[demouser@demovm13 ~]$
The real error I get from Hadoop is the following, but I assume it's related to the issue above:
java.net.UnknownHostException: demovm13: demovm13
at java.net.InetAddress.getLocalHost(InetAddress.java:1473)
at org.apache.hadoop.security.SecurityUtil.getLocalHostName(SecurityUtil.java:223)
at org.apache.hadoop.security.SecurityUtil.login(SecurityUtil.java:243)
at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1692)
at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1717)
at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:1870)
at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1891)
Caused by: java.net.UnknownHostException: demovm13
at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
at java.net.InetAddress.getLocalHost(InetAddress.java:1469)
... 6 more
Thanks,
Hans
'Legacy Skills > OpenStack' 카테고리의 다른 글
SCALE HORIZONTALLY (0) | 2014.08.08 |
---|---|
Conoha VPS CentOS6.5(標準6.4からupdate)で起動時にエラーが出るときの対処 (0) | 2014.08.08 |
Metadata request timed out issue on Icehouse (0) | 2014.08.07 |
Logging to the Serial Console (0) | 2014.08.07 |
Linux: Configure / Enable Serial Console By Editing GRUB Boot Loader (0) | 2014.08.07 |
Comment by Traf 5 months 1 week ago
Here is an update. We were able to solve this problem by doing two things:
1. add the following line to /etc/sysconfig/network:
HOSTNAME=<hostname>
2. Add the following line to /etc/hosts:
<internal IP address> <hostname>.openstacklocal <hostname>
To avoid having to do this every time we launched a new VM image, we added the following to /etc/rc.d/rc.local
grep `hostname` /etc/hosts >/dev/null
if [ $? -eq 1 ]; then
ipaddr=$(ip addr show to 0.0.0.0/0 scope global | awk '/[[:space:]]inet / { print gensub("/.*","","g",$2) }')
hostnm=`hostname`
echo "Adding an entry for IP address $ipaddr and host $hostnm to /etc/hosts"
echo "$ipaddr ${hostnm}.openstacklocal $hostnm" >>/etc/hosts
fi
grep "HOSTNAME=$(hostname)" /etc/sysconfig/network >/dev/null
if [ $? -eq 1 ]; then
echo "HOSTNAME=$(hostname)" >>/etc/sysconfig/network
fi