Thursday, August 31, 2017

Mongo DB Environment Set Up

  1. Download MongoDB this link link.
  2. Review MongoDB folder.

    In MongoDB, it contains only executable files 10 Plus(exe) in the bin folder. This is true, and That are the required files to MongoDB, it's really hard to believe for a developer like me Who eats from a relation database background.
    path:- Files under $MongoDB/bin folder
  3. Configuration File

    Create a MongoDB config file, it’s just a text file, for example C:\mongodb\mongo.config:
    #store data here
    dbpath=C:\mongodb\data
    
    \\all output go here
    logpath=C:\mongodb\log\mongo.log
    
    \\log read and write operations
    diaglog=3
  4. Run MongoDB server

    Use mongod.exe --config C:\mongodb\mongo.config to start MongoDB server.
    C:\mongodb\bin>mongod --config C:\mongodb\mongo.config
    All output going to: C:\mongodb\log\mongo.log
  5. Connect to MongoDB

    Uses mongo.exe to connect to the started MongoDB server.
    C:\mongodb\bin>mongo MongoDB shell version: 2.2.3 connecting to: test
    //mongodb shell
  6. MongoDB as Windows Service

    Add MongoDB as Windows Service, so that MongoDB will start automatically following each system restart. Install as Windows Service with --install.
    C:\mongodb\bin> mongod --config C:\mongodb\mongo.config --install
    A Windows service named “MongoDB” is created.
    To start MongoDB Service:
    net start MongoDB
    To stop MongoDB Service
    net stop MongoDB
    To remove MongoDB Service
    C:\mongodb\bin>mongod --remove

No comments:

Post a Comment