Mmm is used to monitor and Failover the mysql master-slave replication Architecture Based on Information Detection Methods. mmm can achieve load balancing. 100% of data availability mmm involves check items for server accessibility and service accessibility, the replication thread can
Mmm is used to monitor and Failover the mysql master-slave replication Architecture Based on Information Detection Methods. mmm can achieve load balancing. 100% of data availability mmm involves check items for server accessibility and service accessibility, the replication thread can
Purpose
Mmm monitors and transfers the mysql master-slave replication architecture based on information detection.
Mmm can achieve load balancing and 100% data availability.
Mmm checks server accessibility, service accessibility, and replication thread controllability
: When master1 is down, mmm can transfer the previously shared traffic, or even upgrade from the server to the master.
Continue the dual-master model.
Mmm-agent status overview
Online node available
Replication_delay replication delay or failure (check the req_backlog file)
Replication_fail replication failed
Awating_recovery waiting for recovery
Hard_offline host offline
Admin_offline
Unknown error
The plan is as follows:
172.16.43.200 the master machine is responsible for monitoring and resource management.
172.16.43.1 vip (172.16.43.11) master1 master copy first server (read/write)
172.16.43.2 vip (172.16.43.12) master2 master copy second (read-only)
172.16.43.3 vip (172.16.43.13) Server Load balancer master-slave replication 1, 2 Information (read-only)
The experiment process is as follows:
Installation and installation of Main Control: ansible, mysql client, mysql-mmm
The cluster node is installed as follows: mariadb, mysql-agent
I) host mutual trust, key to ansible deployment
Yum-y install ansible-1.5.4-1.el6.noarch.rpmvim/etc/ansible/hosts # master node completed [masterserver] master1.king.commaster2.king.com. [slaveserver] slave.king.com # master node completes mutual trust. Multiple managed nodes do not repeat ssh-keygen-t rsassh-copy-id-I. root@slave.king.com for ssh/id_rsa.pub. # install mysql-mmm * yum-y install mysql-mmm * on the master node *. # Two mmm configuration files are available #1. mmm_common, mmm_mon #2. mmm_common and mmm_agent # common/etc/mysql-mmm/mmm_common.confactive_master_role writer on the master side. Cluster_interfaceeth0pid_path/var/run/mysql-mmm/mmm_agentd.pidbin_path/usr/sbinreplication_userreplication_password replagent_usermmm_agentagent_passwordagent_password . Ip 172.16.43.1mode masterpeer master2 . Ip 172.16.43.2mode masterpeer master1 . Ip 172.16.43.3mode slave . # Who can write the vip? (refer to the configuration in this article) Hosts master1, master2ips 172.16.43.11mode exclusive . # Who can read the vip? (refer to the configuration in this article) Hosts master1, master2ips 172.16.43.11, 172.16.43.12, 172.16.43.13mode balanced . # The master node completes vim/etc/mysql-mmm/mmm_mon.conf # You need to change ping_ips and add the cluster you want to monitor to. #172.16.0.1 is the gateway ipping_ips 172.16.0.1, 172.16.43.1, 172.16.43.2, 172.16.43.3. Monitor_usermmm_monitormonitor_password monitor_password
Ii) install mariadb and mysql-agent
# Compile install. yaml, run the following installation configuration using ansible-playbook-hosts: masterserver: slaveserver remote_user: root tasks:-name: mariadb installcopy: src =/root/mariadb-10.0.10-linux-x86_64.tar.gz dest =/tmp-name: conf servicecommand: tar xf/tmp/mariadb-10.0.10-linux-x86_64.tar.gz-C/usr/local ############################ #################################### name: x. It takes only half a day to know that a name cannot contain multiple commands, so .. ######################################## ########################-name: 1 command: ln-sv/usr/local/mariadb-10.0.10-linux-x86_64/usr/local/mysql-name: 2 command: cp/usr/local/mysql/support-files/mysql. server/etc/rc. d/init. d/mysqld-name: 3 command: chmod + x/etc/rc. d/init. d/mysqld-name: 4 command: mkdir/mydata/data-p-name: 5 command: mkdir/mydata/binlogs-p-name: 6 command: mkdir/mydata/relaylogs-p-name: 7 command: useradd-r-s/sbin/nologin mysql-U-name: 8 command: chown mysql. mysql/mydata-R-name: 9 command: chown mysql. mysql/usr/local/mysql-R-name: 9-1 # port the locally configured installation file to the cluster node. The extracted configuration file may not meet the requirements. copy: src =/usr/local/mysql/scripts/mysql_install_db dest =/usr/local/mysql/scripts/-name: 10 command: /usr/local/mysql/scripts/mysql_install_db -- user = mysql -- datadir =/mydata/data-name: mariadb conf # configuration file/etc/my. cnf configured # log-bin =/mydata/binlogs/mysql-bin # relay-log =/mydata/relaylogs/relay-bin # datadir =/mydata/datacopy: src =/etc/my. cnf dest =/etc/my. cnfnotify:-restart mariadb-name: install mysql-mmm-agentyum: name = mysql-mmm-agent state = present-name: conf mysql-mmm-agentcopy: src =/etc/mysql-mmm/mmm_common.conf dest =/etc/mysql-mmm-name: modify mmm_agent.confcommand: sed-I's @ ^ \ (this [[: space:] \). * @ \ 1 {item }}@ '/etc/mysql-mmm/mmm_agent.confwith_items:-master1-master2-slave-name: 11 command: sed-I's @ ^ \ (ENABLED = \). * @ \ 11 @ '/etc/default/mysql-mmm-agent handlers:-name: restart mariadbservice: name = mysqld state = restarted
If you are not familiar with yaml, you can use yaml.org.