Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install mysql-mmm

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to install mysql-mmm, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Install mysql-mmm

1) install epel

For related documentation, please see: http://fedoraproject.org/wiki/EPEL

Rpm-Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

2) monitor software installation

[root@localhost ~] # yum install-y mysql-mmm-monitor-*

The package is as follows:

[root@localhost ~] # rpm-qa | grep mysql

Mysql-mmm-monitor-2.2.1-1.el5

Mysql-mmm-2.2.1-1.el5

Mysql-5.0.77-4.el5_5.4

3) installation of the machine (including master,slave)

[root@localhost] # yum install-y-mmm-agent*

The package is as follows:

[root@localhost ~] # rpm-qa | grep mysql

Mysql-test-5.0.77-4.el5_5.4

Mysql-mmm-agent-2.2.1-1.el5

Mysql-5.0.77-4.el5_5.4

Mysql-server-5.0.77-4.el5_5.4

Mysql-devel-5.0.77-4.el5_5.4

Mysql-bench-5.0.77-4.el5_5.4

Mysql-mmm-2.2.1-1.el5

Mysql-connector-odbc-3.51.26r1127-1.el5

Configuration file

1) monitor profile

[root@localhost ~] # vi / etc/mysql-mmm/mmm_mon.conf

Include mmm_common.conf

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 172.16.71.128172.71.130 # master,slave actual database ip

Auto_set_online 60

Monitor_user mmm_monitor

Monitor_password 10jqka

Debug

2) generic configuration file, which is the same on both monitor and master,slave

[root@localhost ~] # vi / etc/mysql-mmm/mmm_common.conf

Active_master_role writer

Cluster_interface eth0

Pid_path / var/run/mysql-mmm/mmm_agentd.pid

Bin_path / usr/libexec/mysql-mmm/

Replication_user replicant

Replication_password 10jqka

Agent_user mmm_agent

Agent_password 10jqka

Ip 172.16.71.128 # Real master database ip

Mode master

Peer db2

Ip 172.16.71.130 # Real master database ip

Mode master

Peer db1

#

# ip 192.168.100.51 # Real slave database ip

# mode slave

#

Hosts db1, db2

Ips 172.16.71.253 # Virtual write database ip

Mode exclusive

Hosts db1, db2

Ips 172.16.71.251172.16.71.252 # Virtual read database ip

Mode balanced

3) master,slave configuration file

[root@localhost ~] # vi / etc/mysql-mmm/mmm_agent.conf

Include mmm_common.conf

# The 'this' variable refers to this server. Proper operation requires

# that 'this' server (db1 by default), as well as all other servers, have the

# proper IP addresses set in mmm_common.conf.

If this db1# is the first master db, then it is db1. If it is the second, it is the corresponding machine in db2 and mmm_common.conf.

View the effect

1) start the services related to db1

Service mysqld start

Service mysql-mmm-agent start

Database authorization: the authorization of all databases is the same

GRANT REPLICATION CLIENT ON *. * TO 'mmm_monitor'@'172.16.71.%' IDENTIFIED BY' 10jqka'

GRANT SUPER, REPLICATION CLIENT, PROCESS ON *. * TO 'mmm_agent'@'172.16.71.%' IDENTIFIED BY' 10jqka'

Grant all on *. * to replicant@'172.16.71.%' identified by '10jqka'

Flush privileges

2) start monitor related services

Service mysql-mmm-monitor start

View status:

Mmm_control show

Set db1 to the online state:

Mmm_control set_online db1

Open mmm_agentd port 9989

Real machines view assigned vip addresses

[root@localhost ~] # ip a

1: lo: mtu 16436 qdisc noqueue

Link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

Inet 127.0.0.1/8 scope host lo

Inet6:: 1/128 scope host

Valid_lft forever preferred_lft forever

2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000

Link/ether 00:0c:29:ef:79:70 brd ff:ff:ff:ff:ff:ff

Inet 172.16.71.132/24 brd 172.16.71.255 scope global eth0

Inet 172.16.71.251/32 scope global eth0

Inet 172.16.71.253/32 scope global eth0

Inet6 fe80::20c:29ff:feef:7970/64 scope link

Valid_lft forever preferred_lft forever

Master master (master-master) synchronous configuration

1) 172.16.71.132 machine my.cnf

Skip-name-resolve

Server_id = 132

Set-variable = key_buffer_size=512M

Set-variable = table_cache=32

Set-variable = sort_buffer_size=32M

Set-variable = read_buffer_size=32M

Set-variable = max_connections=2100

Set-variable = log_slow_queries=/var/lib/mysql/log/mysql-slow.log

Set-variable = log_bin=/var/lib/mysql/log/mysql-bin

Set-variable = long_query_time=1

Set-variable = thread_concurrency=16

Set-variable = tmp_table_size=4000000000

Set-variable = slave_skip_errors=all

# replicate-ignore-db=mysql

# replicate-ignore-db=test found that adding this ignore option will lead to a slight problem with the mmm takeover. I don't know why.

Log-slave-updates

Sync_binlog=1

Auto_increment_increment=2

Auto_increment_offset=1

Enter the mysql configuration and set it from

Mysql > change master to master_host='172.16.71.128'

Mysql > change master to master_user='repl'

Mysql > change master to master_password='10jqka'

Mysql > start slave

Master (master) server configuration:

GRANT REPLICATION SLAVE ON *. * TO 'repl'@'172.16.71.%' IDENTIFIED BY' 10jqka'

2) 172.16.71.128 machine my.cnf configuration

Skip-name-resolve

Server_id = 1

Set-variable = key_buffer_size=512M

Set-variable = table_cache=32

Set-variable = sort_buffer_size=32M

Set-variable = read_buffer_size=32M

Set-variable = max_connections=2100

Set-variable = log_slow_queries=/var/lib/mysql/log/mysql-slow.log

Set-variable = log_bin=/var/lib/mysql/log/mysql-bin

Set-variable = long_query_time=1

Set-variable = thread_concurrency=16

Set-variable = tmp_table_size=4000000000

Set-variable = slave_skip_errors=all

# replicate-ignore-db=mysql

# replicate-ignore-db=test

Log-slave-updates

Sync_binlog=1

Auto_increment_increment=2

Auto_increment_offset=2

Enter the mysql configuration and set it from

Mysql > change master to master_host='172.16.71.132'

Mysql > change master to master_user='repl'

Mysql > change master to master_password='10jqka'

Mysql > start slave

Master (master) server configuration:

GRANT REPLICATION SLAVE ON *. * TO 'repl'@'172.16.71.%' IDENTIFIED BY' 10jqka'

Other slave (slave) server configurations:

My.cnf configuration

Skip-name-resolve

Server_id = 1

Set-variable = key_buffer_size=512M

Set-variable = table_cache=32

Set-variable = sort_buffer_size=32M

Set-variable = read_buffer_size=32M

Set-variable = max_connections=2100

Set-variable = log_slow_queries=/var/lib/mysql/log/mysql-slow.log

Set-variable = log_bin=/var/lib/mysql/log/mysql-bin

Set-variable = long_query_time=1

Set-variable = thread_concurrency=16

Set-variable = tmp_table_size=4000000000

Set-variable = slave_skip_errors=all

Mysql > change master to master_host='172.16.71.253'

Mysql > change master to master_user='repl'

Mysql > change master to master_password='10jqka'; mysql > change master to master_log_file='mysql-bin.00001'

Mysql > change master to master_log_pos=128; mysql > start slave

Or join in my.cnf

Server-id=2

Master-host=172.16.71.253

Master-user=repl

Master-password=10jqka

Question 1:

If the two machines are each other's master, you cannot use master's VIP as the master of the two machines. If you use VIP as the master, if none of the machines gets up first as the vip machine, the monitor cannot be used. The log is as follows:

2010-12-06 16:29:46 WARN db1 is not replicating from db2

2010-12-06 16:29:46 WARN db2 is not replicating from db1

Question 2:

When the auto_set_online 3 time of / etc/mysql-mmm/mmm_mon.conf is set to a long time, when the existing master is turned off and the slave that is not enabled is enabled in an instant, the monitor cannot automatically switch between VIP and the mmm is unavailable. You need to set the online status manually, and sometimes it may even cause monitor startup problems. To prevent this from happening, you can set the time to be shorter, or let one of them get up before shutting down the other.

Problem 3:ERROR:Can't connect to monitor daemon

Check the process generally less perl-related processes, inexplicable feeling, after many attempts, generally in mysql those who have agent machine configuration problems, as well as monitor auto_set_online time setting

[root@localhost ~] # ps axu | grep mmm

Root 3113 0.0 7.6 14000 8956? S 16:27 0:00 mmm_mond

Root 3115 0.9 33.2 106440 38976? Sl 16:27 0:00 mmm_mond

Root 3136 0.4 5.5 10388 6456? S 16:28 0:00 perl / usr/libexec/mysql-mmm/monitor/checker ping_ip

Root 3140 0.4 6.5 15208 7640? S 16:28 0:00 perl / usr/libexec/mysql-mmm/monitor/checker mysql

Root 3141 0.3 5.4 10388 6448? S 16:28 0:00 perl / usr/libexec/mysql-mmm/monitor/checker ping

Root 3142 0.5 6.5 15208 7636? S 16:28 0:00 perl / usr/libexec/mysql-mmm/monitor/checker rep_backlog

Root 3144 0.6 6.4 15208 7592? S 16:28 0:00 perl / usr/libexec/mysql-mmm/monitor/checker rep_threads

Root 3148 0.00.5 3916 652 pts/0 R + 16:28 0:00 grep mmm

Other supplementary information

Master-slave status view:

View the status of master

SHOW MASTER STATUS

Position should not be 0

View the status of slave

Show slave status

The fields Slave_IO_Running | Slave_SQL_Running should be YES | YES.

Show processlist; View process

Slave start; # initiates from replication

STOP SLAVE; # stop copying from

RESET MASTER; # reset master log

RESET SLAVE;# reset slave log

When Slave_IO_Running: is No, the slave server cannot synchronize as follows

SLAVE STOP;# stop slave

CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=0

# set master_log_file to the log name derived from the main show master status;, and set POS to 0

SLAVE START;# enables slave again

Mysql normal master-slave configuration (mmm reference is not used)

Configure master and slave my.cnf files:

Skip-innodb

Skip-name-resolve

Server_id = 132

Set-variable = key_buffer_size=512M

Set-variable = table_cache=32

Set-variable = sort_buffer_size=32M

Set-variable = read_buffer_size=32M

Set-variable = max_connections=2100

Set-variable = log_slow_queries=/var/lib/mysql/log/mysql-slow.log

Set-variable = log_bin=/var/lib/mysql/log/mysql-bin# comment out from the library statement

Set-variable = long_query_time=1

Set-variable = thread_concurrency=16

Set-variable = tmp_table_size=4000000000

Set-variable = slave_skip_errors=all

Synchronization cannot be performed due to different mysql versions when the following options are enabled from the server

Replicate-ignore-db=mysql

Replicate-do-db = test

The above is all the contents of the article "how to install mysql-mmm". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report