A familiarity with MySQL read-write separation and MySQL storage engine differences.
NDB cluster storage engine ,MyISAM,InnoDB
Myisam is the default storage engine after installation of MySQL, does not support The functions of transaction, row-level and foreign key constraints;NDB is a mysql cluster storage engine with InnoDB supports things, row-level locks, and foreign key constraints. Use show engines; View the storage engine supported by MySQL.
Read/write Separation:
I. Environment:
Application Client
Database Proxy
Database Cluster (two + mysql machines)
Ii. Build Master and slave:
install MySQL;
Configure the my.cnf for master:
Log-bin=mysql-bin
Server-id=1
To add a user dedicated to synchronization:
GRAND REPLICATION SLAVE on * * [email protected] identifiefd by ' password ';
Restart MySQL to make the configuration effective;
last view mysql status:Show Master status;
Configure the slave my.cnf:
server-id=2
after the configuration takes effect, the configuration and Master The connection:
Mysql> Change MASTER to
Master_host= ' 10.20.147.110 ',
Master_user= ' Repl ',
-master_password= ' 111111 ',
Master_log_file= ' mysql-bin.000003 ',
master_log_pos=161261;
whichMaster_hostis aMasterMachine'sIP,Master_userand theMaster_passwordis that we were justMasteradded on the user,Master_log_fileand theMaster_log_posCorrespondence andMasterstatusthe information in
Last Launch slave :
Mysql>start slave;
4 ) Validation Master-slave Construction takes effect
by viewing slave Machine's Log ( /var/log/mysqld.log ):
10070310:51:42 [Note] Slave I/O thread:connected to master ' [email protected]:3306 ', replication started in log ' Mysql-bi N.000003 ' at position 161261
If you see the above information proves the success of the building, if there are problems can also be through this Log Find out why
Read and write separation of MySQL database