MongoDB Usage Summary

Source: Internet
Author: User
Tags connection pooling

http://blog.chinaunix.net/space.php?uid=22270773&do=blog&id=19935171. If there is no special use, Suggest: Table name, field name all in lowercase letters.

2. To shorten the length of the field name as much as possible, consider creating a key and practical map table when necessary.

try to reduce Key the length.

3. MongoDB Single table maximum index number is Ten, this is a suggestive suggestion. Indexing guidelines, consistent with MySQL,oracle ,

Minimize the number of indexes, all of the sort fields should be indexed, the index as small as possible, so this redesign design order

section, you need to plan well.

4. MongoDB is not as easy as MySQL Oracle to add fields, if you add fields with default values,

need to modify all the data, which is also the design phase to consider, another solution to this problem is the application

Make a judgment in the code.

5. for the Mongodb that makes the database use (do cache use can not do password Authentication )

6. attention to the fragmentation problem, tested, the same amount of data is written purely and there is an update delete , the latter is more space;

so to observe faults whether the equivalent judgment needs to be defragmented;

Sorting methods temporarily found:dump-restore,repair to a single point library or master-slave library, will affect the service.

For replset mode deployment, you can use a rotation, one of the library offline, the elimination of data, from the new cluster for full synchronization.

After testing, therepair method is slow, and the way to take dump-restore or resync is acceptable.

The deployment of Master-slave mode is equivalent to redo from the library + a master-slave switchover.

7. data source connection, use connection pooling mode, minimize the performance additional consumption of authentication

A standard URI connection is recommended: mongodb://user:[email protected]:p ort,host:port/db

8. Mongodb Log volume is relatively large, under normal circumstances only need to turn on- v or below, and do log rollback delete.

Ongodb the- v log is suitable for deployment on debug lines in the development environment this parameter is not recommended .

the current situation of online deployment, - v there will be a few logs a day . G the log volume, remove this parameter,

Data query-related operations will not be logged, the database of important internal operations will still write logs.

9. MongoDB Index can only use one index at a time, the query of data will not "concurrent" execution

For example: db.tab.find ({' id ' =1, ' name ' =2}) if 'ID', There is an index on the ' name ' column, respectively

It is not significant to improve query efficiency, and if the index is (' id ', ' name ') it will significantly increase efficiency.

MongoDB Usage Summary

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.