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

【从大坑中爬出】mysql 将 slave 转为 master

时间:2014-10-09 03:33:58      阅读:286      评论:0      收藏:0      [点我收藏+]

标签:mysql   master   slave   

一、查看日志应用状态

mysql> show processlist;
+----+------+---------------+-------+-------------+------+-----------------------------------------------------------------------+------------------+-----------+---------------+
| Id | User | Host          | db    | Command     | Time | State                                                                 | Info             | Rows_sent | Rows_examined |
+----+------+---------------+-------+-------------+------+-----------------------------------------------------------------------+------------------+-----------+---------------+
|  5 | root | localhost     | ifree | Sleep       | 2250 |                                                                       | NULL             |         0 |             0 |
| 17 | rep  | testdb2:41690 | NULL  | Binlog Dump | 2400 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL             |         0 |             0 |
| 19 | root | localhost     | NULL  | Query       |    0 | init                                                                  | show processlist |         0 |             0 |
+----+------+---------------+-------+-------------+------+-----------------------------------------------------------------------+------------------+-----------+---------------+
3 rows in set (0.00 sec)

(其实我也没看懂。。。)

二、修改/etc/my.cnf(参考master配置,此处祭出师父blog,略)

http://debugo.com/mysql-5-6-master-slave/

三、停slave,关掉只读

    1.停slave

mysql> stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)

    2.关只读

mysql> set global read_only=0;
Query OK, 0 rows affected (0.00 sec)

    3.重置slave

mysql> reset slave;
Query OK, 0 rows affected (0.01 sec)

四、如果未生效则重启下mysql进程试试


参考:http://blog.itpub.net/758322/viewspace-714346



【从大坑中爬出】mysql 将 slave 转为 master

标签:mysql   master   slave   

原文地址:http://bananalighter.blog.51cto.com/6386339/1561271

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