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