Configure master No password login all salve
1. Create Hadoop users for all nodes and set the password
Log in as root account:
Useradd Hadoop
passwd Hadoop
2, set the master node to use the Hadoop account password-free login to the machine
Log in as a Hadoop account and execute the following command:
Ssh-keygen – t RSA – P '
When asked to save the path after running, the direct carriage return takes the default path. The generated key pair: Id_rsa (private key) and id_rsa.pub (public key), which are stored by default in the "/home/hadoop/.ssh" directory.
[[email protected] ~]$ ls-~]$ CD. ssh/
3. Append the Id_rsa.pub (public key) to the authorized key
Cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
or enter the. SH directory, direct CP id_rsa.pub Authorized_keys
4. Use the root user login to modify the following contents of the SSH configuration file "/etc/ssh/sshd_config"
Check the next few lines before " # " comment is canceled:
Rsaauthentication Yes # Enable RSA authentication
Pubkeyauthentication Yes # Enable public key private key pairing authentication method
Authorizedkeysfile. Ssh/authorized_keys # Public key file path
After modifying, restart the SSH service to take effect:
Service sshd Restart
5. Test whether Hadoop users can log in directly without a password
Root first switch to Hadoop account, Su-hadooop
Then the Hadoop user executes ssh localhost
.. Yes
If you do not enter a password, the setting succeeds.
6. Use the Ssh-copy-id command to transfer the public key to the remote host
[email protected]. ssh]$ ssh [email protected]
Last login:wed Mar-23:00:05 from localhost
[Email protected] ~]$ Ssh-copy-id [email protected]
The authenticity of host ' datanode1 (192.168.1.164) ' can ' t be established.
RSA key fingerprint is 4c:d0:2c:41:ca:91:e6:d4:e6:cc:da:df:4b:24:4e:6e.
Is you sure want to continue connecting (yes/no)? Yes
warning:permanently added ' datanode1,192.168.1.164 ' (RSA) to the list of known hosts.
[email protected] ' s password:
Now try logging to the machine, with "ssh" [email protected] ' ", and check in:
. Ssh/authorized_keys
To make sure we haven ' t added extra keys so you weren ' t expecting.
[Email protected] ~]$ Ssh-copy-id [email protected]
[Email protected] ~]$ Ssh-copy-id [email protected]
7. Verification
On the master host, execute the following command to connect directly to the other server without entering the password
[Email protected]]ssh [email protected]
[Email protected]]ssh [email protected]
[Email protected]]ssh [email protected]
8. Modify the sudoers configuration file
[[Email protected]~]# vi/etc/sudoers--root Account modification, add the following two items
Hadoop all= (All) all
Hadoop all= (All) Nopasswd:all
Reference:Http://stackoverflow.com/questions/28171755/cloudera-installation-failed-to-detect-root-privileges-on-centos
Hadoop config master no password login all salve