分类: Mysql/postgreSQL
2013-03-12 17:09:31
配置主从数据库
环境:
Master:
192.168.212.136
系统:centos5.8
数据库:percona-server mysql5.5.29
Slave: 192.168.212.206
系统:centos5.8
数据库:percona-server mysql5.5.29
1. 数据库的安装在此省略。
2. Maser主机配置
修改配置文件my.cnf,打开bin-log 日志。
[mysqld]
server-id = 1
sync_binlog =1
innodb_flush_log_at_trx_commit = 1
innodb_support_xa =1
在Master上创建复制账号:
replication slave,replication client on *.* to 'repl'@'192.168.212.206' identified by 'p@ssw0rd';
3. Slave主机配置
[mysqld]
server-id = 11
relay_log =/data1/mysql/relay_log
log_slave_updates =1
read_only =1
slave-skip-errors =all
replicate-wild-ignore-table =mysql.%
replicate-wild-ignore-table =test.%
replicate-wild-ignore-table =log.%
replicate-wild-ignore-table =information_schema.%
replicate-wild-ignore-table =performance_schema.%
4. 查看Master数据库状态
Show master status;
5. 在Slave上进行同步
change master to
master_host='192.168.212.136',
master_user='repl',
master_password='p@ssw0rd',
master_log_file='mysql-bin.000007',
master_log_pos=107;
6. 查看Slave状态
打开slave
Slave start;
Show slave stasue\G