正如我所探讨的,Mongodb创建的日志文件是使用snapy压缩算法压缩的。但我无法解压缩这个压缩的日志文件。它会在试图解压缩时出错
Error stream missing snappy identifier
我用来解压的python代码如下:
import collections
import bson
from bson.codec_options import CodecOptions
import snappy
from cStringIO import StringIO
try:
with open('journal/WiredTigerLog.0000000011') as f:
content = f.readlines()
fh = StringIO()
snappy.stream_decompress(StringIO("".join(content)),fh)
print fh
except Exception,e:
print str(e)
pass
请帮帮我,我走不了路了
如果是这样,请使用
decompress
而不是stream_decompress
。在但如果数据根本没有被压缩:
可以工作。在
相关问题 更多 >
编程相关推荐