当前位置: 首页 > Linux

配置SSH互信

时间:2023-04-07 01:17:20 Linux

分享一段配置SSH互信的脚本。--所有3个节点su-mysqlmkdir-p$HOME/.sshchmod700$HOME/.sshssh-keygen-trsa-P''-f$HOME/.ssh/id_rsacat$HOME/.ssh/id_rsa.pub>>$HOME/.ssh/authorized_keyschmod644$HOME/.ssh/authorized_keys--复制公钥到mysql用户$HOME目录下的新slave节点--node1scp$HOME/.ssh/id_rsa.pubmysql@192.168.56.82:/home/mysql/.ssh/id_rsa.pub_node1scp$HOME/.ssh/id_rsa.pubmysql@192.168.56.83:/home/mysql/.ssh/id_rsa.pub_node1--node2scp$HOME/.ssh/id_rsa.pubmysql@192.168.56.81:/home/mysql/.ssh/id_rsa.pub_node2scp$HOME/.ssh/id_rsa.pubmysql@192.168.56.83:/home/mysql/.ssh/id_rsa.pub_node2--node3scp$HOME/.ssh/id_rsa.pubmysql@192.168.56.81:/home/mysql/.ssh/id_rsa.pub_node3scp$HOME/.ssh/id_rsa.pubmysql@192.168.56.82:/home/mysql/.ssh/id_rsa.pub_node3--node1cat$HOME/.ssh/id_rsa.pub_node2>>$HOME/.ssh/authorized_keyscat$HOME/.ssh/id_rsa.pub_node3>>$HOME/.ssh/authorized_keys--node2cat$HOME/.ssh/id_rsa.pub_node1>>$HOME/.ssh/authorized_keyscat$HOME/.ssh/id_rsa.pub_node3>>$HOME/.ssh/authorized_keys--node3cat$HOME/.ssh/id_rsa.pub_node1>>$HOME/.ssh/authorized_keyscat$HOME/.ssh/id_rsa.pub_node2>>$HOME/.ssh/authorized_keys--修改所有3个节点的/etc/ssh/ssh_config文件(或$HOME/.ssh/config)su-vi/etc/ssh/ssh_configStrictHostKeyCheckingnoUserKnownHostsFile/dev/nullsystemctlrestartsshd.service--从本地复制一些东西到远程。[mysql@node1~]$scp-r/opt/soft/mysql-cluster-8.0.25-el7-x86_64node2:/opt/soft[mysql@node1~]$scp-r/opt/soft/mysql-cluster-8.0.25-el7-x86_64node3:/opt/soft

最新推荐
猜你喜欢