主节点1上,一路回车生成秘钥
ssh-keygen -t rsa
复制到其他节点 1,2,3都进行。
ssh-copy-id root@flink-01
ssh-copy-id root@flink-02
ssh-copy-id root@flink-03
# 各机器创建秘钥
ssh-keygen -t rsa
# 从各个机器汇集公钥到ip1
scp ~/.ssh/id_rsa.pub root@ip1:~/.ssh/2.id.rsa.pub
scp ~/.ssh/id_rsa.pub root@ip1:~/.ssh/3.id.rsa.pub
scp ~/.ssh/id_rsa.pub root@ip1:~/.ssh/4.id.rsa.pub
scp ~/.ssh/id_rsa.pub root@ip1:~/.ssh/5.id.rsa.pub
scp ~/.ssh/id_rsa.pub root@ip1:~/.ssh/6.id.rsa.pub
# 在ip1里生成秘钥认证文件
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/2.id.rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/3.id.rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/4.id.rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/5.id.rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/6.id.rsa.pub >> ~/.ssh/authorized_keys
# 向集群机器分发认证文件
scp ~/.ssh/authorized_keys root@ip2:~/.ssh/
scp ~/.ssh/authorized_keys root@ip3:~/.ssh/
scp ~/.ssh/authorized_keys root@ip4:~/.ssh/
scp ~/.ssh/authorized_keys root@ip5:~/.ssh/
scp ~/.ssh/authorized_keys root@ip6:~/.ssh/