How to write the configuration file for synchronizing n tables from TiDB to Kafka?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb同步n张表到kafka,配置文件该怎么写?

| username: TiDBer_5GvAkLi0

【TiDB Usage Environment】Testing
【TiDB Version】v5.4.1
【Encountered Problem】
Some tables in the TiDB sync database are being synchronized, but it was found that other tables that do not need to be synchronized are also being synchronized!
The configuration file is written as follows! Could you please point out where the configuration might be incorrect?

| username: db_user | Original post link

For the rules, you can add “!non-synchronized tables” at the end, for example:
rules = [‘.’, ‘!test.']
rules = ['a.
’, ‘!a.abc’]

| username: TiDBer_5GvAkLi0 | Original post link

Thank you for the explanation! But this database has 150 tables! I only need to sync about 10 tables. Do I have to write down all the remaining tables? rules = [‘siteadmin.*’, !siteadmin.write the remaining 100+ tables that do not need to be synced]

| username: HACK | Original post link

Just write the tables to be synchronized in the rules, and remove the exclamation mark.

| username: db_user | Original post link

Yes, just write the synchronized tables like this:
rules = [‘a.b’, ‘!a.c’, ‘a.d*’]

| username: TiDBer_5GvAkLi0 | Original post link

Got it! Thanks for the guidance! It means to list all the tables that need to be synchronized.

| username: db_user | Original post link

You’re welcome, this should work.