当前位置:网站首页>MGR_mysqlsh_keepalive高可用架构部署文档
MGR_mysqlsh_keepalive高可用架构部署文档
2022-07-24 05:27:00 【墨天轮】
1.架构节点说明
MGR 单主模式 192.168.17.135(主) 192.168.17.136(从), 192.168.17.137(从)
Mysql router(主) 192.168.17.136:6446 为读写节点
Mysql router(主) 192.168.17.136:6447 为只读节点
Mysql router (备) 192.168.17.137:6446 为读写节点
Mysql router (备) 192.168.17.137:6447 为只读节点
Keepalive 192.168.17.150:6446为应用连接的读写节点
Keepalive 192.168.17.150:6447为应用连接的只读节点
2.安装mgr5.7
https://www.modb.pro/db/105831
3.Mysql-shell
上传mysql-shell 8.0,并运行mysql-shell,执行cluster = dba.createCluster(“myCluster”)
创建,执行cluster.status()查看集群状态
当看当前集群状态,可以看到mgrdb1:3306为读写节点
4.mysql-router
192.168.17.136为主的mysql-router,用bootstrap参数自动构建配置文件与启动脚本
修改或新增参数,修改mysqlrouter.conf文件
启动mysql-router
[[email protected] myrouter]# ./start.sh
[[email protected] myrouter]# PID 99090 written to ‘/tmp/myrouter/mysqlrouter.pid’
5.部署备mysql-router
scp 主的mysql-router配置文件到192.168.17.137
[[email protected] ~]# scp -r [email protected]:/root/mysql_router .
[email protected]’s password:
mysqlrouter.1 100% 42KB 16.3MB/s 00:00
…
6.keepalive
安装keepalive(136和137都需要安装)
[[email protected] myrouter]# yum install -y keepalived
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
- base: mirrors.aliyun.com
…
Dependency Updated:
ipset.x86_64 0:7.1-1.el7 ipset-libs.x86_64 0:7.1-1.el7
Complete!
6.1修改keepalive配置参数
[[email protected] keepalived]# cat keepalived.conf
global_defs {
router_id Myrouter-HA
}
vrrp_script check_run {
script “/etc/keepalived/Myrouter_check.sh”
interval 30
}
vrrp_sync_group VG1 {
group {
VI_1
}
}
vrrp_instance VI_1 {
state BACKUP
interface ens33
virtual_router_id 51
priority 100
advert_int 1
nopreempt
authentication {
auth_type PASS
auth_pass 1234
}
track_script {
check_run
}
virtual_ipaddress { 192.168.17.150}}
[[email protected] keepalived]# cat Myrouter_check.sh
#!/bin/bash
#1 .检查myrouter进程是否异常
myrouter_cnt=netstat -tlnp|grep 6446 |grep mysqlrouter|wc -l
if [ $myrouter_cnt -lt 1 ]
then
systemctl stop keepalived
/sbin/arping -I ens33 -c 5 -s 192.168.17.150 192.168.17.2 &>/dev/null
exit 0
fi
6.2启动keepalive
systemctl start keepalived.service
7.验证测试
7.1验证down一个节点,故障转移
当前主节点是mgrdb1
通过vip 连接,查看当前连节点
关掉主节点mgrdb1
kill -9 pidof mysqld
mgr会自动重新选主。主变成了mgrdb2
通过vip 连接,查看当前连节点
节点自动转移到mgrdb2,说明故障转移成功。
7.2验证mysqlroter故障转移
VIP在主机mgrdb2上。
模拟mysqlrouter down机
查看备机VIP,备机VIP已启动成功
查看VIP连接,连接成功,并且连的是读写节点mgrdb2
边栏推荐
- Introduction, architecture and principle of kubernetes
- 【媒体控制器】开源项目学习笔记(基于Arduino Micro开发板)
- Talk about strong cache and negotiation cache
- JS - mouse and keyboard configuration and browser forbidden operation
- go语言常用命令和包管理
- CentOS操作系统安全加固
- NFS共享服务及实验
- Speed pointer in JS linked list
- 【小型物体测速仪】只有原理,无代码
- 【波形/信号发生器】基于 STC1524K32S4 for C on Keil
猜你喜欢

sojson jsjiami.com.v6 爬虫js逆向

Experiment: disk quota operation

Install Apache manually

Experiment: creation, expansion, and deletion of LVM logical volumes

sql server 同步数据库 跨网段无公网ip几个常见小问题问题

Function application of MySQL

Iterators and generators

kubernetes急速安装

Log collection and analysis platform

Customize MVC 3.0
随机推荐
openssl版本升级
Special effects - starry cosmic background effects
Grid layout
sed命令
Use of awk
Special effects - when the mouse moves, stars appear to trail
Experiment: creation, expansion, and deletion of LVM logical volumes
Promise (try to implement a promise by yourself) more detailed comments and other interfaces are not completed yet. Let's continue next time.
JS: why [] = =! [] return true?
Function application of MySQL
Take you to understand the inventory deduction principle of MySQL database
Detailed analysis of the process (life cycle) of class loading
ES10 subtotal flat and flatmap
【小型物体测速仪】只有原理,无代码
Account and authority management
Process and planned task management
NFS共享服务及实验
Unable to boot after permanent mounting
PXE technology network installation
迭代器与生成器