码迷,mamicode.com
首页 > 数据库 > 详细

MySQL主主、主从、从从配置文件

时间:2016-03-03 12:51:32      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:

主配置文件:

[root@sun01 ~]# 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

?

?

从配置文件:

[root@sun02 ~]# 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

?

从从配置文件:

[root@sun03 ~]$ 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

MySQL主主、主从、从从配置文件

标签:

原文地址:http://www.cnblogs.com/fayong/p/5238060.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!