MongoDB is a scalable, high-performance, open-source NoSQL document database. The main use of C + + development completed. Document-oriented storage, full-index support, replication and high-availability, auto-sharding features. It is the most feature-rich document database in a non-relational database, most like a relational database. The data structure is loosely formatted as JSON-like Bjson.
Specific methods:
Configuration Package Management System:
1. Ubuntu Package management tool ensures consistency and reliability of downloaded packages. The console executes the following command to import the 10gen public GPG Key:
[HTML]View Plaincopy print?
- sudo apt-key adv--keyserver keyserver.ubuntu.com--recv 7F0CEB10
2. Execute command vi/etc/apt/sources.list.d/10gen.list
Enter the bottom content in the insert state to get the 10gen target library
[HTML]View Plaincopy print?
- Deb Http://downloads-distro.mongodb.org/repo/ubuntu-upstart Dist 10gen
3. Execute the command below to get the latest library content
[HTML]View Plaincopy print?
- sudo apt-get update
Installing MongoDB Packages
[HTML]View Plaincopy print?
- sudo apt-get install Mongodb-10gen
Complete the installation!
Configure MongoDB
Config file in/etc/directory, execute command vi/etc/mongodb.conf
Run with MongoDB user, MongoDB database file in , database log file in /var/log/mongodb
Running MongoDB
[HTML]View Plaincopy print?
- sudo service MongoDB start
Stop MongoDB
[HTML]View Plaincopy print?
- sudo service MongoDB stop
Restart MongoDB
[HTML]View Plaincopy print?
- sudo service MongoDB restart
Installing the MongoDB PHP extension
1. Download the source code and unzip itSOURCE Package Address Http://pecl.php.net/get/mongo-1.4.0.tgz
2. InstallationAssuming that the extracted directory is mongo-1.4.0 into the mongo-1.4.0 directory, execute it sequentially:
[Plain]View PlainCopy
- Phpize
- ./configure
- Make
- Make install
After successful installation, you will get a hint similar to the followingInstalling Shared extensions:/usr/lib/php5/20121212/mongo.so (or other directory files)
Under this directory you will find mongo.so
3. Modify the PHP configurationJoin in the php.ini
[Plain]View PlainCopy
- Extension=/usr/lib/php5/20121212/mongo.so
Ubuntu installs MongoDB and PHP extensions