Changing MongoDB data store directory -
until have not been specifying mongodb data directory , have had 1 30 gb primary partition.
i ran out of space , added new hard disk. how can transfer data (that apparently in /var/lib/mongodb/
) , configure mongodb runs off of new disk without affecting existing installation?
the short answer --dbpath
parameter in mongodb allow control directory mongodb reads , writes it's data from.
mongod --dbpath /usr/local/mongodb-data
would start mongodb , put files in /usr/local/mongodb-data
.
depending on distribution , mongodb installation, can configure mongod.conf
file automatically:
# store data in /usr/local/var/mongodb instead of default /data/db dbpath = /usr/local/var/mongodb
the official 10gen linux packages (ubuntu/debian or centos/fedora) ship basic configuration file placed in /etc/mongodb.conf
, , mongodb service reads when starts up. make change here.
Comments
Post a Comment