MySQL performs master-slave replication to implement HA.

Source: Internet
Author: User

Every mysql server node needs to run mmmd_agent, and run mmmd_mon on another machine [it can be an independent server or a server shared with the AppServer ].
Mmm uses the virtual IP technology. One network card can use multiple IP addresses.
Therefore, when using mmm, 2 * n + 1 IP address is required, and n is the number of mysql nodes, including slave and master
When the database node fails, mmmd_mon cannot detect the mmmd_agent heartbeat or the status of the corresponding mysql server.
Mmmd_mon will make a decision and give an order to the mmmd_agent of a normal database node, so that the mmmd_agent ""
[That is, use the virtual IP address of the node fail just now to direct the virtual IP address from the fail node to the normal machine at this time]

 

 

 

MMMM requires five IP addresses, two nodes use fixed IP addresses, two program read IP addresses (read-only), and one program write IP address (for update)
The following three virtual IP addresses are redirected Between Nodes Based on node availability.

 

I. IP Address Allocation
IP Address Allocation is as follows:
A: mysql master 246
Fixed IP Address: 211.100.97.246
Program read IP Address: 211.100.97.244 (virtual)

B: mysql master 250
Fixed IP Address: 211.100.97.250
Program read IP Address: 211.100.97.243 (virtual)

Monitor 245
IP address for program writing: 211.100.97.248 (virtual)


Add a virtual IP address 211.100.97.244 to 246
Ifconfig eth1: 1 211.100.97.244 netmask too many up
[Root @ XKWB5510 software] # ifconfig-a | grep "inet addr" | head-3 | tail-2 | awk-F "[:] + "'{print $4 usd/" $ NF }'
211.100.97.246/255.255.255.224
211.100.97.244/255.255.255.224

Add a virtual IP address 211.100.97.243 to 250
Ifconfig eth0: 1 211.100.97.243 netmask too many failed up
[Root @ XKWB5705 software] # ifconfig-a | grep "inet addr" | head-2 | awk-F "[:] +" '{print $4 minutes /" $ NF }'
211.100.97.250/255.255.255.224
211.100.97.243/Alibaba Cloud

Add a virtual IP address to 245: 211.100.97.248
Ifconfig eth1: 1 211.100.97.248 netmask too many up
[Root @ CentOS mysql-5.1.56] # ifconfig-a | grep "inet addr" | head-3 | tail-2 | awk-F "[:] + "'{print $4 usd/" $ NF }'
211.100.97.245/255.255.255.224
211.100.97.248/255.255.255.224

2. Authorization
Add a proxy account useradd rep_agent on the AB Machine
Add Monitoring account useradd rep_monitor on the monitor Machine

Authorization on
Mysql> grant all privileges on *. * to 'rep _ monitor' @ '% 'identified by '123 ';
Mysql> grant all privileges on *. * to 'rep _ agent' @ '% 'identified by '123 ';

View authorization information
Mysql> select host, user from mysql. user where user like 'rep % ';
+ ---------------- + ------------- +
| Host | user |
+ ---------------- + ------------- +
| % | Rep_agent |
| % | Rep_monitor |
| 211.100.97.250 | replication |
| Localhost | replication |
+ ---------------- + ------------- +
4 rows in set (0.01 sec)


B authorization
Mysql> grant all privileges on *. * to 'rep _ monitor' @ '% 'identified by '123 ';
Mysql> grant all privileges on *. * to 'rep _ agent' @ '% 'identified by '123 ';

Mysql> select host, user from mysql. user where user like 'rep % ';
+ ---------------- + ------------- +
| Host | user |
+ ---------------- + ------------- +
| % | Rep_agent |
| % | Rep_monitor |
| 211.100.97.246 | replication |
| Localhost | replication |
+ ---------------- + ------------- +
4 rows in set (0.00 sec)


3 mmm Installation
By default, the CentOS software Warehouse does not include these software. The epel package must be supported. Therefore, you must first install epel:
Wget http://download.Fedora.RedHat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Rpm-Uvh epel-release-5-4.noarch.rpm

Install mysql-mmm in the source code package
Wget http://mysql-master-master.googlecode.com/files/mysql-master-master-1.2.3.tar.gz
Tar zxf mysql-master-master-1.2.3.tar.gz
Cd mysql-master-master-1.2.3
./Install. pl

  • 1
  • 2
  • 3
  • 4
  • Next Page

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.