MySQL 5.7 复制的过滤参数有哪些

42次阅读
没有评论

共计 1809 个字符,预计需要花费 5 分钟才能阅读完成。

这篇文章将为大家详细讲解有关 MySQL 5.7 复制的过滤参数有哪些,文章内容质量较高,因此丸趣 TV 小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

1、库级过滤参数

–binlog-do-db=db_name Master 节点记录二进制日志的库

–binlog-ignore-db=db_name Master 节点不记录二进制日志的库

–replicate-do-db=db_name Slave 节点应用日志的库

–replicate-ignore-db=db_name Slave 节点不应用日志的库

2、表级过滤参数

–replicate-do-table=db_name.tbl_name Slave 节点执行指定表的修改事件

–replicate-wild-do-table=db_name.tbl_name Slave 节点执行正则中含有指定表的修改事件

–replicate-ignore-table=db_name.tbl_name Slave 节点不执行指定表的修改事件

–replicate-wild-ignore-table=db_name.tbl_name Slave 节点不执行正则中含有指定表的修改事件

MySQL 里面有启动参数、系统参数,启动参数通过 show variables 无法查询到,可以在 mysqld 的选项中查到
例如关于二进制日志有 Startup Options Used with Binary Logging、System Variables Used with Binary Logging 两种参数
上面所说的复制过滤参数均为启动参数

设置参数
[root@localhost log]# mysqld –verbose –help 02.txt
[root@localhost log]# vim 02.txt
..
  –binlog-do-db=name Tells the master it should log updates for the specified
  database, and exclude all others not explicitly
  mentioned.
..
  –binlog-ignore-db=name
  Tells the master that updates to the given database
  should not be logged to the binary log.
..
  –replicate-do-table=name
  Tells the slave thread to restrict replication to the
  specified table. To specify more than one table, use the
  directive multiple times, once for each table. This will
  work for cross-database updates, in contrast to
  replicate-do-db.
[root@localhost log]# vim /etc/my.cnf
..
# log
server-id = 10000
log-bin = /log/binlog/mysql-bin
binlog_format = MIXED
binlog-do-db = test

启动数据库后,查看参数
mysql show master status;
+——————+———-+————–+——————+——————-+
| File  | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+——————+———-+————–+——————+——————-+
| mysql-bin.000009 |  120 | test  |  |  |
+——————+———-+————–+——————+——————-+
1 row in set (0.03 sec)

关于 MySQL 5.7 复制的过滤参数有哪些就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-19发表,共计1809字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)