10gen is a cloud computing platform that can provide scalable, high-performance data storage solutions for Web applications. 10gen Open Source project is MongoDB, the main function is to solve the website of operational data storage, session object storage, data caching, efficient real-time count (such as statistical pv,uv), and support ruby,python,java,c++, PHP and many other page languages.
MongoDB main feature is the storage of data is very convenient, not the traditional object-relational mapping mode, high-performance, can store large object data, such as video, can automatically copy and failover.
Technology needs practice, let us come to realize the many superior characteristics of mongodb from practice.
First set up a virtual machine Rhel 5.2.
Download the compliant version of the software,
Http://www.mongodb.org/display/DOCS/Downloads
Curl-o http://downloads.mongodb.org/linux/mongodb-linux-i686-latest.tgz
The installation is very simple, the decompression is good to use, very convenient.
Tar xvzf mongodb-linux-i686-latest.tgz
The unpacked directory structure is as follows:
| | bin| | MONGO (the database shell) | | | | | | |-mongodump (dump/export utility) | '--mongorestore (restore/import utility) | |-Include (c + + driver include files) | '--mongo| | client| | db| | | grid| '--util|--lib|--lib64
Before starting, set up a database-stored directory.
mkdir–p/data/db
Then start the MongoDB in the background.
Bin/mongod Run &
[1] 5673
[ROOT@RAC01 mongodb-linux-i686-2009-06-14]# Mon June 20:27:32 Mongo DB:starting:pid = 5673 Port = 27017 DBPath =/data/db/ master = 0 Slave = 0
Mon June 20:27:32 DB version v0.9.4+, pdfile version 4.4
Mon June 20:27:32 git version:004cd26deee50b7fdf060c06605bbce37bc09794
Mon June 20:27:32 sys info:linux DOMU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri modified EST 12:39:36 2008
Mon June 20:27:32 waiting for 50x15 on port 27017
Mon June 20:27:32 Web Admin interface listening on port 28017
OK, start over, we use MongoDB to connect with the client.
Bin/mongo
url:test
Connecting To:test
type ' help ' for help
Mon June 20:28:09 Connection accepted from 127.0.0.1:19943
> Help
Help
Show DBS Show Database names
show collections Show collections in the current database
Show users at current database
Show Profiles Show most recent system.profile entries and time >= 1ms
Use <db name> set curent database to <db name>
db.help () Help on DB methods
db.foo.help () Help on collection methods
db.foo.find () List objects in collection Foo
db.foo.find ({a:1}) List objects in Foo where a = = 1
It result is the last line evaluated; Use to further iterate
> Show DBS
Admin
Local
Test
The level of help is very clear.
Let's check if MongoDB is working properly.
Bin/mongo
Url:test
Connecting To:test
Type ' help ' for help
Mon June 20:28:56 Connection accepted from 127.0.0.1:31975
> Db.foo.save ({a:1})
> Db.foo.findOne ()
{"_id": "4a3631b14ae1a7d3e24cab82", "a": 1}
At this point, this powerful MongoDB is installed, the next one we will further experience the powerful features of this open source MongoDB.