Source installation AliSQL-AliSQL-5.6.32-9
-
Not from the main real-time synchronization between the database, even if the network connection is normal, there is an instant from the master data inconsistency.
-
If the primary is disconnected from the network, from the library in the network returned to normal, batch synchronization.
-
If you modify data from a database, then if this time from the library is the main library in the implementation of bin-log, it will stop sync error, this is a very dangerous operation. Therefore, under normal circumstances, we have to be very careful modification data from the database.
-
A dual master configuration is derived, mainly from mutual configuration, as long as the modifications do not conflict between the two sides, it can work well.
- If multiple main library, you can use a ring configuration, so that any modification of a node can be synchronized to all nodes
Here we prepared two machines have been installed AliSQL-AliSQL-5.6.32-9 installed to / data / server
main library machine ip: 192.168.124.89 from the library machine ip: 192.168.124.109
master主库配置
vim /data/server/
#修改内容
#解释:server-id服务的唯一标识(主从之间都必须不同);log-bin启动二进制日志名称为mysql-bin
【mysqld】
server-id=1
log-bin=mysql-bin
保存退出
cd /data/server/mysql/support-files
./mysql.server start
master主库添加从库账号
进入到bin目录启动mysql 进入到交互环境
cd /data/server/mysql/bin
./mysql -u root -p
For the new master-slave synchronization chaoge user, it is allowed to log in from a library '192.168.124.109'
From the library to the account authorization, indicating permission to chaoge copy from the library, copy machine on 192.168.124.109
Check the main library to create replication account
Check the authorized account permissions
View of the main library status
slave从库配置
vim /data/server/mysql/my.cnf
重启mysql数据库
cd /data/server/mysql/support-files
./mysql.server start
进入到mysql bin目录进入到交互环境
cd /data/server/mysql/bin
./mysql -u root -p
Slava check the parameters from the database
Replication of configuration parameters, Slave connection configuration Master main library from the library
Synchronous switch activation from the library of test cases from the master copy
查看复制状态 看到
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Then it is a success
Now we test
We create a database in the main library zzq
Look at all the database has no database zzq
Then look at the slave database has no zzq
Then we found zzq database replication from the primary to build success