发表于 2018-10-5 06:24:42

MySQL一主二从复制环境切换主从库

mysql> show processlist;  +----+------+---------------------+------+-------------+------+---------------------------------------------------------------+------------------+

  |>  +----+------+---------------------+------+-------------+------+---------------------------------------------------------------+------------------+
  |2 | root | localhost         | NULL | Query       |    0 | starting                                                      | show processlist |
  |3 | repl | 192.168.1.112:49819 | NULL | Binlog Dump |207 | Master has sent all binlog to slave; waiting for more updates | NULL             |
  |4 | repl | 192.168.1.111:53017 | NULL | Binlog Dump |165 | Master has sent all binlog to slave; waiting for more updates | NULL             |
  +----+------+---------------------+------+-------------+------+---------------------------------------------------------------+------------------+
  3 rows in set (0.00 sec)
  mysql> select * from test.t_repl;
  +------+-------+---------------------+

  |>  +------+-------+---------------------+
  |    1 | Alen| 2018-03-04 17:56:57 |
  |    2 | Repl| 2018-03-04 20:10:45 |
  |    3 | USA   | 2018-03-04 22:19:48 |
  |    4 | China | 2018-03-04 22:19:48 |
  |    5 | Japan | 2018-03-04 22:23:28 |
  |    6 | UK    | 2018-03-04 22:23:28 |
  +------+-------+---------------------+
  6 rows in set (0.00 sec)
  mysql> insert into t_repl(id,name) values(7,'Jacky'),(8,'Tom');
  Query OK, 2 rows affected (0.03 sec)
  Records: 2Duplicates: 0Warnings: 0
  mysql>

页: [1]
查看完整版本: MySQL一主二从复制环境切换主从库