1.Mongodb Bson Document database, the entire data exists on disk, HBase is a column database, each familycolumn is saved in a separate HDFs file when the cluster is deployed.
2.MONGODB primary key is "_id", the primary key can not be indexed,
First, the application scene: Find MongoDB news name is not "", also not NULL news name, and according to the Heat rankings:
$map [' title '] = Array (' $not ' =>array (' $in ' =>array ("", null));
$news = $this->where ($map)->order (' Value desc ')-
To improve query efficiency, MONGODB also provides indexes (like the index of relational databases, using B-tree storage), with a single field index, combination index, multiple key index (for array query), spatial index, text index, and hash index.
One: Problem description
I enter MongoDB's machine IP and port number in the browser: http://192.168.6.70:27017/
Page appears:
It looks like your are trying to access MongoDB over HTTP on the native driver port.
As shown in figure:
Two:
MongoDB is a non-relational type of database, data storage is very flexible, using a storage structure of Bson, a binary form of class JSON storage format, supporting embedded document objects and array objects, and support some data types that JSON
Start real actual combat, table data about 100w, today first to solve the first demand, that is, to find the average record time, directly run "Combat 2" has been written mapreduce. An exception, no results, as long as the {sort}, there is no result,
single-machine switch to replica set method step
1: Back up the database and shut down the current database
/u03/mongodb/bin/mongodump-d Configuration-o/u02/dump/
Use admin db.shutdownserver ();
2: Start two data nodes on both machines as follows:
/
First, the principle of work
1. The MongoDB 2.6 version starts with the recommended replica set, which is no longer recommended for master-slave replication.
2. The replica set requires at least 3, can be 3 copies of all the replica set, you can
MONGO using the database
Mongod Boot
Mongoimport Importing Data
Boot command: Mongod--dbpath path
--dbpath is the folder where you select the database document
In other words, MongoDB, there are real physical files, corresponding to a database, U
Construction of Mongodb3.3.6 CentOS7 Shard Experiment Environment
first, topology diagram
ii. deployment of 1.Mongodb installation
3 servers are installed MongoDB, installation package to/usr/local/, in order to clear the display, each node
MongoDB Limit () method
If you need to read a specified number of data records in MongoDB, you can use the MongoDB limit method, and the limit () method accepts a numeric parameter that specifies the number of record bars read from MongoDB.
Grammar
1. Differentiate file output by log level
Some people are accustomed to log information level output to different names of files, such as Info.log,error.log,warn.log, in the LOG4J2 can be configured by the filters to implement.
It is assumed that
Today, a group of brothers asked me the MongoDB collection corresponding file is which, this problem I have not viewed, to the MySQL file is easy to distinguish the way to save, but MongoDB is not so, save the file as followsThe file name doesn't
MONGODB Multi-collection multi-table statistics combat
Complete the following reports:
Table person, Appointmentrecord number of people involved
Using aggregate functions in the person tableDb. Person.aggregate () on the line
[
{
$match: {
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, but MongoDB does not create a database command, but there are similar
All data are not the same.
First look at skip and limit, when the two are used together, regardless of their position order, default first skip, then limit.
The following figure:
Look at the sort, "6" statement, my data is sorted. After that,
One, insufficient authority
We have two workarounds for this.
1,# setcap Cap_fowner+ep/usr/bin/mongod
2,chmod +777 MONGO
Two,
The reason for this problem is that there is no proper operation when exiting.
Workaround:
1. Find the file
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.