gdb3
MySQL
MySQL Router
ipvsadm
ldirectord
pcs
pacemaker
corosync
MySQL:3309
MySQL Router:6446
MySQL Router:6447
pcs_tcp:13314
pcs_udp:13315
172.17.129.1
VIP
6446、6447
172.17.139.62
MySQL client
大概安装步骤如下
文章插图
二、高可用搭建2.1 基础环境设置(三台服务器都做)
- 分别在三台服务器上根据规划设置主机名
hostnamectl set-hostname gdb1hostnamectl set-hostname gdb2hostnamectl set-hostname gdb3
- 将下面内容追加保存在三台服务器的文件/etc/hosts中
172.17.140.25gdb1172.17.140.24gdb2172.17.139.164gdb3
- 在三台服务器上禁用防火墙
systemctl stop firewalldsystemctl disable firewalld
- 在三台服务器上禁用selinux,如果selinux未关闭,修改配置文件后,需要重启服务器才会生效
文章插图
如下输出表示完成关闭
文章插图
- 在三台服务器上分别执行下面命令,用户建立互相
ssh-keygen -t dsassh-copy-id gdb1ssh-copy-id gdb2ssh-copy-id gdb3
执行情况如下[#19#root@gdb1 ~ 16:16:54]19 ssh-keygen -t dsaGenerating public/private dsa key pair.Enter file in which to save the key (/root/.ssh/id_dsa):## 直接回车/root/.ssh/id_dsa already exists.Overwrite (y/n)? y## 如果原来有ssh配置文件,可以输入y覆盖Enter passphrase (empty for no passphrase):## 直接回车Enter same passphrase again:## 直接回车Your identification has been saved in /root/.ssh/id_dsa.Your public key has been saved in /root/.ssh/id_dsa.pub.The key fingerprint is:SHA256:qwJXgfN13+N1U5qvn9fC8pyhA29iuXvQVhCupExzgTc root@gdb1The key's randomart image is:+---[DSA 1024]----+|... ..||o . o Eo..||o ooooo.o o.||oo = .. *.o||.S .. o +o||. ..o o . .||o.* ....||..+ *o+o+||...o*.+++o|+----[SHA256]-----+[#20#root@gdb1 ~ 16:17:08]20 ssh-copy-id gdb1/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_dsa.pub"/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keysroot@gdb1's password:## 输入gdb1服务器的root用户对应密码Number of key(s) added: 1Now try logging into the machine, with:"ssh 'gdb1'"and check to make sure that only the key(s) you wanted were added.[#21#root@gdb1 ~ 16:17:22]21 ssh-copy-id gdb2/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_dsa.pub"/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keysroot@gdb2's password:## 输入gdb2服务器的root用户对应密码Number of key(s) added: 1Now try logging into the machine, with:"ssh 'gdb2'"and check to make sure that only the key(s) you wanted were added.[#22#root@gdb1 ~ 16:17:41]22 ssh-copy-id gdb3/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_dsa.pub"/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keysroot@gdb3's password:## 输入gdb3服务器的root用户对应密码Number of key(s) added: 1Now try logging into the machine, with:"ssh 'gdb3'"and check to make sure that only the key(s) you wanted were added.[#23#root@gdb1 ~ 16:17:44]23
任意切换服务器,不需要输入密码,则说明互相建立成功[#24#root@gdb1 ~ 16:21:16]24 ssh gdb1Last login: Tue Feb 21 16:21:05 2023 from 172.17.140.25[#1#root@gdb1 ~ 16:21:19]1 logoutConnection to gdb1 closed.[#25#root@gdb1 ~ 16:21:19]25 ssh gdb2Last login: Tue Feb 21 16:21:09 2023 from 172.17.140.25[#1#root@gdb2 ~ 16:21:21]1 logoutConnection to gdb2 closed.[#26#root@gdb1 ~ 16:21:21]26 ssh gdb3Last login: Tue Feb 21 10:53:47 2023[#1#root@gdb3 ~ 16:21:22]1 logoutConnection to gdb3 closed.[#27#root@gdb1 ~ 16:21:24]27
推荐阅读
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 在 Meta 构建和部署 MySQL Raft
- mysql的3种安装方式及yum安装MySQL的步骤
- windows环境mysql自动备份脚本
- 一线大厂面试的MySQL索引夺命连环15问
- 在 MySQL 中处理时间
- TiDB与MySQL的SQL差异及执行计划简析
- 带你读 MySQL 源码:Select *
- MySQL 中时间函数详解,及加减计算总结和使用!
- MySQL索引数据结构入门
- 我们一起聊聊MySQL中的游标,你学会了吗?