Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

本地模式只解析了首个binlog,没有连续解析的疑问。 #19

Open
shengminjie opened this issue Oct 29, 2022 · 2 comments
Open

Comments

@shengminjie
Copy link

bingo2sql --start-file=mysql-bin.004097 --stop-file=mysql-bin.004152 -t /home/work/table.sql > x.sql
不管是只用了--start-file还是--start-file和--stop-file都用了,都只解析出了第一个binlog里的内容,后面的都没有解析,请问是哪里姿势不对。
测试过用=号、用空格,也测试了相对路径、绝对路径,都还是一样。

thanks

@shengminjie
Copy link
Author

又测了一次,确实是啊。离线模式不能用stop-file指定结束binlog进行连续解析。暂且用python循环嵌套了一层逐个解析……

@shengminjie
Copy link
Author

分享python嵌套连续逐个解析的简单代码:
`# -- coding:utf-8 --
import subprocess

def createProcess(cmd):
p = subprocess.Popen(
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
result = p.stdout.read().decode("utf8")
code = p.wait()
if code:
return code, result
else:
return code, result

start = int('start binlog num')
stop = int('stop binlog num')
for number in range(start, stop):
print(number)
command="bingo2sql --start-file=/dir/mysql-bin.0{} --minimal-update=false --sql-type=delete -t table_name.sql -B >> /tmp/result_1.sql".format(number)
runcmd = createProcess(command)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant