用python-mysql-replication确定当前的binlog文件

4sup72z8  于 2023-04-10  发布在  Mysql
关注(0)|答案(1)|浏览(119)

我正在使用python-mysql-replication包来使用MySQL binlog。当前的binlog位置可以访问,如下所示,但我无法访问当前的binlog文件,如果我想重新启动进程并从最后一个位置继续,我需要它。

stream = BinLogStreamReader(
    connection_settings=mysql_connection,
    server_id=server_id,
    blocking=True,
    resume_stream=True,
    only_events=[DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent],
)

print('Current position:', binlogevent.packet.log_pos)

是否通过此API提供了特定事件的binlog文件名?如果没有,是否有从日志中上次读取位置恢复的建议?

atmip9wb

atmip9wb1#

可通过stream.log_file访问当前日志文件

相关问题