当前位置:网站首页> mysql主从只同步部分库或表的思路与方法
mysql主从只同步部分库或表的思路与方法
2022-06-23 14:20:00 【1024问】
同步部分数据有两个思路,1.master只发送需要的;2.slave只接收想要的。
master端:
binlog-do-db 二进制日志记录的数据库(多数据库用逗号,隔开)
binlog-ignore-db 二进制日志中忽略数据库 (多数据库用逗号,隔开)
举例说明:
1)binlog-do-db=YYY 需要同步的数据库,不在内的不同步。(不添加这行表示同步所有)
这里主库只同步test1,test2库。

2)binlog-ignore-db = mysql 这是不记录binlog,来达到从库不同步mysql库,以确保各自权限
binlog-ignore-db = performance_schema
binlog-ignore-db = information_schema
这里向从库同步时忽略test1,test2库

slave端
replicate-do-db 设定需要复制的数据库(多数据库使用逗号,隔开)
replicate-ignore-db 设定需要忽略的复制数据库 (多数据库使用逗号,隔开)
replicate-do-table 设定需要复制的表
replicate-ignore-table 设定需要忽略的复制表
replicate-wild-do-table 同replication-do-table功能一样,但是可以通配符
replicate-wild-ignore-table 同replication-ignore-table功能一样,但是可以加通配符
与上述对比,这里的replicate就很好理解了,下面简单说几点。
例如:
从库忽略复制数据库test3,但是需要说明的是,其实从库的relaylog中是从在关于test3的相关日志,只是从库没有使用罢了。


增加通配符的两个配置
replicate-wild-do-table=db_name.% 只复制哪个库的哪个表
replicate-wild-ignore-table=mysql.% 忽略哪个库的哪个表
总结
到此这篇关于mysql主从只同步部分库或表的文章就介绍到这了,更多相关mysql主从只同步部分内容请搜索软件开发网以前的文章或继续浏览下面的相关文章希望大家以后多多支持软件开发网!
边栏推荐
- 用OBS做直播推流简易教程
- RF Analyzer Demo搭建
- When I went to oppo for an interview, I got numb...
- How to make food nutrition label
- The largest IPO of Hong Kong stocks this year, with a net worth of 66billion, is the "King" sitting on the mine
- MySQL 创建和管理表
- Problems during MySQL uninstallation
- 小米为何深陷芯片泥潭?
- 腾讯云服务器发送邮件失败
- AXI_Round_Robin_Arbiter 设计 - AW、W通道部分
猜你喜欢

【深入理解TcaplusDB技术】TcaplusDB导入数据

2021-06-07

阿里 Seata 新版本终于解决了 TCC 模式的幂等、悬挂和空回滚问题

As a software testing practitioner, do you understand your development direction?

港股今年最大IPO来了,660亿身家,坐在矿山上的“大王”

An idea plug-in for automatically generating unit tests

一款自动生成单元测试的 IDEA 插件

The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars

The company has only one test, but the leader asked me to operate 1000 mobile numbers at the same time

Introduction to helm basics helm introduction and installation
随机推荐
Tencent ECS failed to send email
分布式数据库使用逻辑卷管理存储之扩容
How to ensure long-term stable operation of EDI system
AXI_ Round_ Robin_ Arbiter design - aw and W channels
How to use note taking software flowus and note for interval repetition? Based on formula template
从3开始,在业务系统中增加分页功能
[datahub] LinkedIn datahub learning notes
【二级等保】过二级等保用哪个堡垒机品牌好?
掌舵9年,艾伦研究所创始CEO光荣退休!他曾预言中国AI将领跑世界
Use of pyqt5 tool box
Test article
Thinking and Practice on Quality Standardization (suitable for product, development, testing and management post learning)
山东:美食“隐藏款”,消费“扫地僧”
[in depth understanding of tcapulusdb technology] tcapulusdb construction data
Problems during MySQL uninstallation
What is the charm of Guizhou? Why do Alibaba, Huawei and Tencent build data centers in Guizhou?
How to make food nutrition label
ICML 2022 | 上下文集成的基于transformer的拍卖设计神经网络
The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
今年英语高考,CMU用重构预训练交出134高分,大幅超越GPT3