I have updated my system's hostname in /etc/hostname file as master. I have also mapped my /etc/hosts file like

<ip> master

Still, when I type $ hostname, I get a different hostname.

I basically want to change my hostname from the default one to "master".

What file am I missing out?

  • What is <ip> the placeholder for? It should be – jnuk Jul 28 '14 at 21:01
  • Your host name is by default your machine name. If you have Apache installed, it can be typed into the url bar. So mine is Hairy14, and I see my locally hosted website. Why do you need to change it? – Tim Jul 28 '14 at 21:03
  • I am working on hadoop with ec2 instances. I would want to change my instance names to master and slaves for easy tracking while working on the terminal – Prasanna Jul 28 '14 at 21:05
  • Just use localhost – Tim Jul 28 '14 at 21:05

The problem is that you should have:   localhost   master

in your /etch/hosts file, not a real ip address.

Simply run the command sudo hostname your-new-name

If that doesn't work, can you not use localhost instead of master?

  • I changed my host file as you said and reconnected to the instance. Still when I type $hostname, I get "ip-<ip address>" which was my default hostname. – Prasanna Jul 28 '14 at 21:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.