based on CentOS6.5 Operating System Setup MongoDB Service
MongoDB,is currently inITA non-relational database that is very popular in the industry(NOSQL),The flexible way to store data,Highly currentITPractitioners of the favor.MongoDBVery good realization of object-oriented thinking(OOThought),InMongoDBInEach record is aDocumentObject.MongoDBThe biggest advantage is that all data persistence operations are not manually written by developersSQLStatement,The direct call method can be easily implementedCRUDOperation.
This article uses the Linux system to build MongoDB Service, the following is the concrete construction process:
First, prepare the MongoDB installation package
Can download MongoDB package to http://www.mongodb.org/downloads
Second, prepare MongoDB users
[Email protected]~]# useradd-s/sbin/nologin MongoDB
Third, unpack and rename the extracted directory to MongoDB
[Email protected]~]# tar-zxf mongodb-linux-x86_64-2.6.4.tgz-c/usr/src/
[Email protected]~]# mv/usr/src/mongodb-linux-x86_64-2.6.4//usr/local/mongodb/
Iv. Enter the extracted directory
Because the mongodb directory does not contain its data store directory and the log directory, these two directories are created manually:
[[Email protected]~]# cd/usr/local/mongodb/
[Email protected]mongodb]# mkdir Data
// Create Data Catalog
[[Email protected]mongodb]# mkdir logs// Create log directory
After the creation is complete, to change the owning group of the MongoDB directory and the owning master to the MongoDB user just added, prevent the error caused by the permission problem.
[Email protected]local]# chown-r Mongodb:mongodb mongodb/
V. Setting up MongoDB service to boot with system
Edit the /etc/rc.local file and insert the following record in the file:
/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data/--logpath=/usr/local/mongodb/logs/logs–fork
Six, open MongoDB Service
[[Email protected]data]#/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data/--logpath=/usr/local/ Mongodb/logs/logs–fork
Vii. Client Login to MongoDB database
[[Email protected]data]#/usr/local/mongodb/bin/mongo
Mongodbshell version:2.6.4
Connectingto:test
>
At this point,mongodb construction work is basically completed.
Build MongoDB service based on CentOS 6.5 operating system