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

Mysql High availability

2025-05-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1 mmm architecture

Mysql high availability cluster (mysql MMM + mysql master-slave synchronization)

1. Public configuration

Configure fixed physical Ip address 237 42 101 102 77

All machines can ping each other.

Server 237 42 101 102 runs the mysql database service,

Configure YUM Feed

Installed on all servers 237 42 101 102 77

Rpm-Q perl | | yum-y perl

Yum-y install perl-*

2. Configure the main main structure (237 42)

Configuration of 237

Mysql > grant replication slave on *. * to slaveuser@ "172.40.7.42" identified by "123"

[root@www mysql] # cat / etc/my.cnf

[mysqld]

Log-bin=master237

Server_id=237

: wq

[root@www mysql] # service mysql restart

Configuration of 42

Mysql > grant replication slave on *. * to slaveuser@ "%" identified by "123"

Vim / etc/my.cnf

[mysqld]

Server_id=42

Log-bin=master42

Log_slave_updates

: wq

Service mysql restart

Mysql-uroot-p123

Mysql > change master to master_host= "172.40.7.237", master_user= "slaveuser", master_password= "123", master_log_file=" master237.000001 ", master_log_pos=120

Mysql > start slave

Configure yourself as 42 on the 237 slave database server

Change master to master_host= "172.40.7.42", master_user= "slaveuser", master_password= "123", master_log_file=" master42.000001 ", master_log_pos=120

Mysql > start slave

3. Configure 101 and 102 to do 42 slave database server

Vim / etc/my.cnf

[mysqld]

Server_id=101

: wq

Service mysql restart

Mysql > change master to master_host= "172.40.7.42", master_user= "slaveuser", master_password= "123", master_log_file=" master42.000001 ", master_log_pos=120

Mysql > start slave

Install the mysql-mmm software on all servers 237 42 101 102 77

Unzip mysql-mmm.zip

Cd mysql-mmm

Tar-zxvf mysql-mmm-2.2.1.tar.gz

Cd mysql-mmm-2.2.1

Make install

Ls / etc/mysql-mmm/*.conf

Authorization on all database servers

Grant replication client,process,super on *. * to agent@ "%" identified by "123456"

Grant replication client on *. * to monitor@ "%" identified by "123456"

Introduction to mysql-mmm?

Monitoring, failover (perl script)

2 processes are available after software installation

Mmm-monitor monitoring process

Run on the monitoring terminal 77

Responsible for all the monitoring work of the monitoring guard into

Procedure, which determines the removal or recovery of the disabled node

Mmm-agent agent process

Run on the monitored terminal 237 42 101 102

Provide a simple set of remote services to

Monitoring node

Write vip 172.40.7.100

Read vip 172.40.7.110

172.40.7.120

Detailed explanation of documents

Main configuration file for mmm_mon.conf mmm-monitor monitoring process

Only need to have on the monitoring server

The main configuration file for the mmm_agent.conf mmm-agent agent process

Only need to have on the database server

[root@www Desktop] # cat / etc/mysql-mmm/mmm_agent.conf

Include mmm_common.conf

This master237

[root@www Desktop] #

Mmm_common.conf files are required on all servers.

Profile that defines the role of the server

4 start the service

4.1 start the mmm_agent process (101 102 42 237)

Log file / var/log/mysql-mmm/mmm_agentd.log

Cd mysql-mmm

Sh a.sh

[root@www mysql-mmm] # / etc/init.d/mysql-mmm-agent start

Daemon bin:'/ usr/sbin/mmm_agentd'

Daemon pid:'/ var/run/mmm_agentd.pid'

Starting MMM Agent daemon... Ok

[root@www mysql-mmm] #

4.2 start the mmm_mon process (77)

/ var/log/mysql-mmm/mmm_mond.log log file

Cd mysql-mmm

Sh a.sh

# / etc/init.d/mysql-mmm-monitor start

# mmm_control help

[root@svr5 mysql-mmm] # mmm_control show

Master237 (172.40.7.237) master/AWAITING_RECOVERY. Roles:

Master42 (172.40.7.42) master/AWAITING_RECOVERY. Roles:

Slave101 (172.40.7.101) slave/AWAITING_RECOVERY. Roles:

Slave102 (172.40.7.102) slave/AWAITING_RECOVERY. Roles:

[root@svr5 mysql-mmm] #

[root@svr5 mysql-mmm] # mmm_control show

Master237 (172.40.7.237) master/ONLINE. Roles: writer (172.40.7.100)

Master42 (172.40.7.42) master/AWAITING_RECOVERY. Roles:

Slave101 (172.40.7.101) slave/AWAITING_RECOVERY. Roles:

Slave102 (172.40.7.102) slave/AWAITING_RECOVERY. Roles:

Mmm_control set_online slave101

Install the program that obtains the virtual ip address

Yum-y install gcc gcc-c++

Gunzip Net-ARP-1.0.8.tgz

79 tar-xvf Net-ARP-1.0.8.tar

80 cd Net-ARP-1.0.8

81 rpm-Q gcc

82 yum-y install gcc gcc-c++

83 perl Makefile.PL

84 make

85 make install

86 ip addr show commands to view virtual ip addresses

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