MySQL-mmm-two nodes (master) Architecture
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131229/1Q2143928-0.png "/>
In two node master-master setup, MMM uses five IPs: single permanent IP for each nodethat is never changed, 2 reader IPs (read-only) and 1 writer IP (updates ). last three IPsare migrating between the nodes depending on node availability. normally (no replication failures, no replication delay etc) active master has 2 IPs (readerand writer), standby master-1 IP (reader ). in case of a failure, both-writer and readerroles migrate to the working node. test Environment deployment
Host ip descriptionMonitor 192.168.1.109 mmm monitor server master 192.168.1.106 Database Server (master) slave1 192.168.1.107 Database Server (also master) vip deployment
Ip role descriptionThe 192.168.1.220 writer application connects to this ip address and performs the write operation 192.168.1.221 reader application connects to this ip address. Execute the read operation 192.168.1.222 reader application connects to this ip address to perform the read operation. The specific installation procedure is as follows: 1. install MySQL-mmm and master-master replication) 2. create mmm_monitor and mmm_agent users on the database Node
- GRANT REPLICATION CLIENT ON *.* TO 'mmm_monitor'@'192.168.1.%'
- IDENTIFIED BY 'RepMonitor';
- GRANT SUPER, REPLICATION CLIENT, PROCESS ON *.* TO 'mmm_agent'@'192.168.1.%'
- IDENTIFIED BY 'RepAgent';
3. Configure/etc/mysql-mmm/mmm_common.conf for all nodes including the monitor node.
- active_master_role writer
-
-
- cluster_interface eth0
- pid_path /var/run/mysql-mmm/mmm_agentd.pid
- bin_path /usr/libexec/mysql-mmm/
- replication_user repl
- replication_password repl
- agent_user mmm_agent
- agent_password RepAgent
-
-
-
- ip 192.168.1.106
- mode master
- peer slave1
-
-
-
- ip 192.168.1.107
- mode master
- peer master
-
-
- <role writer>
- hosts master, slave1
- ips 192.168.1.220
- mode exclusive
- </role>
-
- <role reader>
- hosts master, slave1
- ips 192.168.1.221, 192.168.1.222
- mode balanced
- </role>
4. Configure the database node/etc/mysql-mmm/mmm_agent.conf
- Include mmm_common.conf
-
- # The 'this' variable refers to this server. Proper operation requires
- # That 'it' server (db1 by default), as well as all other servers, have
- # Proper IP addresses set in mmm_common.conf.
- # Change to host name
- This master
5. monitor node configuration/etc/mysql-mmm/mmm_mon.conf
- include mmm_common.conf
-
- <monitor>
- ip 127.0.0.1
- pid_path /var/run/mysql-mmm/mmm_mond.pid
- bin_path /usr/libexec/mysql-mmm
- status_path /var/lib/mysql-mmm/mmm_mond.status
- ping_ips 192.168.1.1, 192.168.1.106, 192.168.1.107
- auto_set_online 60
-
- # The kill_host_bin does not exist by default, though the monitor will
- # throw a warning about it missing. See the section 5.10 "Kill Host
- # Functionality" in the PDF documentation.
- #
- # kill_host_bin /usr/libexec/mysql-mmm/monitor/kill_host
- #
- </monitor>
-
-
- monitor_user mmm_monitor
- monitor_password RepMonitor
-
-
- debug 0
6. MySQL-mmm test
- [Root @ monitor mysql-mmm] # mmm_control show
- Master (192.168.1.106) master/ONLINE. Roles: reader (192.168.1.222), writer (192.168.1.220)
- Slave1 (192.168.1.107) master/ONLINE. Roles: reader (192.168.1.221)
-
- -- The mysql service on the master host is disabled, and the role is successfully switched.
- [Root @ monitor mysql-mmm] # mmm_control show
- Master (192.168.1.106) master/HARD_OFFLINE. Roles:
- Slave1 (192.168.1.107) master/ONLINE. Roles: reader (192.168.1.221), reader (192.168.1.222), writer (192.168.1.220)
-
- -- Start the mysql service on the master host and switch the role
- [Root @ monitor mysql-mmm] # mmm_control show
- Master (192.168.1.106) master/ONLINE. Roles: reader (192.168.1.221)
- Slave1 (192.168.1.107) master/ONLINE. Roles: reader (192.168.1.222), writer (192.168.1.220)
7. Common commands
- [root@monitor mysql-mmm]# mmm_control show
- [root@monitor mysql-mmm]# mmm_control set_online slave1
- [root@monitor mysql-mmm]# mmm_control set_offline slave1
This article is from the "day with IT" blog, please be sure to keep this source http://raugher.blog.51cto.com/3472678/1174255