Sitecore 8 Rebuilding historical path analyzer maps

I thought I would share and issue and resolution I found recently when rebuilding historical path analyser maps in Sitecore.

How to rebuild Path Analyzer maps

We found it in 8.1 update-2 and may have been fixed in a later release but it looks like there is a potential bug.

The code seems to be querying a config database to get a count. The issue we found with this is that that database doesn't exist and the user we are connecting to the Mongo database with doesn't have read permissions on that non existing database.
The error will be along the lines of

Cannot obtain number of chunks from config database Exception: MongoDB.Driver.MongoCommandException Message: Command 'count' failed: not authorized on config to execute command { count: "chunks", query: { ns: "analytics.Interactions" } } (response: { "ok" : 0.0, "errmsg" : "not authorized on config to execute command { count: \"chunks\", query: { ns: \"analytics.Interactions\" } }", "code" : 13 }) Source: MongoDB.Driver at MongoDB.Driver.Operations.CommandOperation`1.Execute(MongoConnection connection)

A workaround/fix to this is to grant your analytics db admin user read permissions on the database. We are using a mlabs cluster so the steps were as follows:
  1. Log into the mongolabs website and navigate to the admin database for your cluster 
  2. Create an admin/cluster user (This will have the root role which we need to grant the cross database permissions, db users only get the dbowner role) 
  3. In a command prompt with administrator privileges, navigate to your mongodb bin folder on your local machine (cd C:\Progra~1\MongoDB\Server\3.0\bin)
  4. Open up the mongo shell in your local machine and connect to the admin database ([clsuterurl]:[port]/admin -u -p 
  5. The run the following commands 
    • use analytics 
    • db.grantRolesToUser( "[existing_database_admin_user]", [ {role:"read", db:"config"} ] ) 
  6. Then you can delete the cluster admin user you created earlier.
Hope this helps.

Comments

Popular posts from this blog

Sitecore Unicorn standard values field child ID warnings

Sitecore DMS and Analytics Considerations

Sitecore Continuous Integration DMS and the Marketing Centre