Master-master replication example
Detailed description of this example configuration could be found in “Typical use-cases of mmm-deployment” document.
Let’s take a looks on example configuration files for such configuration. Every deployment of mmm requires N+1 installation where N is number of MySQL servers and 1 is monitoring server (can be combined with application server). Following examples would be named as mmm_mon.conf for minitoring server and mmm_agent.conf for database servers.
mmm_mon.conf is following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | # # Master-Master Manager config (monitor) # # Debug mode debug no # Paths pid_path /opt/mmm/var/mmmd.pid status_path /opt/mmm/var/mmmd.status bin_path /opt/mmm/bin # Logging setup log mydebug file /opt/mmm/var/mmm-debug.log level debug log mytraps file /opt/mmm/var/mmm-traps.log level trap # MMMD command socket tcp-port bind_port 9988 agent_port 9989 monitor_ip 127.0.0.1 # Cluster interface cluster_interface eth0 # Cluster hosts addresses and access params host master1 ip 192.168.1.8 port 3306 user rep_monitor password RepMonitor mode master peer master2 host master2 ip 192.168.1.9 port 3306 user rep_monitor password RepMonitor mode master peer master1 # # Define roles # active_master_role writer # Mysql Reader role role reader mode balanced servers master1, master2 ip 192.168.1.100, 192.168.1.101 # Mysql Writer role role writer mode exclusive servers master1, master2 ip 192.168.1.200, 192.168.1.201 # # Checks parameters # # Ping checker check ping check_period 1 trap_period 5 timeout 2 # Mysql checker check mysql check_period 1 trap_period 2 timeout 2 # Mysql replication backlog checker check rep_backlog check_period 5 trap_period 10 max_backlog 60 timeout 2 # Mysql replication threads checker check rep_threads check_period 1 trap_period 5 timeout 2 |
In this config file I want to highlight few sections:
- Cluster hosts addresses and access params – this section describe IPs and credentials that will be used in all monitoring checks. So, it is required to have active MySQL instances listening on these IPs and appropriate access restrictions set to allow monitoring server to MySQL instance.
- Define roles – this section defines what roles we have in our cluster and what IPs will be used for each role.
All other config sections are pretty standard and described in details in configuration files section of mmm guide.