Linux Installation MongoDB

Source: Internet
Author: User
Tags create mongodb mongodb client

  1. Download and unzip the MongoDB file. Put the extracted files under/opt/(store directory to install their own habits)

    # wget Http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.4.tgz

    # tar-zxvfmongodb-linux-x86_64-2.0.4.tgz

    # MV Mongodb-linux-x86_64-2.0.4.tgz mongodb2.0.4 (for convenience, make it more concise from the name)

  2. Create MongoDB-stored data files, days files (mongodb_db, mongodb_logs)

    # CD/

    #mkdir Mongodbdata

    #cd Mongodbdata

    #mkdir mongodb_db

    #mkdir Mongodb_logs

  3.  

    Enter the Mongodb2.0.4/bin directory you just unzipped, start MongoDB, specify the output path

    #cd/opt/ Mongodb2.0.4/bin

    #./ Mongod--dbpath= / mongodbdata/mongodb_db--logpath= / mongodbdata/mongodb_ Logs/mongodb.log--logappend&

    "All output going to:/mongodbdata/mongodb_logs/mongodb.log" appears after execution

  4. Check whether the port is started, port: 27017

    # NETSTAT-LANP | grep 27017

    TCP 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 560/mongod UNIX 2 [ ACC] STREAM LISTENING 128435 560/mongod/tmp/mongodb-27017.sock

    Started successfully.

  5. 5

    5th: The MongoDB client can be used to connect to the database. Go to the Bin directory and execute MONGO

    #./mongo

    MongoDB Shell version:2.0.4connecting to:test

    >use Mongo_test Creating a library

    >db.createcollection ("test") CREATE table

# #后台运行
--fork --logpath=/srv/infra/mongodb/mongodbdata/mongodb_logs/mongodb.log--logappend&

Linux Installation 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.