This is my first blog, many have insufficient please advise, talk not much, straight into the topic
Reason: Because of the large amount of MONGODB data, occupy a large space, so decided to transfer the data directory to another disk
One, check disk usage
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/DEV/SDA1 40G 35G 5G 88%/
/DEV/SDB1 100G 2G 98G 2%/dt
Second, look at the MongoDB data directory size
[[Email protected] ~] #du-sh/data/server/mongo/db
30g/data/server/mongodb/db
Third, consider SDB1 disk adequacy, transfer MongoDB Data directory
(a) Stop MongoDB service
[email protected] ~]#/data/server/mongodb/bin/mongo #客户端连接进入
>use Admin
>db.shutdownserver ()
(ii) Transfer data catalogue
[[Email protected] ~] #mv/data/server/mongo/db/dt/
(iii) Create a soft link to the original Data directory path #避免修改配置文件里的数据目录路径
[[Email protected] ~] #ln-S/dt/db/data/server/mongodb/db
(iv) Start MONGODB service
[Email protected] ~]#/data/server/mongodb/bin/mongod-f/data/server/mongodb/conf/mongo.conf
In this way, the data directory has been successfully transferred, testing MongoDB service Everything is OK, data integrity
Do soft link transfer mongodb data directory due to insufficient disk space