共計 1809 個字符,預(yù)計需要花費 5 分鐘才能閱讀完成。
這篇文章將為大家詳細(xì)講解有關(guān) MySQL 5.7 復(fù)制的過濾參數(shù)有哪些,文章內(nèi)容質(zhì)量較高,因此丸趣 TV 小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。
1、庫級過濾參數(shù)
–binlog-do-db=db_name Master 節(jié)點記錄二進制日志的庫
–binlog-ignore-db=db_name Master 節(jié)點不記錄二進制日志的庫
–replicate-do-db=db_name Slave 節(jié)點應(yīng)用日志的庫
–replicate-ignore-db=db_name Slave 節(jié)點不應(yīng)用日志的庫
2、表級過濾參數(shù)
–replicate-do-table=db_name.tbl_name Slave 節(jié)點執(zhí)行指定表的修改事件
–replicate-wild-do-table=db_name.tbl_name Slave 節(jié)點執(zhí)行正則中含有指定表的修改事件
–replicate-ignore-table=db_name.tbl_name Slave 節(jié)點不執(zhí)行指定表的修改事件
–replicate-wild-ignore-table=db_name.tbl_name Slave 節(jié)點不執(zhí)行正則中含有指定表的修改事件
MySQL 里面有啟動參數(shù)、系統(tǒng)參數(shù),啟動參數(shù)通過 show variables 無法查詢到,可以在 mysqld 的選項中查到
例如關(guān)于二進制日志有 Startup Options Used with Binary Logging、System Variables Used with Binary Logging 兩種參數(shù)
上面所說的復(fù)制過濾參數(shù)均為啟動參數(shù)
設(shè)置參數(shù)
[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
啟動數(shù)據(jù)庫后,查看參數(shù)
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)
關(guān)于 MySQL 5.7 復(fù)制的過濾參數(shù)有哪些就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。