Recent ready to build hadoop cluster, to think through the whole record it. First, install the four virtual machines as servers. The operating system is CentOS 6.5. Today resolved before, ssh-free access secret. Because hadoop To set up a master namenode a secondary namenode, there are two datanode. If you need to access between them, in particular, we need to access namenode datanode required by ssh, if every time a password is a little troublesome so we first solve the problem of access to free confidential talk.
Ready condition
Four ssh without password to access the server implementation by each other.
node01: 192168146101
node01: 192168146102
node01: 192168146103
node01: 192168146104
Modify / etc / hosts file
vi /etc/hosts
Into which the following
192168146101 node01
192.168.146.102 node02
192.168.146.103 node03
192168146104 node04
Set SSH without password
Ensure the installation of the ssh command
The default in ~ / .ssh directory generates two files:
id_rsa: private
id_rsa.pub: Public Key
Here .ssh directory will automatically generate no need to manually create
node01 operation
ssh-keygen -t rsa
The above operation sequentially on node01, node02, node03, node04 then machine operations, respectively, in each machine (node02, node03, node04) copy the public key to the node01. I use here the root user, so ssh directory in /root/.ssh below, if you use another user should be in / home / your user /.ssh below.
Note: 192.168.146.101 ip is the node01
node02 operation
ssh-keygen -t rsa
cd /root/.ssh
scp id_rsa.pub [email protected]:/root/.ssh/id_rsa.pub.node02
node03 operation
ssh-keygen -t rsa
cd /root/.ssh
scp id_rsa.pub [email protected]:/root/.ssh/id_rsa.pub.node03
node04 operation
ssh-keygen -t rsa
cd /root/.ssh
scp id_rsa.pub [email protected]:/root/.ssh/id_rsa.pub.node04
Then back to node01, will own public key and a public key of all the other three servers into authorized_keys file.
node01 operation
cd /root/.ssh
cat id_rsa.pub >> authorized_keys
cat id_rsa.pub.node02 >> authorized_keys
cat id_rsa.pub.node03 >> authorized_keys
cat id_rsa.pub.node04 >> authorized_keys
Finally, copy the file to generate good authrozied_keys node02, node03, node04
node01 operation
scp authorized_keys [email protected]:/root/.ssh/authorized_keys
scp authorized_keys [email protected]:/root/.ssh/authorized_keys
scp authorized_keys [email protected]:/root/.ssh/authorized_keys
It should be noted that a few privileges of folders and files
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
Then you can access several other nodes directly through commands.
ssh node01
ssh node02
ssh node03
ssh node04
Recommended Reading articles
Big Data era need to know six things
Big Data framework hadoop Top 10 Myths
Experience big data development engineer salary 30K summary?