集群拓扑
角色
IP地址
master(fabric_order)
172.20.5.236
proxy(fabric_peerOrg1)
172.20.5.237
work1(fabric_peer0Org2)
172.20.5.238
work2(fabric_peer1Org2)
一. 登录一台Master节点进行秘钥生成
Log in to the boot node with an account with root access.Generate an SSH key:
ssh-keygen -b 4096 -t rsa -f ~/.ssh/master.id_rsa -N ""
Create the /root/.ssh folder on the node:
sudo mkdir -p /root/.ssh
Add the key to the list of authorized keys:
cat ~/.ssh/master.id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys
二. 分发密匙到集群节点
1.Create the /root/.ssh folder on the node:
ssh -t demo@172.20.5.239 sudo mkdir -p /root/.ssh
2.Copy the public key to the node:
scp ~/.ssh/master.id_rsa.pub demo@172.20.5.239:~/.ssh/master.id_rsa.pub
如果此时报如下错误
scp: /home/demo/.ssh/master.id_rsa.pub: No such file or directory
那需要去对应节点建立~/.ssh目录
mkdir - p ~/.ssh
3.Connect to the node system, and add the public key to the authorized keys list:
ssh -t demo@172.20.5.239 'cat ~/.ssh/master.id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys; echo "PermitRootLogin yes" | sudo tee -a /etc/ssh/sshd_config'
4.Confirm that the SSH key is present in the node. Run the following command:
ssh-keyscan 172.20.5.239 | sudo tee -a /root/.ssh/known_hosts
网友评论