Install and use MongoDB as a service: www.2cto.com first installs MongoDB on Ubuntu. Download MongoDB, now the latest production version 1.7.01. Unzip the file. $ tar-xvfmongodb-linux-i686-1.4.3.tgz2. Create a data directory for MongoDB, by default it stores data in datadb $ sudomkdir-
Install and use MongoDB as a service: www.2cto.com first installs MongoDB on Ubuntu. Download MongoDB, the latest production version 1.7.0 1. decompress the file. $ tar-xvf mongodb-linux-i686-1.4.3.tgz 2. create a data directory for MongoDB. By default, it stores data in/data/db $ sudo mkdir-
MongoDB installation and service creation
Installation and use:
Www.2cto.com
First install MongoDB on Ubuntu.
Download MongoDB, the latest production version 1.7.0
1. decompress the file.
$ Tar-xvf mongodb-linux-i686-1.4.3.tgz
2. Create a data directory for MongoDB. By default, it stores data in/data/db
$ Sudo mkdir-p/data/db/
$ Sudo chown 'id-U'/data/db
3. Start the MongoDB service.
$ Cd mongodb-linux-i686-1.4.3/bin
$./Mongod
4. Open another terminal and make sure that you are in the bin directory of MongoDB and enter the following command.
$./Mongo
========================================================== ======================================
You must manually enter
E
Cd E: \ APMServ5.2.6 \ MongoDb \ bin
Mongod -- dbpath E: \ APMServ5.2.6 \ MongoDb \ data
This is very troublesome, so the Mongo database is installed as a Windows service. This is much more convenient.
E: \ APMServ5.2.6 \ MongoDb \ bin> mongod -- logpath E: \ APMServ5.2.6 \ MongoDb \ logs \ MongoDB. log -- logappend -- dbpath E: \ APMServ5.2.6 \ MongoDb \ data -- directoryperdb -- serviceName MongoDB -- install
Press enter to check whether the service is successfully installed.
All output going to: E: \ APMServ5.2.6 \ MongoDb \ logs \ MongoDB. log
Creating service MongoDB.
Service creation successful.
Service can be started from the command line via 'net start "MongoDB "'.
Www.2cto.com
Emphasize
1: log must specify a xxx. log File (this is also required if the file does not exist. It will be created automatically and cannot be written as -- logpath d: \ mongodb \ logs)
2: N letters of serviceName should be capitalized.
Note: This command will be run in the bin directory of MongoDB. At the beginning, I will run it directly under D: \. The Executable Directory of the result service is ["D: \ mongod "-- logpath" D: \ MongoDB \ logs \ MongoDB. log "-- logappend -- dbpath" D: \ MongoDB \ data "-- directoryperdb -- service] is definitely incorrect.
This command line specifies the log file: E: \ APMServ5.2.6 \ MongoDb \ logs \ MongoDB. log, and the log is output as an append;
Data File directory: E: \ APMServ5.2.6 \ MongoDb \ data. The -- directoryperdb parameter indicates that a directory is created for each database;