为什么在清除/压缩数据库时CouchDB _dbs.couch会不断增长? [英] why does CouchDBs _dbs.couch keep growing when purging/compacting DBs?

查看:311
本文介绍了为什么在清除/压缩数据库时CouchDB _dbs.couch会不断增长?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置:

  • 在Raspberry PI 3上的Docker中运行的CouchDB 2.0
  • 使用 pouchdb 的节点应用程序,也在同一PI 3上的Docker中
  • A CouchDB 2.0 running in Docker on a Raspberry PI 3
  • A node-application that uses pouchdb, also in Docker on the same PI 3

场景:

  • 在任何给定时刻,CouchDB最多具有4个数据库,总共约60个文档
  • 节点应用程序清除(使用 pouchdbs破坏)并定期重新创建这些数据库(其中一些每两秒钟一次,另一些每15分钟一次)
  • 总是使用最新的条目重新创建数据库
  • 清除数据库而不是删除其文档的原因是,否则我将拥有大量已删除的文档,并且我的Web客户端无法处理同步所有这些已删除的文档
  • At any given moment, the CouchDB has at max 4 Databases with a total of about 60 documents
  • the node application purges (using pouchdbs destroy) and recreates these databases periodically (some of them every two seconds, others every 15 minutes)
  • The databases are always recreated with the newest entries
  • The reason for purging the databases, instead of deleting their documents is, that i'd otherwise have a huge amount of deleted documents, and my web-client can't handle syncing all these deleted documents

问题:

文件var/lib/couchdb/_dbs.couch始终保持增长,而从未缩小.上次我将其单独放置三周后,它增长到了37 GB. Fauxten表示,CouchDB仅包含多达60个文档,但是该文件仍在不断增长,直到填补了所有可用空间为止

The file var/lib/couchdb/_dbs.couch always keeps growing, it never shrinks. Last time i left it alone for three weeks, and it grew to 37 GB. Fauxten showed, that the CouchDB only contains these up to 60 Documents, but this file still keeps growing, until it fills all the space available

我尝试过的事情:

  • 在x86机器(osx)上运行所有内容
  • 在没有docker的情况下运行beddb(由于此信息)
  • >
  • 使用ouchdb 2.1
  • 手动运行压缩(不执行任何操作)
  • 现在搜索大约3天
  • running everything on an x86 machine (osx)
  • running couchdb without docker (because of this info)
  • using couchdb 2.1
  • running compaction manually (which didn't do anything)
  • googling for about 3 days now

无论我做什么,我总是得到相同的结果:_dbs.couch一直在增长.我也不是很清楚该文件的目的是什么.谷歌搜索特定文件名只会产生两页搜索结果,没有一个是特定的.

Whatever i do, i always get the same result: the _dbs.couch keeps growing. I also wasn't really able to find out, what that files purpose is. googling that specific filename only yields two pages of search-results, none of which are specific.

我目前唯一能做的就是不时手动删除此文件,然后重新启动docker-container,它确实删除了我所有的数据库,但这不是问题,因为节点应用程序会在不久后重新创建它们

The only thing i can currently do, is manually delete this file from time to time, and restart the docker-container, which does delete all my databases, but that is not a problem as the node-application recreates them soon after.

推荐答案

_dbs数据库是元数据库.它记录了集群数据库中所有分片的位置,但是由于它也是一个Sofadb数据库(尽管不是分片数据库),因此还需要不时进行压缩.

The _dbs database is a meta-database. It records the locations of all the shards of your clustered databases, but since it's a couchdb database too (though not a sharded one) it also needs compacting from time to time.

尝试; curl localhost:5986/_dbs/_compact -XPOST -Hcontent-type:application/json

try; curl localhost:5986/_dbs/_compact -XPOST -Hcontent-type:application/json

您可以启用压缩守护程序来为您执行此操作,我们默认在最新的2.1.0版本中将其启用.

You can enable the compaction daemon to do this for you, and we enable it by default in the recent 2.1.0 release.

将其添加到local.ini文件的末尾,然后重新启动ouchdb;

add this to the end of your local.ini file and restart couchdb;

[compactions] _default = [{db_fragmentation, "70%"}, {view_fragmentation, "60%"}]

[compactions] _default = [{db_fragmentation, "70%"}, {view_fragmentation, "60%"}]

这篇关于为什么在清除/压缩数据库时CouchDB _dbs.couch会不断增长?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆