MySQL master-Slave synchronization architecture mode

Source: Internet
Author: User
Tags lua

One Master one from (important), one master more from (most commonly used), master-slave from, the main structure;

When controlling the master-slave fabric, back up the specified database instead of backing up all the libraries:

1 configuration on the primary database server:

Vim/etc/my.cnf

[Mysqld]

Binlog-do-db=db_name #只允许同步这个库

Binlog-ignore-db=db_name #只不同步这个库

2 on the server side from the database configuration:

Vim/etc/my.cnf

[Mysqld]

Replicate-do-db=db_name #只备份这个库

Replicate-ignore-db=db_name #只不备份这个库

MySQL read-write separation

192.168.4.100 read-Write separation proxy Server

192.168.4.5 Master/192.168.4.205 from

Turn off iptables selinux on all servers

4.100 release 3306 port (Rpm-qa | Grep-i mysql-server) put it down, stop it.

Verifying authorized users on the database server

Lord and Slave: Grant all on * * to username @ "%" identified by "123456";

Install the package that provides the proxy service Rpm-q LUA

TAR-ZXVF mysql-proxy-0.8.3-linux-rhel5-x86-64bit.tar.gz-c/usr/local/

MV Mysql-proxy-0.8.3-linux-rhel5-x86-64bit/usr/local/mysqlproxy

chmod +x/usr/local/mysqlproxy/share/local/mysql-proxy/rw-splitting.lua

Start the MySQL agent service

-P: Specifies the IP address that the agent listens on, port

-r: Specifies the IP address of the read server, port

-B: Specify the IP address of the write server, port

-S: Specify the path to the Lua script file

--keepalive: Automatically restarts this process if the process crashes

/usr/local/mysqlproxy/bin/mysql-proxy-p 192.168.4.100:3306-r 192.168.4.205:3306-b 192.168.4.5:3306-s/usr/local/ Mysqlproxy/share/doc/mysql-proxy/rw-splitting.lua &

Client testing (another one)



MySQL master-Slave synchronization architecture mode

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.