Do soft link transfer mongodb data directory due to insufficient disk space

Source: Internet
Author: User
Tags disk usage

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.