MySQL mmm High Availability configuration

Source: Internet
Author: User
Tags db2 install perl egrep

10.10.10.20: Monitoring Side

10.10.10.21: Main

10.10.10.22: Main

10.10.10.23: From

10.10.10.24: From

Yum-y install MySQL Mysql-server

Service mysqld Start

Yum-y Install mysql-mmm*

Useradd--comment "MMM Script owner"--shell/sbin/nologin MMMD

Yum-y Install perl-time-hires*


GRANT REPLICATION CLIENT on * * to ' mmm_monitor ' @ ' 10.10.10.% ' identified by ' Monitor_password ';

GRANT SUPER, REPLICATION CLIENT, PROCESS on * * to ' mmm_agent ' @ ' 10.10.10.% ' identified by ' Agent_password ';

GRANT REPLICATION SLAVE on * * to ' REPLICATION ' @ ' 10.10.10.% ' identified by ' Replication_password ';



Change MASTER to master_host= ' 10.10.10.21 ', master_port=3306, master_user= ' replication ', master_password= ' Replication_password ', master_log_file= ' mysql-bin.000001 ', master_log_pos=98;

Change MASTER to Master_host = ' 10.10.10.22 ', master_port=3306, master_user= ' replication ', master_password= ' Replication_password ', master_log_file= ' mysql-bin.000001 ', master_log_pos=1146;


[Email protected] ~]# egrep-v "^#|^$"/etc/mysql-mmm/mmm_common.conf

Active_master_role writer

Cluster_interface eth0

Pid_path/var/run/mmmd_agent.pid

bin_path/usr/lib/mysql-mmm/

Replication_user replication

Replication_password Replication_password

Agent_user mmm_agent

Agent_password Agent_password

IP 10.10.10.21

Mode Master

Peer DB2

IP 10.10.10.22

Mode Master

Peer DB1

IP 10.10.10.23

mode slave

IP 10.10.10.24

mode slave

<role writer>

Hosts DB1, DB2

IPs 10.10.10.100

Mode Exclusive

</role>

<role reader>

Hosts DB1, DB2, DB3, DB4

IPs 10.10.10.101,10.10.10.102

Mode Balanced

</role>

[Email protected] ~]#

[Email protected] ~]# egrep-v "^#|^$"/etc/mysql-mmm/mmm_agent.conf

Include mmm_common.conf

This DB4


[Email protected] ~]# egrep-v "^#|^$|^\s+#"/etc/mysql-mmm/mmm_mon.conf

Include mmm_common.conf

<monitor>

IP 10.10.10.20

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 10.10.10.1,10.10.10.21,10.10.10.22,10.10.10.22,10.10.10.23,10.10.10.24

Auto_set_online 60

</monitor>

Monitor_user Mmm_monitor

Monitor_password Monitor_password

Debug 0

[Email protected] ~]#


[Email protected] ~]# Mmm_control Show

DB1 (10.10.10.21) master/online. Roles:

DB2 (10.10.10.22) master/online. Roles:writer (10.10.10.100)

DB3 (10.10.10.23) slave/online. Roles:reader (10.10.10.101)

DB4 (10.10.10.24) slave/online. Roles:reader (10.10.10.102)


[Email protected] ~]#


[Email protected] ~]# egrep-v "^#|^$"/etc/my.cnf

[Mysqld]

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

User=mysql

server_id = 4

Log_bin =/var/log/mysql/mysql-bin.log

Log_bin_index =/var/log/mysql/mysql-bin.log.index

Relay_log =/var/log/mysql/mysql-relay-bin

Relay_log_index =/var/log/mysql/mysql-relay-bin.index

Expire_logs_days = 10

Max_binlog_size = 100M

Log_slave_updates = 1

Auto_increment_increment = 2

Auto_increment_offset = 1

Skip-name-resolve

[Mysqld_safe]

Log-error=/var/log/mysqld.log

Pid-file=/var/run/mysqld/mysqld.pid

[Email protected] ~]#




This article is from the "Drunken Cold river" blog, please be sure to keep this source http://cjlozbg.blog.51cto.com/3513565/1733236

MySQL mmm High Availability configuration

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.