12-09
12-09
12-09
MYSQL merge union merge sort_union 的不同
12-09
12-09
【MySQL】5.6/5.7并行复制bug导致的故障 ERROR 1755/1756
12-09
PHP Mysql support: 是mysql 还是mysqlnd?
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
MYSQL merge union merge sort_union 的不同
12-09
12-09
【MySQL】5.6/5.7并行复制bug导致的故障 ERROR 1755/1756
12-09
PHP Mysql support: 是mysql 还是mysqlnd?
12-09
12-09
12-09
12-09
12-09
12-09
3台linux服务器互信[root@mydb1 ~]# hostnamemydb11、改主机名,由mydb1改为mydb100vi /etc/sysconfig/network将HOSTNAME后面的值改为想要设置的主机名HOSTNAME=mydb1002、每
以下为本文的正文内容,请查阅,本站为公益性网站,复制本文以及下载DOC文档全部免费。
3台linux服务器互信
[root@mydb1 ~]# hostname
mydb1
1、改主机名,由mydb1改为mydb100
vi /etc/sysconfig/network
将HOSTNAME后面的值改为想要设置的主机名
HOSTNAME=mydb100
2、每个节点加入最后三行
[root@mydb1 ~]# vi /etc/hosts
127.0.0.1localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.28.100 mydb100
192.168.28.101 mydb101
192.168.28.102 mydb102
3、生成公钥和私钥,每个节点都执行
在/root/.ssh下执行生成公钥和私钥命令,即公钥私钥存放在该目录下才生效
cd /root/.ssh
ssh-keygen是生成密钥命令 -t 指定密钥类型,默认是 rsa ,可以省略,-f 指定密钥文件存储文件名
[root@mydb102 .ssh]# ssh-keygen -t dsa -P '' -f id_dsa
Generating public/private dsa key pair.
Your identification has been saved in id_dsa.
Your public key has been saved in id_dsa.pub.
The key fingerprint is:
36:77:57:c2:bf:2c:c1:5a:15:84:c4:d7:2f:91:86:00 root@mydb100
The key's randomart image is:
+--[ DSA 1024]----+
|E...ooo+.|
|.++.o|
| .+oo|
|. o+.|
|S . .+...|
|. o .o.o .|
|. . o |
| . |
| |
+-----------------+
[root@mydb100 .ssh]# ll
total 16
-rw-r--r-- 1 root root 1806 Aug 10 17:46 authorized_keys
-rw------- 1 root root 672 Aug 10 17:13 id_dsa
-rw-r--r-- 1 root root 602 Aug 10 17:13 id_dsa.pub
-rw-r--r-- 1 root root 1570 Aug 10 17:48 known_hosts
4、 将公钥添加到认证文件中
[root@mydb100 .ssh]# cat id_dsa.pub>>authorized_keys
# 只要在一个节点执行即可。这里在 192.168.28.100上执行
scp 192.168.28.101:/root/.ssh/id_dsa.pub ./id_dsa.pub.101
scp 192.168.28.102:/root/.ssh/id_dsa.pub ./id_dsa.pub.102
cat id_dsa.pub.101>>/root/.ssh/authorized_keys
cat id_dsa.pub.102>>/root/.ssh/authorized_keys
5、 分发整合后的文件到其它节点
scp authorized_keys 192.168.28.101:/root/.ssh
scp authorized_keys 192.168.28.102:/root/.ssh
6、测试互信验证
测试时,第一次,需要输入密码,之后就不需要输入密码了。
[root@mydb102 .ssh]# ssh mydb100
Last login: Fri Aug 10 17:48:26 2018 from mydb101
[root@mydb100 ~]# ssh mydb101
Last login: Fri Aug 10 17:48:51 2018 from mydb102
[root@mydb101 ~]# ssh mydb102
Last login: Fri Aug 10 17:48:49 2018 from mydb101
[root@mydb102 ~]# ssh 192.168.28.100
Last login: Fri Aug 10 17:48:57 2018 from mydb102
[root@mydb100 ~]# ssh 192.168.28.102
Last login: Fri Aug 10 17:49:10 2018 from mydb101
11-20
11-20
11-19
11-20
11-19
11-20
11-20
11-20
11-20
11-19
11-19
11-19
11-19
11-19
11-19
11-19