[root@dev test_DB]# systemctl stop mongod
#####Copy mongo directory to new directory ##########
[root@dev test_DB]# mkdir /home/data
[root@dev test_DB]#rsync -av /var/lib/mongo /home/data/
[root@dev test_DB]#cd /var/lib/mongo
######## Rename old directory for backup ############
[root@dev test_DB]#mv mongo mongo_bk
#### Create symbolic link to the new location :#########
[root@dev test_DB]#ln -s /home/data/mongo/ /var/lib/mongo
#### Edit mongod.conf file and pass new data directory#####
[root@dev test_DB]#vim /etc/mongod.conf
storage:
# dbPath: /var/lib/mongo
dbPath: /home/data/mongo
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
[root@dev test_DB]#ls -la
[root@dev test_DB]#systemctl start mongod
No comments:
Post a Comment