首页 > 代码库 > 【从大坑中爬出】mysql 将 slave 转为 master
【从大坑中爬出】mysql 将 slave 转为 master
一、查看日志应用状态
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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。