Setting up MongoDB in production

Posted 08/25/2016 by sanjeev gupta

In a previous blog I talked about setting up Mongo DB on development machine but if we have to configure mongodb on a production server then we need to do a bit more more.

We follow nearly the same steps a few more configuration settings are needed.

The following resources are required for a functional MongoDB setup:

  1. Create a local Sitecore 8.1 Instance.
  2. Verify Sitecore connection strings.
    <?xml version="1.0" encoding="utf-8"?>

     <connectionStrings>

       <!--

         Sitecore connection strings.

         All database connections for Sitecore are configured here.

       -->

       ...

       ...

       ...

       <add name="analytics" connectionString="mongodb://localhost/analytics" />

       <add name="tracking.live" connectionString="mongodb://localhost/tracking_live" />

       <add name="tracking.history" connectionString="mongodb://localhost/tracking_history" />

       ...

     </connectionStrings>



  3. Download MongoDB from https://www.mongodb.com/download-center

Installation Steps

Here's a step-by-step guide to getting the MongoDB to work once you have all of the resources.

Standard setup instructions

  1. Ensure you have installed and configured your Sitecore Instance. 
  2. Install MongoDB using the Custom installation so you can change the default location. Typically, I put all my projects and websites on a separate non-operating system drive such as a D: drive. I will prefer to install mongo to D:/MongoDB/. Before you start the custom installation please complete Step 3/4 & 5.
  3. In the folder “MongoDB” create a folder called “data” and inside that folder, create a folder called “db”. Inside “data” folder, create another folder “log”. These will not be created for you during install so you will need to create them before MongoDB installation.
  4. In the folder “MongoDB” create another folder called “config” and inside config folder, create a new .cfg file and name it “mongod.cfg”. This is where we will store the configurations for MongoDB.
  5. Copy/paste following the configuration into the new “mongod.cfg” file and modify to your specific workstation: 

    systemLog:

                   destination: file

                   path: d:\mongodb\data\log\mongod.log

    storage:

                    dbPath: d:\mongodb\data\db

    net:

                    bindIp: 127.0.0.1, privateIp address







  6. Now, install MongoDB as a Windows Service, so it will start every time you start up Windows and stay running. Open up a Command Prompt (Run As Administrator) and type in the following (modify if needed for your file paths): 

         D:\mongodb\bin\mongod.exe --dbpath "c:\mongodb\data\db"  

         sc.exe create MongoDB binPath= "D:\mongodb\bin\mongod.exe --service --config=\"D:\mongodb\config\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"
  7. This will create a new windows service called MongoDB. Now, to start the service simply type in the following: net start MongoDB

Share:

Add your comment

 
 

 

Archive

Syndication