Db1 startup Item:
./Mongod -- dbpath/data/dbdata -- logpath/data/dblog/mongodb1.log -- fork
Then set the user name and password:
Use AdminDB. adduser ("admin", "admin ");Use localDB. adduser ("repl", "repl ");
Then start again as verified
.
1. Common commands:
Help show helpshow DBS show database namesshow collections show collections in current databaseshow users show users in current databaseshow profile show most recent system. profile entries with time> = 1 msuse set curent
Add Field{$ Set: {"field": 1 }})Delete Field{$ Unset: {"field": 1 }})
Query elements in an array{"Keyword": {$ All: ["location", "other"]}
Add array elements (repeated elements are not added){"$ Addtoset": {"keyword": {"$ each": ["location",
Install MongoDB on Windows
First, go to the official MongoDB website. Next, we can observe that the folder contains the following files:
As you can see, MongoDB is very simple, with only 10 files. Next, create a directory for storing database files,
Brief Introduction
Capped collections is a set of excellent performance with a fixed size (Set of capacity), with LRU (least recently used) Rules and Insertion Sequence for age-out (aging removal) processing: automatically maintains the insertion
Download MongoDB
Http://www.mongodb.org/downloads
Find the version of your operating system
Create a directory to store data before you start.
Mkdir/Data
Tar xzvf youdownload
CD youdownload/bin
./Mongod -- dbpath =/Data
MongoDB is running.
The following things should be understood by PHP programmers.For more details, refer to Baidu Google
MongoDB PHP document http://us.php.net/manual/en/book.mongo.php1. MongoDB is a separate server2. MongoDB is based on documents rather than tables.3.
Find query is the most basic and commonly used syntax in MongoDB. It is also very easy to use. Some basic operations of find are listed below.> DB. news. find () // select * from [News] {"_ id": 10001, "Count": 1, "news": "I hava a dream", "Time ":
Skip the theory. I have introduced automatic sharding on the internet... directly go to the configuration. Please leave a message if you have any questions.
Or test with million data
Insert million pieces of data to a database without sharding.
Data
There is only one Ubuntu machine. The configuration scheme is as follows:1. Three sharding parts2. Each shard consists of three nodes: 1 master and 2 slave replica sets.3. configsever
4. One routing node mongos
Shard server: mongod instance, used to
Ruby connection to MongoDB
To connect to MongoDB in Ruby, you need to use the Mongo module. This module can be installed through the gems program that comes with Ruby.
$ gem update --system$ gem install mongo$ gem install bson_ext
The Mongo module
A configured MongoDB sharding cluster does not have single point of failure.
This section describes possible faults in cluster servers and corresponding countermeasures.
1. A mongos routing process faultEach mongos runs on each application server.
Introduction
Mongodb is a set-oriented, flexible document-type database.
Collection-oriented means that data is stored in a data set called a collection group. Each set has a unique identification name in the database and can contain an infinite
First, the indexes in mongodb are similar to those in MySQL. Therefore, many techniques for creating efficient indexes in MySQL are also applicable to mongodb.
Furthermore, it may be even more important that the index optimization recommendations
In the previous blog, we successfully installed and started the Mongo database. In this blog, I will introduce the development of the MongoDB database. For details, refer to the official MongoDB documentation. To smoothly develop MongoDB databases,
First download the mongo-hadoop Adapter
Git clone https://github.com/mongodb/mongo-hadoop.git
Git checkout release-1.0
Go to the mongo-hadoop directory and find build. SBT to change hadooprelease in thisbuild to the following:
Hadooprelease in
Test environment: php_cmd.dll of PHP5.3 + mongo-1.1.4-php5.3vc6ts
We can use stat to observe and find that:
1. mongostat also occupies a database connection.
2. PHP's mongo extension uses transient connections, similar to the Code: new Mongo
Recently, due to the business needs of the product, you need to use a relatively large amount of data for computing. By the way, try the mapreduce function of mongodb, and it feels pretty good.
The following is an official example:
$ ./mongo>
Query. All ("name", "a", "B"); // matches an array with multiple elements.
Query. And (Query. EQ ("name", "a"), Query. EQ ("title", "t"); // satisfy multiple conditions at the same time
Query. EQ ("name", "a"); // equal
Query. Exists ("type",
Address: http://blog.nosqlfan.com/html/3515.html
Someone asked on Quora what is the internal organizational structure of the MongoDB data file. Then the 10gen engineer Jared Rosoff gave a brief answer.
Each database has its own independent files.
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.