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 Cluster Architecture mmm High availability Cluster and Server online

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

MMM, the Multi-Master Replication Manager for MySQL:mysql multi-master replication manager, is based on perl implementation, a scalable suite of scripts for monitoring, failover, and management of mysql master replication configurations (only one node can be written at any time), and MMM can also read load balancing to slave servers, so it can be used to launch virtual ip on a set of servers for replication. It also has scripts that implement data backup and resynchronization between nodes.

Advantages: high availability, good expansibility, automatic failure switching, for master and master synchronization, only one database write operation is provided at the same time to ensure the consistency of the data. When the master server dies, another master immediately takes over, and the other slave servers can be switched automatically without human intervention.

Disadvantages: the monitor node is a single point, but you can also combine keepalived or haertbeat to make it highly available; at least three nodes require the number of hosts, need to achieve read-write separation, and need to write read-write separation programs at the front end. In the business system with very busy reading and writing, the performance is not very stable, and there may be problems such as replication delay, handover failure and so on. The MMM scheme is not suitable for the environment with high data security requirements and busy reading and writing.

II. Deployment and implementation

1. Environmental introduction

OS:centos7.2 (64-bit) database system: mysql5.7.13 turns off selinux

Mainframe

Ip

Hostname

Server--id

Master1

192.168.119.129

Master1

one

Master2

192.168.119.130

Master2

two

Slave

192.168.119.131

Slave

three

Montior

192.168.119.132

Montior

four

Use yum to install related dependency packages

Install perl related libraries

The word is a little cpan-I Algorithm::Diff Class::Singleton DBI DBD::mysql Log::Dispatch Log::Log4perl Mail::Send Net::ping Proc::Daemon Time::HiResParams::Validate Net::ARP

Add address and hostname to / etc/hosts

Test whether ping can be connected and communicate.

Add the mysql / etc/my.cnf main configuration parameter file to master1

Add / etc/my.cnf main configuration file to master2

Add / etc/my.cnf main configuration file to slave

After modification, turn off the firewall and start the mysql service

The other two master2 and slave are executed according to the above figure.

Create a master-slave replication environment. Master1 is the master of master2 and slave, and master2 is the master of master1.

Create an authorized connection user

Execute on both master

View the status of master1

Establishing connection on master2 to realize Master-Slave replication

Start slave to see if the connection must be yes

Establishing connection on slave to realize Master-Slave replication

Set the master2 as the same as the steps above, just change the ip address.

The following figure is executed on master1

The above has already made master replication and master-slave replication as ok.

Set up mysql-mmm

Create a proxy account and a monitoring account on master1, because the master-slave copy can be created on the master, and it will be synchronized.

Check whether there are monitoring and proxy accounts in both of them.

Www users: mmm monitoring is used to check the health of mysql server processes

Qqq user: mmm agent is used to change read-only mode, replicated master server, etc.

Mysql-mmm installation

Install the monitor on the montior host

Install the downloaded package

Install agents in master1, master2, slave

To configure mmm, four hosts must have the same configuration file.

All the installed configuration files are stored under / etc/mysql-mmm/, and a common file, mmm_common.cof, is included on the management and database server, as follows:

Active_master_role writer

Cluster_interface eno16777736

Pid_path / var/run/mmm_agentd.pid

Bin_path / usr/lib/mysql-mmm/

Replication_user rep

Replication_password 123

Agent_user qqq

Agent_password 123

Ip 192.168.119.129

Mode master

Peer master2

Ip 192.168.119.130

Mode master

Peer master1

Ip 192.168.119.131

Mode slave

Hosts master1,master2

Ips 192.168.119.10

Mode exclusive

Hosts master1,master2, slave

Ips 192.168.119.11192.168.119.22192.168.119.33

Mode balanced

Distribute to the other three hosts using for loop statements

The agent file needs to be modified / mmm_agent.conf in master1, master2, slave

Just add the local host name after the this

You need to enter the script / etc/init.d/mysql-mmm-agent script to start the agent process

Add mmm as a system service and set it to self-boot

It can be displayed that the ok proves that there is no problem with what you have done before, and it is set up on the hosts of the three agents.

Edit / etc/mysql-mmm/mmm_mon.conf of the monitor host

The meaning of each parameter

The ip 127.0.0.1 setting only listens locally, and mmm_mond listens 9988 by default

Pid_path / var/run/mmm_mond.pid

Bin_path / usr/lib/mysql-mmm/

Status_path / var/lib/misc/mmm_mond.status

Ping_ips 192.168.119.129192.168.119.130192.168.119.131 to test the network availability IP address list

Auto_set_online 0 sets the time for automatic online. Default is 60s.

The check_period 5 check period defaults to 5s.

Trap_period 10 the time for a node to be detected unsuccessfully lasts trap_period seconds

Timeout 2 check timeout time

Restart_after 10000 restart the checker process after completing the restart_after check. Default is 10000.

Max_backlog 86400 records the maximum number of times to check the rep_backlog log

Monitor_user www monitors users of the db server

Monitor_password 123 monitors the password of the db server

Debug 0 debug 0 normal mode, 1 is debug mode

Start the monitoring process to add to the / etc/init.d/mysql-mmm-monitor file

Added as a system service and set to self-startup

Chkconfig-add mysql-mmm-monitor

Chkconfig mysql-mmm-monitor on

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

Bring the server online

Check the cluster status of all db servers

View all cluster status

View commands, there are many monitoring command parameters, which can be found on the Internet.

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

Servers

Wechat

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

12
Report