Linux configuration mongodb~

Source: Internet
Author: User

OK Let's first download a wave of mongodb~ (64-bit Ubuntu)

Curl-o https://fastdl.mongodb.org/linux/mongodb-linux-x86_ 64-3.0.6.tgz # download tar -ZXVF mongodb-linux-x86_64-3.0 6.tgz # unzip MV mongodb-< Span class= "PLN" >linux-x86_64-3.06//usr/local /mongodb # copy the unpacked package to the specified directory        

Next Configure the environment variable pressure yajing--!

Export PATH=<mongodb-Install-directory>/bin:$PATH 


<mongodb-install-directory> for your MongoDB installation path. As the/usr/local/mongodb of this article
Create the next database directory! and create the configuration file by the way!
mkdir -p /data/db        

directory has been created, note:/DATA/DB is the default starting database path for MongoDB (--dbpath).

# vi/data/mongo/mongodb.conf

mongodb.conf The file configuration parameters (easy to start or start directly from the command line configuration parameters)

/strong>dbpath=/data/mongo/
Logpath=/data/mongo/mongo.log
logappend=true
fork=true
port=27017

--------------------------------
Note: logappend prevent the log from being deleted
Fork background run (prevent terminal restart shutdown)
Now let's start MONGO!

First: Configuration file startup
# bin/mongod-f/data/mongo/mongodb.conf
The second type: Configuration parameters start
# Mongod--fork--logpath=usr/local/mongodb/log/mongodb.log--logappend--dbpath=usr/local/mongodb/data/db/

Let's test it.
Bin/mongo
Terminal output

MongoDB Shell version:3.0.6

Connecting To:test

>


Success!
Attached: The Pits encountered! Keng! Keng!
I. Need to delete Mongod.lock
Two. External network if access needs to go to etc/mongodb.conf to change bind_ip to 0.0.0.0 or comment out


Linux configuration mongodb~

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.