主配置文件:
[[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 #主机标示,整数
read-only =0 #主机,读写都可以
binlog-do-db =testdb01 #需要备份数据,多个写多行
binlog-ignore-db =mysql #不需要备份的数据库,多个写多行
?
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
?
?
从配置文件:
[[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 #如果从服务器发现主服务器断掉,重新连接的时>间差(秒)
replicate-do-db =testdb01 #只复制某个库
replicate-ignore-db=mysql #不复制某个库
?
?
?
?
?
?
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
?
从从配置文件:
[[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 #如果从服务器发现主服务器断掉,重新连接的时>间差(秒)
replicate-do-db =testdb01 #只复制某个库
replicate-ignore-db=mysql #不复制某个库
?
?
?
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid