Cluster unified start and stop shell script development

1. cd
2. ls -al display hidden directory
3. rm -rf .ssh delete the .ssh directory of each node
4. ssh master/slave verify whether a password is required exit logout

1.
Set ssh passwordless access to slave nodes 1. Each The node (master/slave) executes ssh-keygen -t rsa     
to create the ssh directory, press Enter all the way, and the generated key pair id_rsa and id_rsa.pub are stored in the ~/.ssh directory by default.

Grant 755 permissions to the .ssh file: chmod 755 .ssh
View the .ssh file:
cd .ssh
#ls –l
id_rsa id_rsa.pub


2. Generate a public key file on the master worker node and
add the public key to the authorized_keys file ( this file Finally, be sure to give 644 permissions )
execute: cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 


3. Copy the public keys of other slave nodes to authorized_keys in the master node (operate remotely on the master node )
Execute: ssh slave cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys


4. Copy the authorized_keys file back to each node, slave is the node name
执行:scp ~/.ssh/authorized_keys slave:~/.ssh/authorized_keys















Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326329861&siteId=291194637