Linux under MongoDB Service installation
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 MongoDB, select Community Edition, Linux x64 version
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.10.tgz
2. Start MongoDB using Mongod, the commonly used parameters are
DBPath Specifying the database path
LOGPATH Specifies the MongoDB log file, note that the specified file is not a directory
Logappend writing the log using the Append method
BIND_IP bind service IP, if bind 127.0.0.1, then only native access, do not specify default local all IP
Fork runs MongoDB as a daemon, creating a server process
Example, create a mongodb.conf with the following file contents:
Dbpath=. /data_noauth/
Logpath=. /log/mongodb_noauth.log
Logappend=true
bind_ip=127.0.0.1
Fork=true
Start Mongodb,./mongod–f./mongdb.conf, then run MongoDB as a daemon, but kill the MongoDB process, MongoDB service is not automatically open.
3. Using supervisor to start MongoDB, really protect the mongodb process, it is necessary to pay attention to the Mongod fork parameter cancellation, otherwise it will not play a guardian role. Create mongodb.conf under the/etc/supervisor/conf.d/folder:
[Program:mongodb]
Command=/data/mongodb/bin/mongod-f/data/mongodb/bin/mongodb.conf
directory=/data/mongodb/bin/
Autorestart=true
Restart Supervisor
/etc/init.d/supervisor restart
can use the MongoDB service normally.
Public Number: ludong86
Linux under MongoDB Service installation