MySQL dual-master high availability architecture-MMM practice

Source: Internet
Author: User
MMM Introduction: MMM is the Master-MasterReplicationManagerforMySQL (mysql Master replication manager). It is a scalable script suite for monitoring, failover, and management of mysql Master replication configurations.

MMM Introduction: MMM is the Master-MasterReplicationManagerforMySQL (mysql Master replication manager). It is a scalable script suite for monitoring, failover, and management of mysql Master replication configurations.

MMM introduction:

MMM is the Master-Master Replication Manager for MySQL (mysql Master Replication Manager ), it is a scalable script suite for monitoring, failover, and management of mysql master/Master replication configurations (only one node can be written at any time ), this suite can also be used to perform read load balancing on any number of slave servers based on the standard master/Slave configuration, so you can use it to start virtual ip addresses on a group of replication servers. In addition, it also provides scripts for data backup and node-to-node re-synchronization.
MySQL itself does not provide a replication failover solution. The MMM solution can implement server failover to achieve high availability of mysql.
MMM project from

Official Website:

The main features of MMM are provided by the following three scripts:
Mmm_mond: monitors and daemon processes for all monitoring jobs and determines node removal.
Mmm_agentd: the proxy daemon running on the mysql server. It is provided to the Monitoring node through a simple remote service set.
Process

Advantages and disadvantages of this architecture:
Advantages: high security, stability, and good scalability. When the master server fails, another master takes over immediately. Other slave servers can automatically switch over without manual intervention.

Disadvantage: at least three nodes have requirements on the number of hosts. read/write splitting is required, which is difficult to implement in program expansion. At the same time, Master-slave (dual-master) Synchronization latency requirements are relatively high! Therefore, it is not suitable for scenarios where data security is very strict.

Practical scenarios: scenarios with high access traffic and fast business growth that require read/write splitting.

Environment:
MMM_Monitor: 192.168.8.31 ----- (MySQL-MON)
MySQL_Master1: 192.168.8.32 ----- (MySQL-M1)
MySQL_Master2: 192.168.8.33 ----- (MySQL-M2)
VIP_Write: 192.168.8.30 ----- (VIP0)
VIP_Read1: 192.168.8.34 ----- (VIP1)
VIP_Read2: 192.168.8.35 ----- (VIP2)

Architecture schematic:

I. Basic Environment Configuration

1. Set hosts resolution

The three servers are configured as follows:

Cat>/etc/hosts <
192.168.8.31 MySQL-MON
192.168.8.32 MySQL-M1
192.168.8.33 MySQL-M2
EOF

Ii. install and configure mysql

The installation process is omitted. If mysql is not installed, skip this tutorial!

MySQL-M1 Configuration:

Server-id = 12

# Log-slave-updates

# Sync_binlog = 1

Log-bin =/data/mysql/binlog/mysql-bin

Auto-increment = 2

Auto-increment-offset = 2

Relay-log = mysql-relay

Relay-log-index = mysql-relay.index

MySQL-M2 Configuration:

Server-id = 13

# Log-slave-updates

# Sync_binlog = 1

Log-bin =/data/mysql/binlog/mysql-bin

Auto-increment = 2

Auto-increment-offset = 2

Relay-log = mysql-relay

Relay-log-index = mysql-relay.index

Iii. Install mysql-mmm

Install on three servers

Wget

Rpm-ivh epel-release-5-4.noarch.rpm

Yum-y install mysql-mmm *

[Root @ MySQL-M1 mysql-mmm] # rpm-qa | grep mysql-mmm

Mysql-mmm-2.2.1-1.el5

Mysql-mmm-agent-2.2.1-1.el5

Mysql-mmm-tools-2.2.1-1.el5

Mysql-mmm-monitor-2.2.1-1.el5

Note: You can also download the source code package for installation:
Wget: mmm2: mysql-mmm-2.2.1.tar.gz
Mv: mmm2: mysql-mmm-2.2.1.tar.gz mysql-mmm-2.2.1.tar.gz
Tar xf mysql-mmm-2.2.1.tar.gz
Cd mysql-mmm-2.2.1
Make install

4. Configure MySQL-M1 and MySQL-M2 master mode

1. Create three accounts first

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.