Tuesday, June 16, 2015

Relocate MongoDB storage location in CentOS

To relocate MongoDB storage location in CentOS,

stop MongoDB server with the following command:

sudo /sbin/service mongod stop

Modify MongoDB configuration as follows:

sudo vi /etc/mongod.conf

#dbpath=/var/lib/mongo
dbpath=/home/izeye/mongo

Start MongoDB server with the following command:

sudo /sbin/service mongod start

Note that the directory should be owned by `mongod` user.

If not, change it by the following command:

sudo chown mongod /home/izeye/mongo/

No comments:

Post a Comment