Linux篇-mysql + keepalived高可用

1上次说过了mysql的主从配置

tarzxfkeepalived-1.2.7.tar.gz

cdkeepalived-1.2.7

yuminstallgccgcc-c++

yuminstallkernel-devel-y

2报错

configure:error:Poptlibrariesisrequired

yuminstallpopt-devel

3继续执行

./configure--with-kernel-dir=/usr/src/kernels/2.6.32-696.20.1.el6.x86_64/

Make

Makeinstall

4DIR=/usr/local/

cp/usr/local/etc/rc.d/init.d/keepalived/etc/rc.d/init.d/

cp/usr/local/etc/sysconfig/keepalived/etc/sysconfig/&&mkdir-p/etc/keepalived

cp/usr/local/sbin/keepalived/usr/sbin/

5创建配置文件vi/etc/keepalived/keepalived.conf

6启动

/etc/init.d/keepalivedrestart

tail-fn100/var/log/messages日志一直在滚动,没有加载ipvs模块

modprobeip_vs

lsmod|grepip_vs

/etc/init.d/keepalivedrestart

tail-fn100/var/log/messages

ul3121:09:16localhostrsyslogd-2177:imjournal:begintodropmessagesduetorate-limiting

成功

7从服务器

Mysql从服务器配置keepalived.conf跟master一样,只需要把RealserverIP修改成

real_server192.168.118.129;优先级从100改为90即可

在master、slave数据库上创建/data/sh/mysql.sh脚本,内容为:

pkillkeepalived

然后分别重启两台数据库上keepalive服务即可,最后测试停止mastermysql服务,是否会自动切换

到backup上

 


posted @ 22-07-02 06:42  作者:admin  阅读量:
UU快3平台,UU快3官网,UU快3网址,UU快3下载,UU快3app,UU快3开户,UU快3投注,UU快3购彩,UU快3注册,UU快3登录,UU快3邀请码,UU快3技巧,UU快3手机版,UU快3靠谱吗,UU快3走势图,UU快3开奖结果

Powered by UU快3 @2018 RSS地图 HTML地图