The MySQL database supports the master-slave replication of the database and therefore has its unique advantages in clustering. Many domestic and foreign large-scale website architecture system, have adopted MySQL master-slave database configuration to realize query load, database hot-standby and other functions. I also covered this requirement in the actual Web project, where I will make a brief summary of how to configure the implementation.
This environment: virtual machine under
Server: Ubuntu 14.04 LTS
Database: 5.5.37
Port: 3306
Main ip:192.168.63.133
From ip:192.168.63.134
Authorized account:
User:suxh
password:111111
All right, let's finish. Environment: We directly configure:
The first step: the master and slave two servers to have the same database (need to synchronize) here is the backup database (not much, (www.jbxue.com) before the synchronization started, copy the main library to the library on the line)
The second step of configuring Primary (Master) database editing/etc/my.cnf is to turn on the binary log and set some parameters such as the database to be synchronized
#binaryLogging format-Mixed Recommendedbinlog_format=Mixedbinlog-Ignore-Db=Mysqlbinlog-Do-Db=Backup# RequiredUniqueIdbetween 1 and 2^ + - 1# defaults to 1 ifMaster-Host is not Set# but would not function asA masterifOmittedserver-Id= 1
Parameters explained below:
Server-id This is the only one that cannot follow the same server.
Binlog_format binary file format
Binlog_ignore-db ignored databases
BINLOG-DO-DB the database to synchronize
Restart the database after Setup is finished.
The third step from the database:
Similarly modifying/etc/my.cnf in MySQL version 5.1.7 does not support master-host "similar parameters; So just configure server-id=2 to do it.
Then log in from the database settings
Change Master to master_host= ' 192.168.63.133 ', master_user= ' suxh ', master_password= ' 111111 ';
Slave start;