MySQL主从切换
来源:互联网 发布:飞凡 嵌入式淘宝网 编辑:程序博客网 时间:2024/06/05 03:19
参考上一篇博客 MySQL主从同步http://blog.csdn.net/juded/article/details/54600294
从库状态确认
确保从库执行完了relay log更新后,停止IO_THREAD线程。
mysql> show slave status\G*************************** 1. row *************************** Slave_IO_State: Waiting for master to send event ........... Slave_IO_Running: Yes Slave_SQL_Running: Yes ........... Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O ...........
停止从库IO_THREAD线程
mysql> stop slave io_thread;Query OK, 0 rows affected (0.06 sec)
从库上升为主库
mysql> grant replication slave on *.* to 'repl'@'%' identified by 'repl';mysql> stop slave;Query OK, 0 rows affected (0.01 sec)mysql> reset master;Query OK, 0 rows affected (0.06 sec)mysql> reset slave all;mysql>show slave status\GEmpty set (0.00 sec)mysql>show master status;+------------------+----------+--------------+------------------+| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |+------------------+----------+--------------+------------------+| mysql-bin-2.000001 | 639| db1,db2 | |+------------------+----------+--------------+------------------+
reset slave all 命令会删除从库的 replication 参数,之后 show slave status\G 的信息返回为空。
主库上升为从库
mysql> change master to -> master_host='192.168.2.94', -> master_port=3306, -> master_user='repl', -> master_password='repl', -> master_log_file='mysql-bin-2.000001', -> master_log_pos=639;Query OK, 0 rows affected, 2 warnings (0.34 sec)mysql> start slave;Query OK, 0 rows affected (0.04 sec)
0 0
- mysql主从备份切换
- Mysql+keepalived主从切换
- mysql主从数据库切换
- mysql主从切换步骤
- mysql主从切换
- mysql主从切换
- MYSQL主从切换
- mysql 主从服务器 切换
- mysql 主从切换
- mysql 主从切换
- MySQL主从切换步骤。
- mysql主从切换步骤
- MySQL主从切换
- mysql主从手动切换
- mysql主从切换步骤
- Mysql之主从切换
- MySQL主从切换
- mysql 主从切换
- Android应用中使用及实现系统“分享”接口
- 最短路的方法总结
- TensorFlow12: 判断男声女声
- xshell无法使用小键盘区输入数字
- bug之旧项目
- MySQL主从切换
- 米洛个人修炼术:导致上班累成狗的三大主因
- 在mac上编译lame
- CSRF(跨站请求伪造攻击)漏洞详细说明
- 测试的道理
- 前后台交互积累(一)
- bootstrap——css样式(二、排版)
- RDD依赖关系解密
- perl 模拟curl put请求