日期:2014-05-16 浏览次数:20960 次
主库相关操作 从库相关操作 1.将主库数据库文件copy到从库中 Slave_IO_Running:?Yes 验证方法二:
1.flush tables with read lock;??? //主库上锁表
2.show master status;?? //记录 master log file及file position
比如:
+--------------------------+----------------+-------------------+------------------------+
| File??????????????????? ????? | Position?????? | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------------------+----------------+--------------------+-----------------------+
| xxxx-log.000031???? | 199039244???? | xxxx?????????????? ??? |?????????????????????????? ?? |?
+--------------------------+----------------+--------------------+-----------------------+
3.$tar -cvf database.tar ./data?? //备份数据文件
4.unlock tables;?? //解锁主库表
2.启动从库
3.stop slave;
4.reset slave;
5.change master to master_host='10.xx.xx.xxx,master_user='xxxx',master_password='xxxx',master_port=xxxx,master_log_file='xxxx-log.000031',master_log_pos=199039244;?
5.start slave;
验证方法一:
//登陆从库
slave status\G;
Slave_SQL_Running:?Yes
上面2项都为'Yes',表示slave正常
//登陆主库
show processlist;
Has read all relay log; waiting for the slave I/O thread to update it?
表示正常