* MySQL Replication默认都是异步(asynchronous),当主库在执行完一些事务后,是不会管备库的进度的。如果备库不幸落后,而更不幸的是主库此时又出现Crash(例如宕机),这时备库中的数据就是不完整的。简而言之,在主库发生故障的时候,我们无法使用备库来继续提供数据一致的服务了。
mysql> update mytest.users set name='seasea' where id = 3; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from mytest.users; +----+--------+-----+-----+ | id | name | sex | age | +----+--------+-----+-----+ | 1 | tom | M | 24 | | 2 | jak | F | 32 | | 3 | seasea | M | 35 | | 4 | lisea | M | 29 | | 5 | test | M | 42 | +----+--------+-----+-----+ 5 rows in set (0.00 sec) * slave上查看
mysql> select * from mytest.users; +----+--------+-----+-----+ | id | name | sex | age | +----+--------+-----+-----+ | 1 | tom | M | 24 | | 2 | jak | F | 32 | | 3 | seasea | M | 35 | | 4 | lisea | M | 29 | | 5 | test | M | 42 | +----+--------+-----+-----+ 5 rows in set (0.00 sec) 6. 总结