Why is the database of a Meteor app that has been run once (and never loaded) taking up nearly 3GB?

混江龙づ霸主 提交于 2019-12-19 05:49:33

问题


UPDATE: this was fixed after Meteor v0.4 (2012). For historical purposes:


Excerpt from du:

2890768 ./Code/Meteor/QuarterTo/.meteor/local/db/journal
2890772 ./Code/Meteor/QuarterTo/.meteor/local/db
2890776 ./Code/Meteor/QuarterTo/.meteor/local
2890788 ./Code/Meteor/QuarterTo/.meteor
2890804 ./Code/Meteor/QuarterTo

I merely ask because it was in my Dropbox and pushed me over my limit.


回答1:


When meteor run is executed, it starts mongodb with default mongo settings, so it creates (massive) prealloc files in .meteor/local/db/journal.

There is no obvious way to disable this behavior. What I have done as a workaround is change the file app/lib/mongo_runner.js and add a --nojournal parameter that gets passed to mongodb at startup.

I created an issue for this: https://github.com/meteor/meteor/issues/15




回答2:


Maybe you can use smallfiles=true parameter for mongoDB? It will create smallest prealloc files




回答3:


You can turn off preallocation by passing the --noprealloc arg to mongod. The downside is that there will be pauses each time a new storage file needs to be allocated. Depending on the filesystem you are using (e.g., ext3 vs. ext4), this could result in noticeable latency for a user.




回答4:


The commands that work for me are:

  1. stop mongodb instance if it is running

sudo service mongod stop

  1. create new mongodb instance without requiring 3+GB preallocated space and use smallfiles.

mongod --noprealloc --smallfiles

If you are getting “ERROR: dbpath (/data/db) does not exist.” when running 2, then run these commands before 2. sudo mkdir -p /data/db/

sudo chown `id -u` /data/db



来源:https://stackoverflow.com/questions/10119289/why-is-the-database-of-a-meteor-app-that-has-been-run-once-and-never-loaded-ta

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!