Mysql:如何在使用复制脱机后同步数据库?

时间:2011-10-31 16:18:22

标签: mysql replication master slave

我在两台计算机之间创建了一个复制(我用来在我的数据库中添加新数据的笔记本电脑和保存我在笔记本电脑上所做的一切的服务器),它运行正常。 但今天,我的笔记本电脑在线,所以我无法更新我的服务器。 结果:我更新了一些行,我创建了很多行,当我的笔记本电脑重新上线时,复制不适用于我一直在离线工作的数据。

在我没有连接时,有人可以给我一个建议来更新笔记本电脑上修改过的数据(在服务器上)吗?我不明白为什么它不起作用!

谢谢!

更新:这是我的展示奴隶状态:

    mysql> show slave status;
+----------------------------------+-------------+-------------+-------------+--
-------------+------------------+---------------------+-------------------------
---+---------------+-----------------------+------------------+-----------------
--+-----------------+---------------------+--------------------+----------------
--------+-------------------------+-----------------------------+------------+--
----------+--------------+---------------------+-----------------+--------------
---+----------------+---------------+--------------------+--------------------+-
-------------------+-----------------+-------------------+----------------+-----
------------------+-------------------------------+---------------+-------------
--+----------------+----------------+-----------------------------+-------------
-----+
| Slave_IO_State                   | Master_Host | Master_User | Master_Port | C
onnect_Retry | Master_Log_File  | Read_Master_Log_Pos | Relay_Log_File
   | Relay_Log_Pos | Relay_Master_Log_File | Slave_IO_Running | Slave_SQL_Runnin
g | Replicate_Do_DB | Replicate_Ignore_DB | Replicate_Do_Table | Replicate_Ignor
e_Table | Replicate_Wild_Do_Table | Replicate_Wild_Ignore_Table | Last_Errno | L
ast_Error | Skip_Counter | Exec_Master_Log_Pos | Relay_Log_Space | Until_Conditi
on | Until_Log_File | Until_Log_Pos | Master_SSL_Allowed | Master_SSL_CA_File |
Master_SSL_CA_Path | Master_SSL_Cert | Master_SSL_Cipher | Master_SSL_Key | Seco
nds_Behind_Master | Master_SSL_Verify_Server_Cert | Last_IO_Errno | Last_IO_Erro
r | Last_SQL_Errno | Last_SQL_Error | Replicate_Ignore_Server_Ids | Master_Serve
r_Id |
+----------------------------------+-------------+-------------+-------------+--
-------------+------------------+---------------------+-------------------------
---+---------------+-----------------------+------------------+-----------------
--+-----------------+---------------------+--------------------+----------------
--------+-------------------------+-----------------------------+------------+--
----------+--------------+---------------------+-----------------+--------------
---+----------------+---------------+--------------------+--------------------+-
-------------------+-----------------+-------------------+----------------+-----
------------------+-------------------------------+---------------+-------------
--+----------------+----------------+-----------------------------+-------------
-----+
| Waiting for master to send event | ***.***.***.*** | masterRepli |        3306 |
          60 | mysql-bin.000027 |              454717 | aofr19072-relay-bin.0000
02 |          1227 | mysql-bin.000027      | Yes              | Yes
  |                 |                     |                    |
        |                         |                             |          0 |
          |            0 |              454717 |            1387 | None
   |                |             0 | No                 |                    |
                   |                 |                   |                |
                0 | No                            |             0 |
  |              0 |                |                             |
   2 |
+----------------------------------+-------------+-------------+-------------+--
-------------+------------------+---------------------+-------------------------
---+---------------+-----------------------+------------------+-----------------
--+-----------------+---------------------+--------------------+----------------
--------+-------------------------+-----------------------------+------------+--
----------+--------------+---------------------+-----------------+--------------
---+----------------+---------------+--------------------+--------------------+-
-------------------+-----------------+-------------------+----------------+-----
------------------+-------------------------------+---------------+-------------
--+----------------+----------------+-----------------------------+-------------
-----+
1 row in set (0.00 sec)

2 个答案:

答案 0 :(得分:6)

BRUTE FORCE SYNC

I wrote out a detailed description on how to resync a Slave to its Master in a Circular Replication setup

PRECISION STRIKE SYNC

如果您只想查找差异并仅更新差异,you must use mk-table-checksum and mk-table-sync

试一试!!!

答案 1 :(得分:2)

从服务器是否可能没有运行从属进程?

通过在从属设备上的MySQL命令提示符下键入SHOW SLAVE STATUS;来查看从属进程是否正在运行。

然后尝试使用START SLAVE;

启动它

如果它仍然无效,请发布SHOW SLAVE STATUS;命令的输出,我们会尽力帮助您:)