Category Archives: MongoDB

How To Setup, Configure, and Connect to xDB Cloud 2.0 – Part 1

In this post, I am going to run through my experience of setting up, configuring, and connecting to xDB Cloud 2.0. However, this is going to be a multi-post, because there are some steps that you need to take place so you can have the xDB Cloud set provisioned before you can connect. Once we get through the initial setup and provisioning by Sitecore, we will  go a little deeper on the connection that may need to take place depending on your environment.

First, I started my journey off by taking a look at some basic documentation on xDB Cloud and realized that I needed to use Version 2.0 as seen below, since the agreement was signed before July 21st:

Use Version 2 Instead of Version 1

Use Version 2 Instead of Version 1

Once I knew I needed to work with Version 2, I started looking through some documentation on Version 2 specifically here. When looking through the overviews, I needed to find out what xDB Cloud Set was compatible with my version of Sitecore, which is Sitecore 8.1 rev.160302 (Update 2). The xDB Cloud Service Compatibility Tables can be found here. I see that my version is supported for creating new xDB Cloud Sets and keep on trucking.

I move on to the “Connect to xDB Cloud 2.0” documentation. My Prerequisites are met so my next step is to “Request the xDB Cloud Customer Set” by putting in a Sitecore Support ticket with the following information:

  • License ID (Sitecore License ID & xDB License ID)
  • Deployment ID (This is the name you want to give to the set i.e. “companynameprod1”)
  • Sitecore Version (Sitecore 8.1 rev.160302 (Update 2)
  • Preferred Location (West US)

Then I waited for Sitecore Support to get back to me with the connection strings, and reporting service settings.

In Part 2, we will take a look at making the connections, and any other configurations that may need to take place to connect to your xDB Cloud set.

No Analytics Tracking in Sitecore 8.1

Recently, I was diagnosing an issue as to why Sitecore Analytics was not working for one of our 8.1 recent installations. I started with this helpful blog post by one of the guys at nonlinear digital:

http://www.nonlinearcreations.com/Digital/how-we-think/articles/2015/10/Troubleshooting-Sitecore-8-XP-Analytics.aspx

Well, after thoroughly going through all the steps my analytics were still not working and no data was being received by MongoDB in my Interactions collection and my Reporting database (analytics) was not receiving any data. After speaking with Sitecore Support, they mentioned that in the Global.asax file you must derive from the Sitecore.Web.Application to support the session end handler. When I checked my Global.asax it was set to derive from System.Web.HttpApplication. Once I set to derive from Sitecore.Web.Application this cleared up a couple of errors within the solution relating to the VisitorIdentification SitecoreHelper for MVC (@Html.Sitecore().VisitorIdentification()) and using statement (@using SItecore.Mvc.Analytics.Extensions). But most important, tracking started working as my collections in MongoDB and Reporting DB started receiving data.

Moral of the story, don’t miss this step upon setup of your solution in the beginning of your setup to work with Sitecore 8 as it will prove hard to diagnose. Hopefully, this helps out others who run across this situation. Happy coding!

10 Steps to Setup MongoDB as a Windows Service with Sitecore 7.5+

If you are doing development work with SItecore 7.5+ and beyond, you may want to set up MongoDB to connect to Sitecore locally or on your DEV, QA, STAGING servers. This is just a brief tutorial on the steps needed to set up MongoDB on your as a service, and then validate that it is connected to your local SItecore instance via RoboMongo. This post relates to Sitecore versions 7.5 and up.

  1. Download the MongoDB installer here: MongoDB
  2. Install 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 installed to D:/MongoDB/.
  3. In the folder “MongoDB” create a folder called “data” and inside that folder, create a folder called “db”. These will not be created for you during install so you will need to create them.
  4. Create a new .config file in the “MongoDB” folder and name it “mongo.config”. This is where we will store the configurations for MongoDB.
  5. Copy/paste the configuration into the new “mongo.config” file and modify to your specific workstation:
    dbpath=D:\MongoDB\data\db
    logpath=D:\MongoDB\log\mongo.log
    smallfiles=true
  6. Next, look in the “MongoDB” folder. You may need to create the “log” folder and put a “mongo.log” file in the that folder for the next line to succeed if it was not created during the installation of MongoDB.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 filepaths):
    D:\MongoDB\bin\Mongod.exe --config D:\MongoDB\mongo.config --install
  7. This will create a new windows service called MongoDB. Now, to start the service simply type in the following:
    net start MongoDB
  8. You can use GUI tools like RoboMongo to work with Mongo data. Typically, Sitecore connections strings are already setup OOTB so you really just need to set up MongoDB. If you want to verify that your data is being stored then simply download RoboMongo. The example below is using MongoVUE, but I don’t recommend as it has been problematic in the past to download from their website. However, the process is basically the same for RoboMongo.
  9. Once installed you simply click the green plus icon to add a connection, then type in the name of the connection, and the server. Since, you this is on your local workstation you will use localhost OR 127.0.0.1 then save.

    Add Connection In MongoVUE

    Add Connection In MongoVUE

  10. Now you should be able to see your connection listed in MongoVUE, and if you expand the connection you will see your tables and data being captured from Sitecore.

    Sitecore Experience Data Is Connected

    Sitecore Experience Data Is Connected

During the making of this blog post, I referred to these blog posts below, which helped me to achieve setting up my local developer workstation to run MongoDB as a Windows Service and connect it to a Sitecore 7.5+ instance. One last thing, if you are using SIM (Sitecore Instance Manager), you can also perform all the above in one click. Happy coding!

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

Install MongoDB on Windows:
http://www.mkyong.com/mongodb/how-to-install-mongodb-on-windows/