简易版本一键免密登陆(通过ssh-copy-id)
简易版本一键免密登陆(通过ssh-copy-id)
- 修改主机名配置hosts
cat >>/etc/hosts<<EOF #添加各个节点hosts解析
172.20.2.222 cm-server
172.20.2.203 hadoop-1
172.20.2.204 hadoop-2
172.20.2.205 hadoop-3
EOF
- 配置cm-server免密钥登录其他节点
ssh-keygen -t rsa #在cm-server生成密钥对
for num in `seq 1 3`;do ssh-copy-id -i /root/.ssh/id_rsa.pub root@hadoop-$num;done