Master configuration file:
[Email protected] ~]# MORE/ETC/MY.CNF
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
# Disabling Symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
?
Log-bin=mysqlbin
Server-id = 1 #主机标示, integer
Read-only =0 #主机, read and write all can
Binlog-do-db =testdb01 #需要备份数据, more than one write multiple lines
Binlog-ignore-db =mysql #不需要备份的数据库, more than one write multiple lines
?
[Mysqld_safe]
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
?
?
From the configuration file:
[Email protected] ~]# MORE/ETC/MY.CNF
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
# Disabling Symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
?
Log-bin=mysqlbin
?
Server-id = 2
Log_slave_updates=1
Master-host = 10.0.0.8
Master-user = Mysqlbak
Master-pass = abc123!
Master-port = 3306
Master-connect-retry=60 #如果从服务器发现主服务器断掉, Reconnect time > difference (seconds)
Replicate-do-db =TESTDB01 #只复制某个库
Replicate-ignore-db=mysql #不复制某个库
?
?
?
?
?
?
[Mysqld_safe]
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
?
From the configuration file:
[Email protected] ~]$ MORE/ETC/MY.CNF
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
# Disabling Symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
?
Log-bin=mysqlbin
?
Server-id = 3
Master-host = 10.0.0.9
Master-user = mysqlbak02
Master-pass = abc123!
Master-port = 3306
Master-connect-retry=60 #如果从服务器发现主服务器断掉, Reconnect time > difference (seconds)
Replicate-do-db =TESTDB01 #只复制某个库
Replicate-ignore-db=mysql #不复制某个库
?
?
?
[Mysqld_safe]
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
MySQL master master, master Slave, from config file