开发者

Replicate a single table

Is it开发者_运维知识库 possible to replicate a single table?


Yes this is possible. Have a look at the slave options of the MySQL manual. This still requires to create a complete binlog of the whole database though.


To sync specific tables again to one or more slaves rather use pt-table-checksum and then pt-table-sync

That should automatically identify the out-of-sync tables and only sync those.


I know this is an old question but this is for anyone who comes here looking for an answer:

CREATE TABLE table2 LIKE table1;

This will create a table with the same format and columns but no data. To transfer the data use:

INSERT INTO table2 SELECT * FROM table1;

EDIT:

It is important to note that this is an information transfer only. Meaning if you had indexes on table1 they are not transferred to table2. You will have to manually index table2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜