這篇文章將為大家詳細(xì)講解有關(guān)MySQL 5.7 復(fù)制的過濾參數(shù)有哪些,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。
創(chuàng)新互聯(lián)建站主要從事成都做網(wǎng)站、網(wǎng)站設(shè)計、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)盤錦,10年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):028-869222201、庫級過濾參數(shù)
--binlog-do-db=db_name Master節(jié)點記錄二進(jìn)制日志的庫
--binlog-ignore-db=db_name Master節(jié)點不記錄二進(jìn)制日志的庫
--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)于二進(jì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é)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。