码迷,mamicode.com
首页 > 数据库 > 详细

Mongo db change datadir

时间:2017-05-18 20:06:02      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:tor   god   move   store   art   ant   cat   use   mis   

To change the location used by MongoDB to store its data, you need to:

  1. Edit /etc/mongodb.conf and change the line dbpath=/var/lib/mongodb to the path that you desire, e.g. dbpath=/home/user/data/mongodb
  2. Update the permissions of your chosen path to allow the mongodb user to write to it, e.g. chown $USER -R /home/user/data/mongodb
  3. Restart the MongoDB service by running sudo service mongodb restart

Note that if you have any data in the old location that you want to keep, you‘ll need to stop the MongoDB service first, manually move the files and then start the service again.

To stop the MongoDB server use sudo service mongodb stop

Mongo db change datadir

标签:tor   god   move   store   art   ant   cat   use   mis   

原文地址:http://www.cnblogs.com/xiaojikuaipao/p/6874892.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!