CouchDB .view文件逐渐失去控制? [英] CouchDB .view file growing out of control?

查看:80
本文介绍了CouchDB .view文件逐渐失去控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到一种情况,我的CouchDB实例使用了20GB VM实例上的所有可用磁盘空间。
经调查,我发现/ usr / local / var / lib / couchdb /中的目录包含一堆.view文件,最大为16GB。我能够删除* .view文件以恢复正常操作。我不确定为什么.view文件会变得如此大,以及CouchDB如何管理.view文件。



更多信息。我有一个运行512MB和CouchDB 0.10的Ubuntu 9.10(karmic)的VM。 VM具有一个cron作业,该作业调用一个Python脚本来查询视图。 Cron作业每五分钟运行一次。每次查询视图时,.view文件的大小都会增加。我写了一份工作来每小时进行监视,几天后,我看不到文件翻过来或大小减小了。



有人吗?对这个问题有什么见解?我错过了一些文档吗?我没有找到关于此主题的任何内容,但这可能是由于在错误的位置或我的搜索字词中找到的。

解决方案

CouchDB非常占用磁盘,为了性能而交换磁盘空间。随着项目的添加,视图的大小将增加。您可以恢复清理和压缩不再需要的磁盘空间。



每次创建更新或删除文档时,视图索引都会随着相关更改而更新。到文件。查询时将更新视图。因此,如果您要进行大量文档更改,那么您应该期望索引会增长,并且需要通过压缩和清理进行管理。



如果您的视图很大,给定的一组文档,那么您的视图可能设计不佳。另外,您的设计可能只需要大视图,您就需要像管理其他任何资源一样对其进行管理。
,正在发生什么文档更新(包括创建和删除),以及您的视图函数正在发出什么,尤其是对于大视图。


I recently encountered a situation where my CouchDB instance used all available disk space on a 20GB VM instance. Upon investigation I discovered that a directory in /usr/local/var/lib/couchdb/ contained a bunch of .view files, the largest of which was 16GB. I was able to remove the *.view files to restore normal operation. I'm not sure why the .view files grew so large and how CouchDB manages .view files.

A bit more information. I have a VM running Ubuntu 9.10 (karmic) with 512MB and CouchDB 0.10. The VM has a cron job which invokes a Python script which queries a view. The cron job runs once every five minutes. Every time the view is queried the size of a .view file increases. I've written a job to monitor this on an hourly basis and after a few days I don't see the file rolling over or otherwise decreasing in size.

Does anyone have any insights into this issue? Is there a piece of documentation I've missed? I haven't been able to find anything on the subject but that may be due to looking in the wrong places or my search terms.

解决方案

CouchDB is very disk hungry, trading disk space for performance. Views will increase in size as items are added to them. You can recover disk space that is no longer needed with cleanup and compaction.

Every time you create update or delete a document then the view indexes will be updated with the relevant changes to the documents. The update to the view will happen when it is queried. So if you are making lots of document changes then you should expect your index to grow and will need to be managed with compaction and cleanup.

If your views are very large for a given set of documents then you may have poorly designed views. Alternatively your design may just require large views and you will need to manage that as you would any other resource.

It would be easier to tell what is happening if you could describe what document updates (inc create and delete) are happening and what your view functions are emitting, especially for the large view.

这篇关于CouchDB .view文件逐渐失去控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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