Yesterday, search MongoDB data, introduction of the application of more, the principle of the introduction of not much.
Rough to look at, overall, the design of the two ideas are similar, mainly through the range to distribute data, background
Do not know why, search related content is a few years ago content, the new point is not, so they give the resource link is not to use is the content of old, and most people take the same approach, as the key point is a word with, because of their
Guide
Creating indexes for data helps improve the performance of query data, and this article summarizes the rules you should follow to create a MongoDB index.
I divide these rules into four categories :
1. "Query"2. "Sort"3. "RAM"4. "Selectivity"
First, the port IP is well plannedThe schema diagram below, arbitrarily extracting one shard (non-quorum node) from each replica set can form a complete piece of data.1. First replica set rs1
Share1
1, the structure and principle of the Shard
Shard Cluster Structure Distribution:
The Shard cluster consists of three components: Mongos,config Server,shard1) MONGOSThe entrance to the database cluster request, all requests are coordinated
MongoDB Replica set
First, Introduction:
In a nutshell, a replica set (Replica set) is a master-slave cluster with automatic recovery capabilities. The most obvious difference between a master-slave cluster and a replica set is that the replica
analysis of speed problems in inserting large amounts of data into MongoDB database
Requirements background: A timed task produces thousands or more JSON data, this data is not fully written to the database, the next time the task of the data has
After the successful start of MongoDB, and then open a command line window input MONGO, you can do some of the database operations.
Enter help to see the basic Operations Command:
Show DBS: Display Database listShow Collections: Displays a
(1) MongoDB Export (Mongoexport).
You can run the command by running:./mongoexport--help
./mongoexport--help Options:--help produce help message-v [--verbose] being more verbose (include multiple times for more verbosity e.g.-vvvvv)--version print
Shell command manipulation syntax is similar to JavaScript, in fact, the bottom of the console query statements are done with JavaScript script. With the shell command, you need to start Mongo.exe.
Common shell commands are as follows:
1. Querying
A recent job is to use Nginx + LUA to implement an API to manipulate the MongoDB database, mainly implementing its count and query functions. Did not write Lua before, so also reluctantly to get started, on the basis of the CLOUDWU Lua-mongo
Ideas:
1, concurrent multi-link
2, single link
The concurrency is not said, directly more than a few db just fine. A single link needs to use callback recursion. Mark down
var Db = require (' MongoDB ').
Db; var Server = require (' MongoDB
First, the concept:
Sharding (sharding) refers to the process of splitting a database and dispersing it across different machines. Spread the data across different machines without the need for powerful servers to store more data and handle larger
MongoDB Basic Use tutorial
Basic Command Use
MONGO default port
27017
//default storage use path
/data/db//need to create manually, and give read/write permissions
//start MongoDB server
Mongod--config/usr/ local/etc/mongod.conf
//link MONGO
Original link: http://blog.sina.com.cn/s/blog_6e4059a40101b5z7.html
Problems encountered:
1, why do I have to link again or do not need a password after I have added a username?
Solve:
Reason one: After the data is added to the table name, you
Web services deployed on Alibaba Cloud, MongoDB is a three-copy master-slave node, with a timed task running every night, mainly through aggregate statistical analysis of each user's operational behavior. Running for a while, with the user's growth,
Using cursors, you can control the results of a query:Cursors implement an iterator interface that can be used in foreach ():When a query is assigned a variable, find () does not immediately query the database. For example: Var cursor=db.test.find ()
First, the environment
1. Maven 3.3.9
2. Eclipse
3, Springboot 1.5.6
4, Mongo 3.4.6 second, the development
1, a new Springboot project, the introduction of 1.5.6 dependency.
2, the project structure is as follows
3. Add the following
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.