Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: cdc 不同步数据
【TiDB Usage Environment】Production Environment or Test Environment or POC
【TiDB Version】
【Encountered Problem】
Cluster Version: 4.0.6
After setting up CDC, data inserted into the upstream table is not found in the downstream query. I don’t know where the problem is.
Below is my configuration process:
- Create database and table upstream
create database cdcdb;
use cdcdb;
create table test(id int not null primary key, name varchar(100));
- Create database and table downstream
create database cdcdb;
use cdcdb;
create table test(id int not null primary key, name varchar(100));
- Add replication user to downstream database
mysql> create user ‘root’@‘xxx.xxx.xxx.136’ identified by ‘admin’;
Query OK, 0 rows affected (0.03 sec)
mysql> grant all on . to ‘root’@‘xxx.xxx.xxx.136’;
Query OK, 0 rows affected (0.02 sec)
Test, can connect from upstream to downstream database!
[tidb@TIDBjsjdsjkxt01 ~]$ /home/tidb/tidb_init/mysql-5.7.26-el7-x86_64/bin/mysql -h xxx.xxx.xxx.128 -uroot -P 4000 -p
-
Create sync task without configuration file
[tidb@TIDBjsjdsjkxt01 ~]$ cdc cli changefeed create --pd=http://xxx.xxx.xxx.136:2379 --sink-uri=“tidb://root:admin@xxx.xxx.xxx.128:4000/” --changefeed-id=“cdc2” --sort-engine=“unified”
[WARN] some tables are not eligible to replicate, model.TableName{model.TableName{Schema:“dbs”, Table:“t4”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“g4”, TableID:0, IsPartition:false}, model.TableName{Schema:“zjp”, Table:“zjps”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“yf10.29”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“t22”, TableID:0, IsPartition:false}, model.TableName{Schema:“gpxtest”, Table:“zhang100”, TableID:0, IsPartition:false}, model.TableName{Schema:“zjp”, Table:“test”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“g6”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“g2”, TableID:0, IsPartition:false}, model.TableName{Schema:“gpxtest”, Table:“t1”, TableID:0, IsPartition:false}, model.TableName{Schema:“gpxtest”, Table:“guo001”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“bbb”, TableID:0, IsPartition:false}, model.TableName{Schema:“zjp”, Table:“seq_test”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“t33”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“t01”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“yftest1”, TableID:0, IsPartition:false}, model.TableName{Schema:“gpxtest”, Table:“guo004”, TableID:0, IsPartition:false}, model.TableName{Schema:“dbs”, Table:“t2”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“t2”, TableID:0, IsPartition:false}, model.TableName{Schema:“gpxtest”, Table:“guo002”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“g5”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“zhang100”, TableID:0, IsPartition:false}, model.TableName{Schema:“zjp”, Table:“time”, TableID:0, IsPartition:false}, model.TableName{Schema:“gpxtest”, Table:“zhang1001”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“yftest”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“ee”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“g3”, TableID:0, IsPartition:false}, model.TableName{Schema:“dbs”, Table:“t3”, TableID:0, IsPartition:false}, model.TableName{Schema:“zjp”, Table:“zhang2”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“t333”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“g7”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“a”, TableID:0, IsPartition:false}, model.TableName{Schema:“gpxtest”, Table:“guo003”, TableID:0, IsPartition:false}, model.TableName{Schema:“zjp”, Table:“t2”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“g1”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“test”, TableID:0, IsPartition:false}, model.TableName{Schema:“dbs”, Table:“t5”, TableID:0, IsPartition:false}, model.TableName{Schema:“zjp”, Table:“seq_zjp”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“backup_status”, TableID:0, IsPartition:false}, model.TableName{Schema:“test”, Table:“zhang”, TableID:0, IsPartition:false}}
Could you agree to ignore those tables, and continue to replicate [Y/N]
Y
Create changefeed successfully!
ID: cdc2
Info: {“sink-uri”:“tidb://root:admin@xxx.xxx.xxx.128:4000/”,“opts”:{},“create-time”:“2022-06-22T11:24:42.813427811+08:00”,“start-ts”:434075935120556033,“target-ts”:0,“admin-job-type”:0,“sort-engine”:“unified”,“sort-dir”:“.”,“config”:{“case-sensitive”:true,“enable-old-value”:false,“filter”:{“rules”:[“.”],“ignore-txn-start-ts”:null,“ddl-allow-list”:null},“mounter”:{“worker-num”:16},“sink”:{“dispatchers”:null,“protocol”:“default”},“cyclic-replication”:{“enable”:false,“replica-id”:0,“filter-replica-ids”:null,“id-buckets”:0,“sync-ddl”:false},“scheduler”:{“type”:“table-number”,“polling-time”:-1}},“state”:“normal”,“history”:null,“error”:null} -
Query sync status
[tidb@TIDBjsjdsjkxt01 ~]$ cdc cli changefeed list --pd=http://xxx.xxx.xxx.136:2379
[
{
“id”: “cdc2”,
“summary”: {
“state”: “normal”,
“tso”: 434075935120556033,
“checkpoint”: “2022-06-22 11:24:42.778”,
“error”: null
}
}
] -
Insert test data, no data found downstream.
No error information found in the relevant CDC logs, please see the attachment.
cdc.log (9.9 KB)
【Reproduction Path】What operations were performed to cause the problem
【Problem Phenomenon and Impact】
【Attachment】
Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.