MongoDB is a database based on distributed file storage. Written by the C + + language. Designed to provide scalable, high-performance data storage solutions for Web applications.
MongoDB is a product between a relational database and a non-relational database, and is the most versatile and most like relational database in a non-relational database. The data structure he supports is very loose and is a JSON-like Bson format, so you can store more complex data types. MONGO's biggest feature is that the query language he supports is very powerful, and its syntax is a bit like an object-oriented query language that almost implements most of the functionality of a relational database single-table query, and also supports indexing of data.
1. Download the MongoDB installation package
[Email protected] src]# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.4.5.tgz
2. Unzip
[Email protected] src]# TAR-ZXVF mongodb-linux-x86_64-rhel62-3.4.5.tgz
3. Renaming
[Email protected] src]# MV Mongodb-linux-x86_64-rhel62-3.4.5/opt/mongodb
4. Create a DB data storage location and log location, and create a log file
[Email protected] src]# mkdir/opt/mongodb/data [[email protected] src]# Mkdir/opt/mongodb/data/db[[email protected] Sr c]# Mkdir/opt/mongodb/data/logs[[email protected] src]# Touch/opt/mongodb/data/logs/mongodb.log
5. Create a configuration MongoDB file
[Email protected] ~]# cat/opt/mongodb/data/mongodb.conf
#端口号port = 27017 #数据目录dbpath =/opt/mongodb/data/db# log directory LogPath =/opt/mongodb/data/logs/mongodb.log# Set background run fork = true# Log output Mode Logappend = true# turn on authentication #auth = True
6. Start the service
[Email protected] bin]# pwd
/opt/mongodb/bin
./mongod--config/opt/mongodb/data/mongodb.conf
7. See if the port is started
8. You can access the database.
# #附加: Create a startup script to facilitate the management of the service
[Email protected] ~]# cd/etc/init.d/
[email protected] init.d]# cat MongoDB
#!/bin/bash#chkconfig:2345 90#description:mongodbstart () {/opt/mongodb/bin/mongod--config/opt/mongodb/data/ Mongodb.conf}stop () {/opt/mongodb/bin/mongod--config/opt/mongodb/data/mongodb.conf--shutdown}case "$" in start) St Art;; stop) stop;; restart) stop start;; *) echo $ "Usage: $ Start|stop|restart}" Exit 1esac
[Email protected] init.d]# chkconfig--add MongoDB
[Email protected] init.d]# chmod +x MongoDB
[[email protected] init.d]# chkconfig MongoDB on
Next, you can replace!!!!! with the server startup service.
CENTOS6 Source Installation MongoDB