mysql replication(tar版)
/usr/local/mysql/bin/mysql -A
mysql>grant REPLICATION SLAVE on *.* to aax.x.x" Identified by
"xxxxxx";
mysql>FLUSH PRIVILEGES;
mysql>FLUSH TABLES WITH READ LOCK;
mysql>SHOW MASTER STATUS;
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_do_db | Binlog_ignore_db |
+-------------------+----------+--------------+------------------+
| 4a-h06-a1-bin.006 | 40003 | | |
+-------------------+----------+--------------+------------------+
要记着以上信息.
/usr/local/mysql/bin/mysqladmin shutdown
tar cvfz ../repltmp/data.tar.gz ibdata1 ib_* database
/usr/local/etc/rc.d/007mysqld.sh start
/usr/local/mysql/bin/mysql -A
mysql>UNLOCK tables;
scp ./data.tar.gz x.x.x.x
接着在DB(s)机器上/etc/my.cnf的设定。
[mysqld]
server-id = 3
log-bin
master-host=x.x.x.x
master-user=xxxx
master-password=xxxx
master-port=3306
slave-skip-errors=1007,1051
保存并退出.
/usr/local/etc/rc.d/007mysqld.sh stop
tar -zxvf /tmp/data.tar.gz -C /usr/local/mysql/var/
/usr/local/mysql/bin/mysql -A
mysql>slave stop;
mysql>CHANGE MASTER TO
>MASTER_HOST='xxxx',
>MASTER_USER='aa',
>MASTER_PASSWORD='xxxxxx',
>MASTER_LOG_FILE='4a-h06-a1-bin.006',
>MASTER_LOG_POS=40003;
mysql>slave start;
mysql>show slave status;
确认内容: 当以上作业完成后,需要检验以上作业的正确性,及是否达到预期的效果.可以通过以下方法
来进行检测.
(1)、查看Slave_IO_Running与Slave_SQL_Running的状态值是否都为Yes.
mysql>show slave status;
(2)、查看进程的状态是否正常.
mysql>show processlist;
(3)、做同步实验,进入DB(M)
mysql>use test;
mysql>update check_replication set datetime='20051128190600';
然后进入DB(s)上来查找这条数据.
mysql>use test;
mysql>select datetime from check_replication;
mysql 服务的重启
阅读(627) | 评论(0) | 转发(0) |