MongoDB free disk space

Source: Internet
Author: User
Tags mongodb server mongodb free

1. Delete the old document Db.remove ({}) first;

2. Remove the members to be cleaned from the replica set:

(1) Primary server in the replica set (/opt/mongo1/bin/mongo--port 27017)

(2) Rs.remove ("192.168.1.54:27019")

3. Close the MongoDB server you want to clean up

(1) Login to the MongoDB server to be cleaned (/opt/mongo2/bin/mongo--port 27018)

(2) User admin; Db.shutdownserver ();

4. Modify the MongoDB startup parameters and run

Bin/mongod--dbpath/home/mongodata2/data--port 27018--logpath=/home/mongodata2/logs/mongodb2.log--repair-- Repairpath/opt/data

5. Confirm Mongod Run End

Can be used PS Axu | grep Mongod to see if the process has ended.
You can also see if the log file/home/mongodata2/logs/mongodb2.log has the following output:

2016-05-10t13:14:41.646+0800 [conn5413] Dbexit:shutdown called
2016-05-10t13:14:41.646+0800 [conn5413] shutdown:going to close listening sockets ...
2016-05-10t13:14:41.646+0800 [conn5413] closing listening socket:8
2016-05-10t13:14:41.646+0800 [conn5413] closing listening socket:10
2016-05-10t13:14:41.646+0800 [conn5413] removing socket file:/tmp/mongodb-27018.sock
2016-05-10t13:14:41.646+0800 [conn5413] shutdown:going to flush diaglog ...
2016-05-10t13:14:41.646+0800 [conn5413] shutdown:going to close sockets ...
2016-05-10t13:14:41.646+0800 [conn5413] shutdown:waiting for FS preallocator ...
2016-05-10t13:14:41.646+0800 [conn5413] shutdown:lock for final commit ...
2016-05-10t13:14:41.646+0800 [conn5413] shutdown:final commit ...
2016-05-10t13:14:41.647+0800 [conn5413] shutdown:closing All Files ...
2016-05-10t13:14:41.832+0800 [conn5413] Closeallfiles () finished
2016-05-10t13:14:41.832+0800 [conn5413] journalcleanup ...
2016-05-10t13:14:41.832+0800 [conn5413] Removejournalfiles
2016-05-10t13:14:41.889+0800 [conn5413] shutdown:removing FS lock ...
2016-05-10t13:14:41.889+0800 [conn5413] dbexit:really exiting now

6. Finally start Mongod in normal mode and add members to the replica set

Primary servers in the replica set

Rs.add ("ipaddr:27018")

To view the run result of a replica set: Rs.printslavereplicationinfo ()

MongoDB free 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.