Sitecore and xDB – Setting up MongoDB on your developer machine

With Sitecore 7.5, Sitecore introduces xDB – the new MongoDB based DMS database. But before you say “oh no, yet another technology I have to deal with”, you should know that working with MongoDB is very easy. In fact it is easier than working with SQL Server.

STEP 1: DOWNLOAD MONGODB

Go to http://www.mongodb.org/downloads and download the 64 bit .zip file. Unzip the files in a directory on your computer.
I installed mine at c:\mongodb

STEP 2: SET UP THE SITECORE CONNECTIONSTRINGS.CONFIG

It is very likely that the Sitecore 7.5 (and Sitecore 8.x) connectionstrings.config are already set up correctly. If not look for the following lines, they need to point to your local machine:

<?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>

STEP 3: CREATE A .BAT FILE TO START UP MONGO

To start up mongo you need to run mongod.exe with a parameter determining where Mongo should put the database files. Create a .bat file with the following contents:

c:\MongoDB\bin\mongod.exe –dbpath “[yourfilepath]”

Replace c:\MongoDB\bin\ with the path to your Mongo files, and [yourfilepath] with the path to the folder where you would like to put your MongoDB databases.

You will need one .bat file for each of your Sitecore projects, as you would like to store a separate set of files per Sitecore.

STEP 4: START SITECORE AND ENJOY LIFE

To start up Sitecore, you run the .bat file and fire up your Sitecore and you are now running Sitecore with xDB on a local instance.

Sitecore 8 technical preview with MongoDB running

Sitecore 8 technical preview with MongoDB running

MORE TO READ:

 

 

About briancaos

Developer at Pentia A/S since 2003. Have developed Web Applications using Sitecore Since Sitecore 4.1.
This entry was posted in Sitecore 8 and tagged , , , . Bookmark the permalink.

19 Responses to Sitecore and xDB – Setting up MongoDB on your developer machine

  1. Ivan Buzyka says:

    Great article!
    For me it was more convenient to configure MongoDB as a Windows service. So, I should not care about running that bat file every time.
    However approach of keeping MongoDB files within appropriate Sitecore solution folder sounds great!

    Like

  2. Pingback: Launch Mongo DB with Sitecore Pipelines | iStern Blog

  3. mawkstiles says:

    I used what you provided but had a few issues. Here’s what worked for me:

    “C:\Program Files\MongoDB 2.6 Standard\bin\mongod.exe” –dbpath “C:\inetpub\wwwroot\testsite\Databases\Mongo”

    Like

  4. mawkstiles says:

    Interesting, something is stripping double dashes. The dbpath command should have two dashes. Documentation: http://docs.mongodb.org/manual/tutorial/manage-mongodb-processes/

    Like

  5. Arun Sharma says:

    Great article but i didn’t receive report of web form for marketers.I also give reporting database as sitecore analytic database but i didn’t get form reports.Please give me suggestion what i do…thanks in advance

    Like

  6. Pingback: MongoDB Setups für Sitecore – Maku

  7. Alan Tam says:

    Why not just run the msi ???

    Like

  8. briancaos says:

    The MSI is inconvenient when you have many instances of Sitecore on the same machine, or when you wish to automate the process. Or when you wish to automatically deploy one Sitecore instance for several developers in a shared environment.

    Like

  9. Gee says:

    how to make sure Sitecore is using MongoDB. I still have my core, master and web databases pointing to SQL express. what do i need to change so it points to MongoDB?
    Thanks for your response.

    Like

  10. briancaos says:

    Your CORE, MASTER and WEB databases are still SQL Server based.
    The ANALYTICS database is replaced by a SQL server based REPORTING database (although Sitecore have named that database ANALYTICS, kind of confusing).
    The xDB Mongo based databases are therefore ANALYTICS, TRACKING.LIVE, TRACKING.HISTORY. Are you using ECM? Then there is a ECM.DISPATCH database in Mongo as well.

    Like

  11. AG says:

    Is there a separate licensing cost for xDB apart from Sitecore itself?

    Like

  12. briancaos says:

    No, xDB is a MongoDB which is Open Source and licensed under GNU AGPL 3.0: http://www.mongodb.org/about/licensing/

    Like

  13. Manish says:

    I’m not getting any data in Experience profile (Anonymous). Getting data in Experience Analytics.

    I have installed mongdb as a service. Using default Connection strings when installed sitecore update3.

    Please suggest what would be the root cause of this issue.

    Like

  14. briancaos says:

    If the collections have been created in your MongoDB instance, there is a connection.
    But data is only written to xDB when your session ends, which means 20 mins after your user have done nothing. So you either have to set the session timeout to 1 minute or wait at least 20 mins.

    Like

  15. Pingback: Sitecore 8 and Tracker.Current.Session.Identify – Overriding expired contact session lock for contact id | Brian Pedersen's Sitecore and .NET Blog

  16. Pingback: 10 Steps to Setup MongoDB as a Windows Service with Sitecore 7.5+ | Sitecore Sandbox

  17. Pingback: Sitecore xDB demystified – Useful mongo database queries – Anders Christian Ellegaard Gjelstrup

  18. Pingback: Sitecore MongoDB blog series: Part 1-Introduction to MongoDB in Sitecore – Ankit Joshi's Sitecore Blog

  19. Pingback: Sitecore 7.5 and MongoDB through different environments | Sitecore Xperiences

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.