Getting started with MongoDB for PHP installation

Source: Internet
Author: User
Tags install mongodb mongodb server


Introduction:

MongoDB is a product between relational databases and non-relational databases. It has the most abundant functions and features like relational databases. The supported data structure is very loose and is similar to the JSON bjson format. Therefore, it can store complicated data types. The biggest feature of Mongo is that it supports a very powerful query language. Its syntax is somewhat similar to an Object-Oriented Query Language. It can almost implement most of the functions similar to single-table queries in relational databases, it also supports data indexing.

It features high performance, ease of deployment, and ease of use, making it easy to store data. Features:

· Oriented to centralized storage, it is easy to store object-type data.

· Free mode.

· Supports dynamic query.

· Supports full indexing, including internal objects.

· Query is supported.

· Supports replication and fault recovery.

· Use efficient binary data storage, including large objects (such as videos ).

· Automatic fragment processing to support scalability at the cloud computing level

· Supports Ruby, Python, Java, C ++, PHP, and other languages.

· The file storage format is bson (a json extension)

· Accessible through the network

The so-called "collenction-orented" means that data is stored in a data set by groups and is called a collection ). Each set has a unique identification name in the database and can contain an infinite number of documents. The concept of a set is similar to that of a table in a relational database service (RDBMS). The difference is that it does not need to define any schema ).
Schema-free means that we do not need to know any schema definitions for the files stored in the MongoDB database. If necessary, you can store files of different structures in the same database.
The document stored in the set is saved as a key-value pair. The key uniquely identifies a document, which is a string type, and the value can be a complex file type. We call this storage form bson (Binary serialized document format ).

The MongoDB server can run on Linux, windows, or OS X. It supports 32-bit and 64-bit applications. The default port is 27017. It is recommended to run on a 64-bit platform because MongoDB

The maximum file size supported when running in 32-Bit mode is 2 GB.

MongoDB stores data in files (the default path is/data/DB) and uses memory ing files for management to improve efficiency.


Several common websites

* Official Website: http://www.mongodb.org

* API: http://www.php.net/manual/en/book.mongo.php

* Tutorial: http://php.net/manual/en/mongo.tutorial.php

* Download: http://downloads.mongodb.org/win32/mongodb-win32-i386-1.8.1.zip

* Driver for PHP: https://github.com/mongodb/mongo-php-driver/downloads


MongoDB installation:

Linux/OS X:
1. Create a data directory
Mkdir-P/data/DB
2. Download the compressed package
Curl-O http://downloads.mongodb.org/linux/mongodb-linux-i686-latest.tgz
3. decompress the file
Tar zxvf mongodb-linux-i686-1.8.3.tgz
4. Start the service

CD mongodb-linux-i686-1.8.3
Bin/mongod run &
5. Use a client to connect
/Bin/Mongo
The following result is displayed: the default port number is port 27017.



Common Startup parameters:
Run is started directly. Example:./mongod run
-- Dbpath indicates that a specific storage directory is started. If the directory does not exist, it is created. Example:./mongod -- dbpath/var/data/Mongo
-- Port specifies the port to start. Example:./mongod -- port 12345

Stop the Mongo service:
Method 1: Stop the server. You can use Ctrl + c
Method 2: Stop the client. You can connect to the client first.
./Mongo
And use the command
DB. shutdownerver ()
Then exit the client
Exit

Run the following command to install Windows:

WINXPThe following installationRefer to my other article: Install MongoDB and start it with Windows


@ Hangzhou: greatness is coming out! If the link is invalid, seeHttp://www.cnblogs.com/phphuaibei/


Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.