Home > Database > Mysql Tutorial > 采用MySQL-MMM做DB高可用时,遇到的一个小坑

采用MySQL-MMM做DB高可用时,遇到的一个小坑

WBOY
Release: 2016-06-07 17:22:15
Original
1197 people have browsed it

一、服务器分布二、MySQL-MMM配置(1)、公共配置【所有DB节点:Master1、Master2、Slave1、Slave2Monitor节点】#vim/etc/mysql-mmm/mmm_common.confactive_master

一、服务器分布

wKioL1NeDCOBTrrmAAElNAi_h20772.jpg


二、MySQL-MMM 配置

(1)、公共配置【所有DB节点:Master1Master2Slave1Slave2   Monitor节点

# vim /etc/mysql-mmm/mmm_common.conf

active_master_role writer cluster_interface eth1 pid_path /var/run/mmm_agentd.pid bin_path /usr/lib/mysql-mmm/ replication_user repl replication_password repl123456 agent_user mmm_agent agent_password 123456 ip 10.222.5.10 mode master peer db2 ip 10.222.5.225 mode master peer db1 ip 172.23.155.22 mode slave ip 172.24.18.68 mode slave hosts db1,db2 ips 10.222.5.224 mode exclusive

# vim/etc/mysql-mmm/mmm_agent.conf

include mmm_common.conf this db1


# vim/etc/mysql-mmm/mmm_agent.conf

include mmm_common.conf this db2

# vim/etc/mysql-mmm/mmm_agent.conf

include mmm_common.conf this db3

# vim/etc/mysql-mmm/mmm_agent.conf

include mmm_common.conf this db4

(3)Monitor节点

# vim /etc/mysql-mmm/mmm_mon.conf

include mmm_common.conf ip 10.137.23.103 pid_path /var/run/mmm_mond.pid bin_path /usr/lib/mysql-mmm/ status_path /var/lib/misc/mmm_mond.status ping_ips 10.222.5.10, 10.222.5.225,172.23.155.22,172.24.18.68 auto_set_online 10 monitor_user mmm_monitor monitor_password 123456 debug 0

# vim /data/scripts/refresh_vip.sh

#!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin MMM_COMM_CONF="/etc/mysql-mmm/mmm_common.conf" ETH_NAME=`awk '/cluster_interface/{print $2}' ${MMM_COMM_CONF}` VIP_ADDR=`grep -A 2 '' ${MMM_COMM_CONF} | awk '/ips/{print $2}'` GETWAY_ADDR=`/sbin/route | awk '/default/ {print $2}'` if [[ -n `/sbin/ip addr show ${ETH_NAME} | grep ${VIP_ADDR}` ]]; then /sbin/arping -I ${ETH_NAME} -c 3 -s ${VIP_ADDR} ${GETWAY_ADDR} >/dev/null 2>&1 fi

* * * * * sleep 10; /data/scripts/refresh_vip.sh >/dev/null 2>&1

* * * * * sleep 20; /data/scripts/refresh_vip.sh >/dev/null 2>&1

* * * * * sleep 30; /data/scripts/refresh_vip.sh >/dev/null 2>&1

* * * * * sleep 40; /data/scripts/refresh_vip.sh >/dev/null 2>&1

* * * * * sleep 50; /data/scripts/refresh_vip.sh >/dev/null 2>&1



本文出自 “人生理想在于坚持不懈” 博客,,请务必保留此出处

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template