Multi-Master Replication Manager for MySQL FAQ

时间:2022-07-18 15:27:59

I have one master and many slaves and want to promote one slave to become a second master. Does this work?

Yes. Set up master-master replication (don’t forget log_slave_updates, etc.), then change mmm config and finally restart agents/monitor.

FATAL Listener: Can’t create socket!

When I try to start the agent these messages are repeatedly logged:

2009/10/30 20:08:59 FATAL Child exited with exitcode 99, restarting
2009/10/30 20:08:59 FATAL Listener: Can't create socket!

→ For some reason the agent tries to listen on an IP that is not configured on the host. Check your configuration and be sure that you have not mistyped anything. Be sure to also check the this configuration directive.

Is it possible to monitor multiple clusters from the same monitoring host?

Yes, you can run multiple instances of mmm_mond on the same host. You have to copy the init-script and adjust the ‘CLUSTER’ variable (e.g. CLUSTER=’C1’). The config file for this second instance should be named mmm_mon_C1.conf instead of mmm_mon.conf. You also have to adjust some things in the section of the config (choose a unique port number, default is 9988):

pid_path /var/run/mmmd_mon_C1.pid
port     9990

To control this cluster you can use mmm_control @C1 - e.g.:

mmm_control @C1 show

FATAL Configuration file /etc/mysql-mmm/mmm_mon.conf is world writable!

mon:/etc/mysql-mmm # chmod 640 mmm_common.conf
mon:/etc/mysql-mmm # ll
total 16
-rw-r----- 1 root root   42 Sep  2 10:38 mmm_agent.conf
-rw-r----- 1 root root 1131 Sep  2 08:19 mmm_common.conf
-rw-r----- 1 root root  321 Sep  1 14:12 mmm_mon.conf
-rw-r----- 1 root root 1293 Sep  1 14:12 mmm_tools.conf

FATAL Child exited with exitcode 255, restarting after 10 second sleep

vi /etc/mysql-mmm/mmm_mon.conf
deubg 1
mon:/etc/init.d/mysql-mmm-monitor start
Daemon bin: '/usr/sbin/mmm_mond'
Daemon pid: '/var/run/mmm_mond.pid'
Starting MMM Monitor daemon: 2013/08/07 14:25:25 INFO STARTING...
2013/08/07 14:25:25 DEBUG Created pid file '/var/run/mmm_mond.pid' with pid 8982
2013/08/07 14:25:25 INFO Waiting for network connection...
2013/08/07 14:25:25 INFO Spawning checker 'ping_ip'...
2013/08/07 14:25:25 DEBUG IP '192.168.235.57' is reachable: OK
2013/08/07 14:25:25 INFO Shutting down checker 'ping_ip'...
2013/08/07 14:25:25 INFO Network connection is available.
Use of uninitialized value $old_state in string ne at /usr/local/lib/perl5/5.18.0/MMM/Monitor/Agent.pm line 42.
2013/08/07 14:25:25 FATAL Child exited with exitcode 255, restarting after 10 second sleep

I added the following code to /usr/share/perl5/MMM/Monitor/Agent.pm on line 41.

if (! defined($old_state)) { $old_state = 'certinally not new_state'; }

Looking forward to migrating off mmm to corosync/pacemaker.

FATAL Couldn’t configure IP ‘192.168.1.202’ on interface ‘em1’: undef

mon:/home/mysql-mmm-master# ifconfig
eth0      Link encap:Ethernet  HWaddr 98:90:96:d9:a8:1d
          inet addr:192.168.1.19  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::9a90:96ff:fed9:a81d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:696674 errors:0 dropped:0 overruns:0 frame:0
          TX packets:720489 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:186888073 (178.2 MiB)  TX bytes:60360726 (57.5 MiB)
          Interrupt:20 Memory:f7d00000-f7d20000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:109000 errors:0 dropped:0 overruns:0 frame:0
          TX packets:109000 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3082361 (2.9 MiB)  TX bytes:3082361 (2.9 MiB)
vi /etc/mysql-mmm/mmm_common.conf

cluster_interface                eth0

FATAL Child exited with exitcode 2, restarting after 10 second sleep
FATAL Child exited with exitcode 25, restarting after 10 second sleep

vi /etc/mysql-mmm/mmm-agent.conf
debug 1

ex :
Starting MMM Monitor daemon: Can not locate Proc/Daemon.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/sbin/mmm_mond line 11.

Install dependencies:

On Ubuntu

aptitude install liblog-log4perl-perl libmailtools-perl liblog-dispatch-perl iproute libnet-arp-perl libproc-daemon-perl libalgorithm-diff-perl libdbi-perl libdbd-mysql-perl

On RedHat

yum install -y mysql-mmm-agent
This will take care of all the dependencies, which may include:

Other

Visit to https://metacpan.org then search modules and download them.

tar xvf Proc-Daemon-0.21.tar.gz
cd Proc-Daemon-0.21
perl Makefile.pl
make
make install

PS:
DBI module need gcc envirment.
DBD::mysql module need install libmysqld-devel.

FATAL Can’t reach agent on host ‘db2’
FATAL Agent on host ‘db2’ is reachable again

check firewall or network

ex : openSUSE

vi /etc/sysconfig/SuSEfirewall2

FW_SERVICES_EXT_TCP="22 3306 9989"

FATAL exec ‘/usr/lib/mysql-mmm/agent/get_master_log_file’ Permission denied on ‘/usr/lib/perl5/vendor_perl/5.20.1/MMM/Agent/Agent.pm’ on line xxx.
FATAL exec ‘/usr/lib/mysql-mmm/agent/get_master_log_pos’ Permission denied on ‘/usr/lib/perl5/vendor_perl/5.20.1/MMM/Agent/Agent.pm’ on line xxx.
FATAL exec ‘/usr/lib/mysql-mmm/agent/kill_process’ Permission denied on ‘/usr/lib/perl5/vendor_perl/5.20.1/MMM/Agent/Agent.pm’ on line xxx.

db1:/usr/lib/mysql-mmm/agent # chmod 755 get_master_log_* kill_process

At last,MMM software is deprecated.
Please consider using something more actively developed like MHA
https://code.google.com/p/mysql-master-ha/

or

Enhanced MySQL Multi-Master-Manager based on Google’s “mysql-mmm 2.2.1”.
https://github.com/cenalulu/mysql-mmm