0

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?

Tim
  • 32,861
  • 27
  • 118
  • 178
Prasanna
  • 157
  • What is <ip> the placeholder for? It should be 127.0.1.1 – 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

1 Answers1

1

The problem is that you should have:

127.0.0.1   localhost
127.0.1.1   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?

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