What tool can be used to view TiDB Binlog?

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

Original topic: tidb binlog 用什么工具查看呀

| username: 箱子NvN

[root@localhost binlog]# mysqlbinlog binlog-0000000000000000-20220718021524
/!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1/;
/!40019 SET @@session.max_insert_delayed_threads=0/;
/!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0/;
DELIMITER /!/;
ERROR: File is not a binary log file.
DELIMITER ;

End of log file

ROLLBACK /* added by mysqlbinlog /;
/
!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0/;

| username: 啦啦啦啦啦 | Original post link

Use Reparo, refer to this link:

| username: 箱子NvN | Original post link

Thank you, boss :laughing:

| username: 箱子NvN | Original post link

Follow-up question:
Can this directly view the binlog file? Is it possible that I’m using it incorrectly?

| username: 啦啦啦啦啦 | Original post link

We haven’t enabled binlog, so it’s not easy to test. I feel that -log-file is the output log file. Try using the parameters -data-dir, -start-datetime, and -stop-datetime.

| username: 箱子NvN | Original post link

The previous reply measured -log-file and -data-dir in the image.


The error reported is failed: read binlog file name error: dir.
The file should be correct.

| username: 啦啦啦啦啦 | Original post link

Judging by the error, it seems you need to provide the folder name.
Try using the parameters mentioned in this post:

image

| username: 箱子NvN | Original post link

Indeed, it worked after the change. Thank you, master!!!

| username: ablewang_xiaobo | Original post link

It is possible to view the extracted binlog files.

| username: TiDBer_h9um7nOg | Original post link

Got it!

| username: cs58_dba | Original post link

The compatibility of mysqlbinlog is indeed not very good.

| username: 箱子NvN | Original post link

I output the binlog to a file to view its content. You can use reparo -data-dir /path/to/binlog/directory and optionally add time filters with -start-datetime and -stop-datetime.

| username: 箱子NvN | Original post link

Yes, it will report an error and cannot be used. :rofl:

| username: cs58_dba | Original post link

It indicates that TiDB has indeed made modifications to the underlying logs.

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.