How To Setup Hadoop SSH Configuration In Linux CentOs

Hadoop requires SSH access to manage its nodes, i.e. remote machines plus your local machine if you want to use Hadoop on it (which is what we want to do in this short tutorial). For our single-node setup of Hadoop, we therefore need to
configure SSH access to localhost for the hduser user we created in the previous section.

I assume that you have SSH up and running on your machine and configured it to allow

SSH public key authentication.
 Install ssh server on your computer
[hduser@localhost ~]$sudo yum install openssh-server
NOTE: For the above step, INTERNET connection should be enabled
[hduser@localhost ~]$ssh-keygen

Generating public/private rsa key pair.
Enter file in which to save the key
(/home/hduser/.ssh/id_rsa):
Created directory ‘/home/hduser/.ssh’.
Your identification has been saved in /home/hduser/.ssh/id_rsa.
Your public key has been saved in /home/hduser/.ssh/id_rsa.pub.
The key fingerprint is:
9b:82:ea:58:b4:e0:35:d7:ff:19:66:a6:ef:ae:0e:d2hduser@localhost
The key’s randomart image is:
+–[ RSA 2048]—-+
| |
| |
| . |
| * |
| = S oo |
| . ooOoo. |
| .*E . |
| ..o= |
| ++. |
+—————–+

[hduser@localhost ~]$

The final step is to test the SSH setup by connecting to your local machine with the hduser user. The step is also needed to save your local machine’s host key fingerprint to the hduser user’s known_hosts file. If you have any special SSH configuration for your local machine like a non-standard SSH port, you can define host-specific SSH options in $HOME/.ssh/config (see man ssh_config for more information).

#now copy the public key to the authorized_keys file, so that ssh should not require passwords every time

[hduser@localhost ~]$cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

#Change permissions of the authorized_keys fie to have all permissions for hduser
[hduser@localhost ~]$chmod 700 ~/.ssh/authorized_keys

If ssh is not running, then run it by giving the below command
[hduser@localhost ~]$ sudo service sshd start
If ssh is not running, then run it by giving the below command

Run the below command to have the sshd running even after system reboot.
hduser@localhost:~$sudo chkconfig sshd on

Stop the firewalls if enabled by following commands
[hduser@localhost ~]$sudo service iptables stop

Stop the firewalls if enabled by following commands
[hduser@localhost ~]$sudo service iptables stop

Test the ssh connectivity by doing the following
[hduser@localhost ~]$ssh localhost

We should be able to ssh localhost without password prompt. If it asks for password while connecting to localhost, there is something went wrong and you need to fix it before proceeding further.

openssh-centos-1024x512

Without having the password less SSH working properly, the hadoop cluster will not work, so there is no point in going further if password less SSH is not working. If you face any issues with SSH, consult Google University, where copious help available.

The authenticity of host ‘localhost (::1)’ can’t be established.
RSA key fingerprint is d7:87:25:47:ae:02:00:eb:1d:75:4f:bb:44:f9:36:26.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘localhost’ (RSA) to the list of known hosts.
Linux ubuntu 2.6.32-22-generic #33-Ubuntu SMP Wed Apr 28 13:27:30 UTC 2010
i686 GNU/Linux
Ubuntu 10.04 LTS

Speak Your Mind

*