MySQL Data management 7

Source: Internet
Author: User
Tags diff mixed

deploy MySQL high-cluster mysql-mmm + MySQL master-slave synchronization

Environment readiness (four database servers 12 11 10 9)

Systemctl Stop Firewalld

Setenforce 0

Configuring the Yum Source

Yum-y Install gcc gcc-c++ perl-*

Systemctl Start mysqld

++++++++++++++++++++++++++++++

One configuration MySQL master-slave synchronization (12 11 10 9)

9 and 10 are configured as primary main structures

12 and 11 are configured for 10 from the database server

Requirement: The library table records created by client access to database server 9 o'clock are recorded in 11 and 12


also have.


User authorization:

1 Users with Synchronized data permissions (9 and 10)

Grant Replication Slave on * * to [email protected] "%"


Identified by "123456";

Configure 9 and 10 as the primary main structure

9

Vim/etc/my.cnf

[Mysqld]

Server_id=9

Log_bin=master9

binlog_format= "Mixed"

: Wq

10

Vim/etc/my.cnf

[Mysqld]

server_id=10

Log_bin=master10

binlog_format= "Mixed"

Log_slave_updates

: Wq

9

Mysql> Change Master to


Master_host= "192.168.4.10", master_user= "Slaveuser",


Master_password= "123456", master_log_file= "Master10


.000001 ", master_log_pos=154;

Mysql> show Slave status\g;



10

Mysql> Change Master to


Master_host= "192.168.4.9", master_user= "Slaveuser", M


Aster_password= "123456", master_log_file= "master9.00


0001 ", master_log_pos=154;

Mysql> show Slave status\g;



12 and 11 are configured for 10 from the database server


11

Vim/etc/my.cnf

[Mysqld]

server_id=11

: Wq


12

Vim/etc/my.cnf

[Mysqld]

Server_id=12

: Wq


11 and 12

Mysql> Change Master to


Master_host= "192.168.4.10", master_user= "Slaveuser",


Master_password= "123456", master_log_file= "Master10


.000001 ", master_log_pos=154;

Mysql> show Slave status\g;


To test the registration synchronization configuration:

9

mysql> CREATE DATABASE Gamedb;

Mysql>grant all on gamedb.* to [email protected] "%" identified


By "123456";


254

mysql-h192.168.4.9-ustu10-p123456 Gamedb

mysql> CREATE TABLE t1 (id int);

mysql> INSERT INTO T1 values (100);

Ability to view records and authorized users on 3 other database servers

Select User,host from Mysql.user where user= "Stu10";

SELECT * from Gamedb.t1;


Second, the configuration mysql-mmm

Mysql-mmm Software Introduction

Mmm_monitor Monitoring service running on the monitor side

The MMM_AGENTD Agent service runs on the database server


IP planning

Write VIP Address 192.168.4.100 (9, 10)

Read VIP address 192.168.4.101/102 (11, 12)


Configuring Monitoring Server 8

Systemctl Stop Firewalld

Setenforce 0

Configuring the Yum Source

Yum-y Install gcc gcc-c++ perl-*


Pack (12, 11, 10, 9, 8)

5 Unzip Mysql-mmm.zip

CD mysql-mmm/

TAR-ZXVF mysql-mmm-2.2.1.tar.gz

CD MYSQL-MMM-2.2.1/

Make install


Configuration file Description

ls/etc/mysql-mmm/

mmm_mon.conf mmm_monitor Monitoring Service master configuration file

mmm_agent.conf MMM_AGENTD Agent Service

mmm_common.conf Public files (monitoring server and database server


All have to have)


Modifying a configuration file


1. Modify the master configuration of the Mmm_agentd Agent service on the 4 database servers


File

Vim/etc/mysqlmmm/mmm_agent.conf

Include mmm_common.conf

This host name #自定义

: Wq


2 Modifying the master configuration file for the Mmm_monitor monitoring Service on the monitoring server


3 Modifying public files mmm_common.conf public files


4 on 4 database servers according to the mmm_common.conf configuration file


To add a corresponding authorized user to the settings.


Mysql>grant Replication Client On * * to


[email protected] "%" identified by "123456";


Mysql>grant replication Client,process,super on *.


[email protected] "%" identified by "123456";


Iv. Start-up service


4.2 Starting the AGNETD service on the database server

2 RPM-IVH perl-log-log4perl-1.26-1.el6.rf.noarch.rpm

4 TAR-ZXVF algorithm-diff-1.1902.tar.gz

6 CD algorithm-diff-1.1902/

8 Perl makefile.pl

9 make

Ten make Install

TAR-ZXVF proc-daemon-0.03.tar.gz

CD proc-daemon-0.03/

Perl makefile.pl

+ Make

Make install

Gunzip net-arp-1.0.8.tgz

TAR-XVF Net-arp-1.0.8.tar

CD net-arp-1.0.8/

Perl makefile.pl

Make

Make install

31/etc/init.d/mysql-mmm-agent status

32/etc/init.d/mysql-mmm-agent start

Netstat-utnalp | grep:9989

Ls/var/log/mysql-mmm/mmm_agentd.log


4.3 Start monitor Service on monitoring server

2 RPM-IVH perl-log-log4perl-1.26-1.el6.rf.noarch.rpm

4 TAR-ZXVF algorithm-diff-1.1902.tar.gz

6 CD algorithm-diff-1.1902/

8 Perl makefile.pl

9 make

Ten make Install

TAR-ZXVF proc-daemon-0.03.tar.gz

CD proc-daemon-0.03/

Perl makefile.pl

+ Make

Make install

27/etc/init.d/mysql-mmm-monitor status

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

Netstat-utnalp | grep:9988

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


Log on to the administration page of monitoring Server 8 to view the status of the database server

# Mmm_control Help

# Mmm_control Show

# Mmm_control Set_online Master9

# Mmm_control Set_online Master10

# Mmm_control Set_online Master11

# Mmm_control Set_online Master12

# Mmm_control Show


View the virtual IP address obtained on the database server native

#ip Addr Show | grep 192.168.4.100

Test configuration

254 Client Access

Ping 192.168.4.100

mysql-h192.168.4.100-ustu10-p123456 Gamedb


MySQL Data management 7

Related Article

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.