The first machine Master Second Machine Node1 third machine Node2 fourth machine node3 other way to extend reading
In Linux to carry out SSH communication between each system, you must know each other's account password in order to do the appropriate operation.
Idea: The key is generated by RSA encryption, including the private key and the public key, and we append the public key to the key that is used to authenticate the authorization.
Each machine configures a local, free login, and then appends the ~/.ssh/id_dsa.pub public key content generated by each of the remaining machines to the authorized_keys of one of the hosts, and then the machine includes the authorized_ of each machine's public key The keys file is sent to all servers in the cluster. In this way, each server in the cluster has the public key of all servers, so that any two machines in the cluster can achieve a no-secret login.
The above thought is excerpted from the train of thought of a classmate. The following is the procedure for this idea.
4 Host Configuration:
Host: Master
From machine: slave1
From machine: slave2
From machine: Slave3 1. First machine (master)
SSH-KEYGEN-T RSA
Cat Id_rsa.pub >> Authorized_keys
SCP ~/.ssh/authorized_keys slave1:~/.ssh/
If the above command is in the initial state of the SLAVE1 node (before any SSH operation, there is no. ssh directory)
As shown above, there are no. ssh directories under the root directory, and the following problems occur:
At this point, you need to manually perform an SSH operation on the slave1 node, such as SSH slave1
After the above operation, execute the command again: SCP ~/.ssh/authorized_keys slave1:~/.ssh/can
The authentication file for node 1 is now viewed in the SLAVE1 node:
Second Machine (Node1)
SSH-KEYGEN-T RSA
Cat id_rsa.pub >> authorized_keys
SCP ~/.ssh/authorized_keys slave2:~/.ssh/
(There will still be the same problem as the first machine) third machine (Node2)
ssh-keygen-t RSA
Cat id_rsa.pub >> authorized_keys
SCP ~/.ssh/authorized_keys slave3:~/.ssh/
(There will still be the same problem as the first machine) fourth machine (NODE3)
ssh-keygen-t RSA
Cat id_rsa.pub >> authorized_keys
SCP ~/.ssh/authorized_keys master:~/.ssh/
SCP ~/ . Ssh/authorized_keys slave1:~/.ssh/
SCP ~/.ssh/authorized_keys slave2:~/.ssh/
After all of the above operations are complete, all machines can be free of each other, but also need to check whether each machine ~/.ssh/known_hosts file contains four host information, as shown in the following figure:
If not, such as Master does not, you need to rerun the SSH Master command on the machine to generate the above information.
Testing the following connections in Node4 is normal:
Other ways
In addition to this approach, you can also use the Scp-copy-id command to copy the authentication files. See the 10th in the Hadoop installation and cluster configuration specifically. Extended Reading
For more information please read: HTTP://WWW.JIANSHU.COM/U/36A7D3A994AC
Author of the public: The story of ants and coffee
Public number two-dimensional code: