Sitecore MongoDB Blog series: Part 1-Introduction to MongoDB in Sitecore

Sitecore introduced MongoDB in it’s ecosystem to solve the problem of scaling analytics, let’s try to understand MongoDB from Sitecore prespective, and see how it’s useful and where exactly it sit in the Sitecore system, we will have series of three posts where we will start with the introduction about it, it’s features, advantages, setting up MongoDB in your environment.

In the second series we will talk about contacts and some of the out of the box queries, and will to understand MongoDB collection, and in the final post we will see how we can create custom facets to extend MongoDB functionality.

mongodb

Introduction to MongoDB

Sitecore 7.5 introduced MongoDB as the main datastore for the Sitecore Experience Database (xDB). Sitecore xDB allows organizations to collect all of their customer interactions from all channels to create a comprehensive, single view of the customer that allows marketers to better optimize the customer experience in real-time.

Following are some of the features of MongoDB:

  • Open source
  • NoSQL
  • Document oriented database.
  • Primarily used for collecting data and information about visitors(for analytics)
  • Visitors and their interactions are written to MongoDB in JSON format, which then processed by an aggregation pipeline into a format that is used for reporting.

There are several advantages and benefits with MongoDB, some of them are listed below:

  • Scalability
    • Standalone environment
    • Vertical Scaling and
    • Horizontal Scaling
  • Performance
  • Flexibility
  • Unstructured data and Schemas

Scaling is one of the critical feature in Sitecore, and we will discuss about all different scaling options in the next series of this post, where we will talk more about horizontal scaling and how MongoDB uses it to make sure the availability of data.

Installing MongoDB:

Let’s take a look, how you can install MongoDB:

Please follow the below steps, to install MongoDB.

  1. Download MongoDB as per your Sitecore version, you can see more details here: https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/xdb/platform/software_recommendations and
  2. https://kb.sitecore.net/articles/633863
  3. Next, you need to install Mongo, you can do it either in default installation path (C:\Program Files\MongoDB\Server\mongo version), or in custom path like (D:\Mongo\..)
  4. Create data and db folder:
    1. C:\Program Files\MongoDB\Server\3.0\data
    2. This folder is not created by default during installation, we need to install this.
    3. Once this folder is create, please create db folder under this.
  5. Create logs folder:
    1. C:\Program Files\MongoDB\Server\3.0\logs
  6. We can create a new config file where we specify db and logs folder, and this file will be used to install MongoDB as a service, so that it will start everytime when we start/boot windows.
  7. In this example, I have created a new folder “config” and added config file under that.
  8. C:\Program Files\MongoDB\Server\3.0\config
  9. Please use the below snippet and save make sure to change the db and log location, as per your environment location.mongoconfig
  10. C:\Program Files\MongoDB\Server\3.0\config\mongod-3.0.cfg
  11. Open up a Command Prompt (Run As Administrator), and navigate to bin folder
    1. C:\Program Files\MongoDB\Server\3.0\bin
  12. Run the following command to create MongoDB as a service:
  13. mongod –config=”C:\Program Files\MongoDB\Server\3.0\config\mongod-3.0.cfg” –install –serviceName=”MongoDB 3.0″
  14. Go to services and look for “MongoDB 3.0”, click startMongoDBService

Connection Strings:

mongo_connectionstring

  • name – analytics,tracking.live, tracking.history and tracking.contact.
  • mongodb prefix
  • servername- in case of local, it’s default to localhost
  • Mongo database(collection name)

Note:

This is for replicate set

mongo_connectionstring_replicaset

This is how contact looks in Mongo, and some out of the box properties.

contactcard

Hope this helps to give you base level understanding about MongoDB in Sitecore, and how to install MongoDB as windows service.

In the next post, we will see how we can scale MongoDB in Sitecore, and also closer look of contacts,collection and some queries to get data out of it.

Let me know your comments and feedback on the same, and anything which want to me cover specifically.

References:

https://briancaos.wordpress.com/2014/10/01/sitecore-and-xdb-setting-up-mongodb-on-your-developer-machine/

Happy learning 🙂

Advertisements