从mysql中的master复制一张slave上的表 [英] Replicate just one table on slave from master in mysql

查看:61
本文介绍了从mysql中的master复制一张slave上的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以只将一个表从主数据库复制到从数据库?例如,我的主数据库名称是 master.db,有四个表,而我的 slave.db 上没有表.我只想从我的主数据库复制我的从属数据库中的一张表.如何配置 master 和 slave my.cnf 文件来实现这一点?我应该在主从的 my.cnf 文件中添加哪些额外参数?

Is it possible to replicate only a single table from master DB to slave DB? For example my master DB name is master.db with four tables and on my slave.db there is no table. I want to replicate only one table on my slave from my master DB. How can I configure master and slave my.cnf files to achieve this? What extra parameters should I add in my.cnf files for both master and slave?

注意:master DB有多个slave,这个slave DB就是其中之一.

Note: The master DB has multiple slaves, this slave DB is one of them.

推荐答案

你应该调查像 replicate_do_table=yourtable 在你的 slave my.cnf 文件中的参数

You should investigate parameters like replicate_do_table=yourtablein your slave my.cnf file

http:///dev.mysql.com/doc/refman/5.6/en/replication-options

这基本上告诉数据库只复制某些表.还有通配符选项.不过请仔细阅读,因为根据您的设置有一些注意事项.

This basically tells the database to only replicate certain tables. There are also options for wildcards. Read it carefully though as there are certain caveats depending on your setup.

这篇关于从mysql中的master复制一张slave上的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆