Getting Started with MongoDB--Installation and configuration

Source: Internet
Author: User
Tags install mongodb yum install mongodb

  Zhanhailiang Date: 2014-11-07

1. Install MongoDB:

[Root@~/Wade/Nodejs/Nodeclub]# Yum Search MongoDB[Root@~/Wade/Nodejs/Nodeclub]# yum Install mongodb.x86_64 mongodb-server.x86_64 libmongodb.x86_64 libmongodb-devel.x86_64

2. Start MongoDB service with config file + background run mode:

[Root@/Usr/Local/Mongodb]# lsConf data log[Root@/Usr/Local/Mongodb/Conf]# cat Mongodb_27017.confFork =trueBind_ip = 127.0.0.1port =27017DBPath =/Usr/Local/Mongodb/Data/LogPath =/Usr/Local/Mongodb/Log/Mongodb_27017.loglogappend =trueJournal =true[Root@/Usr/Local/Mongodb/Conf]# mongod-f/usr/local/mongodb/conf/mongodb_27017.confAbout-to-fork child process, waitinguntilServer is ready forConnections.forked Process:21732All output going to:/Usr/Local/Mongodb/Log/Mongodb_27017.logchild process started successfully, parent exiting[Root@/Usr/Local/Mongodb/Conf]# Ps-ef|grep MongoDBRoot21732     1  0  at: A? 00:00:00 Mongod- F /Usr/Local/Mongodb/Conf/Mongodb_27017.confroot21750 21441  0  at: APts/100:00:00grepMongodb

which

    • fork: Indicates whether the later process mode is started.
    • bind_ IP:MONGODB process-bound listening IP, default to localhost (127.0.0.1)
    • port:mongodb service listens on TCP port, default is 27017
    • dbpath: Data Catalog
    • logpath: Log directory
    • logappend: Log append
    • journal: Whether to turn on the pre-write log

3. Log in to MongoDB using client MONGO to test if the MONGODB service is functioning properly:

[Root@/Usr/Local/Mongodb/Conf]# MONGOMongoDB Shell version:2.4.6connecting to:Test>Version()2.4.6

4. Stop the MongoDB service:

You can use client logons to stop the MongoDB service:

[Root@/Usr/Local/Mongodb/Conf]# MONGOMongoDB Shell version:2.4.6connecting to:Test>Use admin;switched to DB admin>Db.shutdownserver(); Fri Nov7  at: $:54.710Dbclientcursor::init Call()Failedserver should is down ... Fri Nov7  at: $:54.712Trying reconnect to 127.0.0.1:27017Fri Nov7  at: $:54.712Reconnect 127.0.0.1:27017Failed couldn' t connect to server 127.0.0.1:27017

You can also use the Mongod command to close:

[ root@/ usr/ local< Span class= "sy0" style= "Color:rgb (102,204,102)" >/ mongodb / conf " # mongod--shutdown-f/usr/local/mongodb/conf/mongodb_27017.conf  killing process with PID: Span class= "nu0" style= "Color:rgb (204,102,204)" >23099  

Recommended reading:

    • Manage Mongod Processes
    • MongoDB: Start Service
    • MongoDB: Close Service

Getting Started with MongoDB--Installation and configuration

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.