我正在使用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文件名?如果没有,是否有从日志中上次读取位置恢复的建议?
1条答案
按热度按时间atmip9wb1#
可通过
stream.log_file
访问当前日志文件