Can TIDB generate binlog same as mysql?

I have a service that reads binlog from MySQL and updates data in the MongoDB database accordingly.
I want to replace MySQL with TiDB so I need to ensure that I will be able to connect my service to TiDB to read binlog. I’ve checked TiDB Binlog documentation, but it looks like it pushes updates to the downstream database, which is not the same as MySQL binlog works, or I am wrong?

Yes, TiDB can generate binlog similar to MySQL. TiDB follows a similar approach to MySQL in terms of writing binlog. In TiDB, each successful transaction will generate two binlog entries: a Prewrite binlog and a Commit binlog . The Prewrite binlog records the changes made during the prewrite phase of the transaction, while the Commit binlog records the changes made during the commit phase .

To connect your service to TiDB and read binlog, you can use the TiDB Binlog feature. TiDB Binlog writes binlog to downstream systems, such as Kafka or MySQL, which can then be consumed by your service to update data in the MongoDB database accordingly . You can configure TiDB Binlog to push binlog updates to the downstream system of your choice.

By using TiDB Binlog, you can replace MySQL with TiDB and still achieve the same functionality of reading binlog and updating data in the MongoDB database.

I will rephrase my question, can I configure the mysql instance to run as Slave(pull binlog) from TiDB?

Sorry, I have no idea about it, let's try another question.

Yes, TiDB Binlog is the tool you are looking for, refer to the documentation.

However, note that TiDB Binlog is not compatible with certain features introduced in TiDB v5.0 and cannot be used together with them. For more information, please see the Notes. It is recommended to use TiCDC instead of TiDB Binlog.

Hi, Eugen, you can use TiCDC to pull change feed from TiDB to MySQL, please refer to this doc: Replicate Data to MySQL-compatible Databases | PingCAP Docs

But TiCDC pushes data to Mysql, so it means that I still need to set up downstream Mysql with enabled binlog, sync data to it with TiCDC and connect my tool to MySQL to read changes from binlog, correct ?

Yes that seems correct.

TiCDC can send data to MySQL or TiDB via the MySQL protocol. It can also write to Kafka. So you could setup TiCDC to read from TiDB and write to Kafka and then have a kafka consumer do what you need to do (update MongoDB right?).

yes, update mongo. So anyway need to rewrite the service. Okay. Thank you.