我的任务是在从主机上设置复制。主数据库是一个“数据存储”,每天删除、重新创建和重新加载表。
通过复制,我最初的从主机设置运行良好,总是落后于主服务器。在与“数据存储”的用户交谈后,我意识到并不是所有的数据库和表都需要复制。所以这就是我所做的
CI-DB002-PRD [root@localhost] ON (none)> STOP SLAVE\G
CI-DB002-PRD [root@localhost] ON (none)> CHANGE REPLICATION FILTER REPLICATE_DO_DB = (bidw,cf2_fact,ct_fact,ez_fact,gt_fact,sfdc,soa_fact,tesla_fact,tmc_fact);
CI-DB002-PRD [root@localhost] ON (none)> CHANGE REPLICATION FILTER REPLICATE_WILD_DO_TABLE = ('bidw.domo%', 'bidw.consolidated%', 'bidw.cf2%', 'bidw.tesla%');
CI-DB002-PRD [root@localhost] ON (none)> START SLAVE\G很快,复制就赶上了,现在,从服务器落后于主服务器3-7秒.
但是复制没有触及我想要被复制的数据库。尽管我上面列出的模式每10分钟就会发生一次主数据的变化。我做了几次验证查询,结果现在不同了。当我检查我的奴隶的身份时,没有什么特别的。
CI-DB002-PRD [root@localhost] ON (none)> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Queueing master event to the relay log
Master_Host: 10.239.0.34
Master_User: ci02replicadb
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binary-log.009871
Read_Master_Log_Pos: 14678596
Relay_Log_File: ci-db002-prd-relay-bin.007914
Relay_Log_Pos: 814824
Relay_Master_Log_File: binary-log.009871
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: bidw,cf2_fact,ct_fact,ez_fact,gt_fact,sfdc,soa_fact,tesla_fact,tmc_fact,staging,phoenix,data_science
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table: bidw.domo%,bidw.consolidated%,bidw.cf2%,bidw.tesla%,bidw.ez%,bidw.ct%,bidw.gt%,bidw.tmc%,bidw.did%,bidw.Shortened%,bidw.other_revenue%,bidw.revenue%,bidw.advanced_cohort%
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 814626
Relay_Log_Space: 14679056
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 22
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: a485ab14-aa57-11ea-bef5-42010aef0022
Master_Info_File: /data/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Reading event from the relay log
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.01 sec)对于"Replicate_Wild_Do_Table",我只复制其中列出的表,因为整个"bidw“数据库都充斥着垃圾表。
我在这里错过了什么?我不能同时使用两个过滤器吗?我在5.7.31版。
发布于 2020-08-11 13:27:44
(dba.stackexchange.com可能是个更好的问号。)
有些事情需要尝试:
replicate_do_db移到Replicate_Wild_Do_Table列表中。(当混合各种replicate...选项时,可能会发生奇怪的事情。)https://serverfault.com/questions/1029528
复制相似问题