Thursday, 17 May 2018

ubuntu - Setting Hostname as IP on Linux for Hadoop VM


How can I have an Ubuntu server VM set /etc/hostname/ to the value fo the VM's assigned IP address automatically on startup?


I'm creating an Ubuntu server VM image to run Hadoop. When a client interacts with Hadoop it returns addresses of nodes in the cluster (even if in this instance they're all processes on the same machine) for the client to interact with. These addresses are determined by Java's hostname resolution, which I gather is not at all reliable. I've been advised the best way around this is to set /etc/hostname/ to the assigned IP address of the only network interface. Alternatively there may be an approach of setting an environment variable and then passing this to the JVM running each Hadoop process.



Answer



I added


hostname `hostname -I`

to '/etc/rc.local` and that set the hostname correctly to the currently-assigned IP address.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...