如何清理 MemcacheQ db 文件?

如何清理 MemcacheQ db 文件?

我的 MemcacheQ 启动如下:

memcacheq -d -r -H /db/baamboo -N -R -L 2048 -T 300 -l 192.168.6.29 -p 22211 -u memcacheq -t 8 -m 512 -P /var/run/baamboo.pid -v

它正在占用硬盘空间。发现主题由 Google 提供,但我检查了帮助页面:该-e选项有其他含义:

-e <num>      percent of the pages in the cache that should be clean, default is 60%

作为标记在上述链接中提到,我还清理了日志文件db_archive -a -h ... | xargs rm -f(memcacheq 有-R自动执行此操作的选项)。但之后,该__dbq.*文件似乎与日志文件不对应。因此,声明db_stat

# db_stat -d BBKeyword
db_stat: PANIC: fatal region error detected; run recovery
...

像这样:http://forums.oracle.com/forums/thread.jspa?threadID=2146996&tstart=15

我无法给你准确的输出,因为db_stat一直运行并且似乎挂起了。

我有很多文件__dbq.*

# ls -1 __dbq.* | wc -l
11849

单个db文件的大小为4K * 16 * 1024 = 64MB,因此总大小为743GB。

伯克利数据库 4.7.25


更新 1

# db_stat -d BBKeyword
Wed Aug 17 11:34:59 2011    Local time
db_stat: PANIC: fatal region error detected; run recovery
db_stat: PANIC: fatal region error detected; run recovery
db_stat: close: DB_RUNRECOVERY: Fatal error, run database recovery
db_stat: File handles still open at environment close
db_stat: Open file handle: BBKeyword
db_stat: Open file handle: queue.list
db_stat: Open file handle: BBUpdateViewQt
db_stat: Open file handle: BBUpdateViewVn
db_stat: Open file handle: BBUpdateViewYt
db_stat: Open file handle: log.0000083311
db_stat: Open file handle: ./__dbq.BBKeyword.285
db_stat: Open file handle: ./__dbq.BBKeyword.286
db_stat: Open file handle: ./__dbq.BBKeyword.287
db_stat: Open file handle: ./__dbq.BBKeyword.288
db_stat: PANIC: fatal region error detected; run recovery
db_stat: dbenv->close: DB_RUNRECOVERY: Fatal error, run database recovery

db_verify给出很多错误的页码:

...
db_verify: Page 16379: bad page number 4734972
db_verify: Page 16380: bad page number 4734973
db_verify: Page 16381: bad page number 4734974
db_verify: Page 16382: bad page number 4734975
db_verify: Page 16383: bad page number 4734976
db_verify: __dbq.BBKeyword.288: DB_VERIFY_BAD: Database verification failed

因此,我停止memcacheq并运行db_recover

# db_recover -v -h /data/memcacheq/db/baamboo/
Finding last valid log LSN: file: 83311 offset 1795753
Recovery starting from [83310][1429052]
Recovery complete at Wed Aug 17 12:03:09 2011
Maximum transaction ID 8000ac4f Recovery checkpoint [83311][1796460]

并再次检查db_verify

# db_verify -h . __dbq.BBKeyword.288
db_verify: Page 0: metadata page corrupted
db_verify: Page 0: could not check metadata page
db_verify: __dbq.BBKeyword.288: DB_VERIFY_BAD: Database verification failed

答案1

似乎您正在尝试对区域文件而不是数据库文件进行验证。请参阅OTN 上的此主题

相关内容