June 5, 2014

Sitecore 7.5 : Setting up xDB without Mongo experience?

As a MVP, I have the chance to test Sitecore 7.5. The main change in this version is the migration of DMS in xDB (Mongo) in place of MsSql. I didn't had any experience at all with mongo or any NoSql database yet so I will share this first experience here.
The first logical step is to downloaded mongo for windows here: http://www.mongodb.org/downloads
Then I will try to follow the steps of this page: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/
For my first test, I have try to run it manually:
  1. I have create a data folder: C:\Program Files\MongoDB 2.6 Standard\data\db
  2. Then in command line I have type the following command:
    cd C:\Program Files\MongoDB 2.6 Standard\bin
     mongod.exe --dbpath "C:\Program Files\MongoDB 2.6 Standard\data\db"
    Two things here:
    • You need to use the mongod.exe and not the mongo.exe. Mongod.exe is the service and mongo.exe the client.
    • If I didn't specify the path to the data folder it doesn't work event if I move it below \bin.

So ok, I have a running mongo server now. But, if I don't want to run it manually each time I restart so, let's configure it as a windows service:
  1. Create a directory for the logs: C:\Program Files\MongoDB 2.6 Standard\logs
  2. Create a new empty file for the configuration: C:\Program Files\MongoDB 2.6 Standard\bin\mongod.cfg and add the following content in it:
    logpath="C:\Program Files\MongoDB 2.6 Standard\logs\mongo.log" 
    dbpath="C:\Program Files\MongoDB 2.6 Standard\data\db"
  3. Now, register the windows service by executing the following command:
    sc.exe create MongoDB binPath= "\"C:\Program Files\MongoDB 2.6 Standard\bin\mongod.exe\" --service --config=\"C:\Program Files\MongoDB 2.6 Standard\bin\mongod.cfg\"" DisplayName= "MongoDB 2.6 Standard" start= "auto"
  4. By curiosity, I do a little check to be sure that the service is registered by typing "services.msc" and this is ok I see that the service: 
  5. To be sure that this service work correctly, let's start it:
    sc.exe start MongoDB
    If you have the message: "The service did not respond to the start or control request in a timely fashion." this probably mean that your cfg file is not correctly
Now, if you want, you can test to add a new db and some records by following this guide: http://docs.mongodb.org/manual/tutorial/getting-started/
Ok now, my mongo service is up and running, let's install Sitecore 7.5! I will not explain every steps here because it is the same as into the previous version but the interesting stuffs for this setup are into the connectionstrings.config. We have now the following connectionstring who use mongo (if you use DMS):

<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" />
<add name="automation.live" connectionString="mongodb://localhost/automation_live" />
<add name="automation.history" connectionString="mongodb://localhost/automation_history" />
<add name="session" connectionString="mongodb://localhost/session" />
For the basic config on my developer's computer this is ok like this. I can run my new instance of sitecore. And.... ok no crash at least :-)
Let's check if my dbs has been created into mongo:
  1. In command line, I type:
    mongo
    Response is:
    MongoDB shell version: 2.6.0
    connecting to: test
    Type:
    show dbs
    Response is:
    admin               (empty)
    analytics           (empty)
    automation_history  (empty)
    automation_live     (empty)
    local               0.078GB
    mydb                0.078GB
    tracking_history    (empty)
    tracking_live       (empty)
So ok! This mean that my dbs has been correctly created!
Let's browse a page or two into the website and check my Experience Profile Dashboard...Bingo! I have a record in my dashboard so it work:

5 comments:

  1. After I install the service I usually use ServiceTray to monitor it. Nice, free tool. http://www.coretechnologies.com/products/ServiceTray/

    ReplyDelete
  2. Nice post, a nice management tool for mongo is http://robomongo.org/

    ReplyDelete
  3. its really awesome information provided by you. You can also get complete info on MangoDB here

    ReplyDelete
  4. You can simplify MongoDB installation using following project:
    http://alienlab.co.uk/mongodb-windowsservice-installer

    ReplyDelete
  5. Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best. Mongo Database Services

    ReplyDelete