mongodb--Database Management

Source: Internet
Author: User
Tags findone mongodump mongorestore

<strong>1, Mongod startup item Comment (default cannot generate path, need to establish manually) </strong><br/>
<span style= "White-space:pre" ></span>dbpath the path to the DB instance <br/>
<span style= "White-space:pre" ></span>logpath Logging path <br/>
<span style= "White-space:pre" ></span>logappend log in append form, default to overwrite <br/>
<span style= "White-space:pre" ></span>bind_ip instance binding IP address <br/>
<span style= "White-space:pre" ></span>port instance specifies the port, and the Web management interface adds 1000<br/> on this interface
<span style= "White-space:pre" ></span>fork after the implementation of the operation, <br/>
<span style= "White-space:pre" ></span>journal open operation log function <br/>
<span style= "white-space:pre" ></span>syncdelay sync flush Disk Time in seconds, default 60 seconds <br/>
<span style= "White-space:pre" ></span>directoryperdb db separate directory, similar to MySQL standalone table space <br/>
<span style= "White-space:pre" ></span>maxconns maximum number of links <br/>
<span style= "White-space:pre" ></span>repairpath Execute repair temporary directory, if not open journal, abnormal Panic, need to perform repair operation &LT;BR/ >

<p>
<span style= "White-space:pre" ></span>auth requires account verification login
</p>
<p>
<br/>

</p>
<p>
&LT;STRONG&GT;2, stop service &nbsp;shutdownserver () &nbsp;db.shutdownserver () </strong>
</p>
<p>
<strong><br/>
</strong>
</p>
<p>
<strong>3, view current process db.currentop () <span style= "White-space:pre" > </span></strong>
</p>
<p>
<br/>

</p>
<p>
<strong>4, ending a process db.killop (process number) </strong>
</p>
<p>
<strong><br/>
</strong>
</p>
<strong>5, current instance running state per second &nbsp; using Mongostat to enter a library instance </strong><br/>
<span style= "White-space:pre" ></span>insert insert <br/> per second
<span style= "white-space:pre" ></span>query query <br/> per second
<span style= "white-space:pre" ></span>update update <br/> per second
<span style= "White-space:pre" ></span>delete delete <br/> per second
<span style= "White-space:pre" ></span>locked Lock amount <br/>
<span style= "White-space:pre" &GT;&LT;/SPAN&GT;QR|QW client Queue Length &nbsp; read, write <br/>
<span style= "White-space:pre" ></span>ar|aw active client Count read, write <br/>

<p>
<span style= "White-space:pre" ></span>conn link number
</p>
<p>
<br/>

</p>
<strong>6, exporting Data mongoexport&nbsp;</strong><br/>

<p>
<span style= "White-space:pre" ></span>mongoexport-d database name-C table name-The path of the file to be exported
</p>
<p>
<br/>

</p>
&LT;STRONG&GT;7, database backup Mongodump, select only the database, representing the full library backup </strong><br/>

<p>
<span style= "White-space:pre" ></span>mongodump-d database name-c backup table name-o backup path
</p>
<p>
<br/>

</p>
<strong>8, database restore Mongorestore &nbsp;,drop to first remove and then insert data </strong><br/>
<span style= "White-space:pre" ></span>mongorestore-d database name backup path--drop<br/>

<p>
<span style= "White-space:pre" ></span>mongorestore-d drumdb D:\MDRUM\drumdb
</p>
<p>
<br/>

</p>
&LT;STRONG&GT;9, repair the database, will be invalid and corrupted data to clean out </strong><br/>

<p>
<span style= "White-space:pre" ></span>db.repairdatabase ()
</p>
<p>
<br/>

</p>
&LT;STRONG&GT;10, Fsync to the database to increase the write lock, need to execute the statement in the Admin library, after the execution of the buffer data is written to disk, blocking other write operations, <br/>
<span style= "White-space:pre" ></span> can then be backed up, and after the backup is finished, restore the write lock to DB. $cmd. Sys.unlock.findOne (); &nbsp;<br/>
<span style= "White-space:pre" ></span> after unlocking can use Db.currentop () <span style= "White-space:pre" ></ span> viewing process </strong><br/>
<span style= "White-space:pre" ></span> Locking Db.runcommand ({&quot;fsync&quot;: 1, &quot;lock &quot; : 1}); <br/>
<span style= "white-space:pre" ></span> unlock db. $cmd. Sys.unlock.findOne (); &nbsp;

mongodb--Database Management

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.