工作,学习,生活,这里将会有一些记录. 备用域名:http://meisw.51099.com 注册 | 登陆

mysql热备

http://database.51cto.com/art/200510/8434.htm
http://imysql.cn/node/56
http://yemaosheng.com/?p=86


setup

要求mysql的版本比较接近

master my.cnf
[mysqld]
log-bin
server-id=1

master
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%.mydomain.com' IDENTIFIED BY 'slavepass';

restart mysql;

FLUSH TABLES WITH READ LOCK;

tar zcvf mysql-snapshot.tar.gz .

cp tar.gz to slave

tar zxvf tar.gz

show master status;

UNLOCK TABLES;

slave my.cnf
[mysqld]
server-id=slave_id

slave
CHANGE MASTER TO MASTER_HOST='master_host_name',MASTER_USER='replication_user_name',MASTER_PASSWORD='replication_password',MASTER_LOG_FILE='recorded_log_file_name',MASTER_LOG_POS=recorded_log_position;

start slave;

 

« 上一篇 | 下一篇 »

Trackbacks

点击获得Trackback地址,Encode: UTF-8

1条记录访客评论

如果发现多次报错均可略过的话,可以设置一下 --slave-skip-errors ,直接略过多种错误代码

set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

Post by admin on 2009, May 7, 10:51 AM 引用此文发表评论 #1


发表评论

评论内容 (必填):