美文网首页大型电商详情页系统
6. 搭建 CentOS 集群 - 配置4台 CentOS 为

6. 搭建 CentOS 集群 - 配置4台 CentOS 为

作者: 殷建卫 | 来源:发表于2018-02-16 22:29 被阅读0次

配置本机 SSH 免密码登录

在本地 CentOS 中配置 SSH 免密码登录

ssh-keygen -t rsa

生成本机的公钥,过程中不断敲回车即可,ssh-keygen 命令默认会将公钥放在 /root/.ssh 目录下。

cd /root/.ssh
cp id_rsa.pub authorized_keys

将公钥复制为 authorized_keys 文件,此时使用 SSH 连接本机就不需要输入密码了

配置四台 CentOS 互相之间的 SSH 免密码登录

使用 ssh-copy-id -i hostname 命令将本机的公钥拷贝到指定机器的 authorized_keys 文件中

在 eshop-cache02、eshop-cache03、eshop-cache04 机器上执行 ssh-copy-id -i hostname 命令,然后在 eshop-cache01 上执行如下拷贝动作。

scp authorized_keys eshop-cache02:/root/.ssh
scp authorized_keys eshop-cache03:/root/.ssh
scp authorized_keys eshop-cache04:/root/.ssh

到这里整个 CentOS 集群环境就已经配置好了。

相关文章

网友评论

    本文标题:6. 搭建 CentOS 集群 - 配置4台 CentOS 为

    本文链接:https://www.haomeiwen.com/subject/rlzptftx.html