Showing posts with label MongoDB. Show all posts
Showing posts with label MongoDB. Show all posts

Monday, 18 July 2016

Sitecore error while rebuilding reporting database

4 comments
Recently I stuck with following issue while rebuilding reporting database: (FYI, Reporting database can be rebuild by visiting url <sitename> /sitecore/admin/RebuildReportingDB.aspx)
Connection string used by aggregation/historyTaskManager/ReportingStorage is missing.
Sitecore xDB uses SQL Server and MongoDB which need to be kept in sync to provide accurate data for various Sitecore reporting applications.
  • MongoDB collection database - This stores all captured experience information from your website in a loosely structured way.
    MongoDB collection database connection string:
    <add name="analytics" connectionString="mongodb://localhost/analytics"/>
  • SQL Server primary reporting database - stores information extracted from the collection database in a form suitable for reporting.
    Primary reporting database connection string:
    <add name="reporting" connectionString="user id= _sql_server_user;password= _user_password_@123;Data Source=(local);Database=Sitecore_Analytics"/>
By default Sitecore xDB must always keep the reporting database in sync with the collection database but there are certain circumstances when you may need to perform a complete rebuild of the reporting database. Check here various reasons for rebuilding reporting database.

When you rebuild the reporting database, to avoid disruption during the rebuild process, you connect a Secondary reporting database (SQL Server) to store all aggregated data as it is reprocessed. Secondary reporting database stores historical data during the rebuilding of the reporting database.

Secondary reporting database was not configured in my scenario therefore I was facing above error. Perform below steps to connect and configure a secondary reporting database:
  1. Take a clean copy of the Sitecore_Analytics database from your Sitecore distribution to use as your secondary reporting database. 
  2. Attach this database to SQL server instance and name it Sitecore_ Analytics_Secondary.
  3. Open your connectionstrings.config file and add a reference to you secondary reporting database. Use the name reporting.secondary in the connection string.
    <add name="reporting.secondary" connectionString="user id= _sql_server_user;password= _user_password_@123;Data Source=(local);Database= Sitecore_ Analytics_Secondary "/>
Rebuild the reporting database and above error should be gone now. Comments and suggestions are most welcome. Happy coding!

Related articles:
  1. Rebuilding the reporting database 
  2. Reasons for rebuilding the reporting database 
  3. xDB Processing overview
  4. Troubleshooting xDB data issues
Read More...

Saturday, 25 April 2015

How to use Sitecore XP without xDB

4 comments
This is small blog post about how to configure and use Sitecore XP without xDB. If you have installed Sitecore 8 and you haven’t configured MongoDB then you might face various related to Sitecore.Analytics.MongoDB. You may face issues like package installer is going in infinite loop and item is not converting into Item Bucket. You can always check Sitecore log files for detailed error information. Below steps are required to use Sitecore 8 without xDB:
  • Disable Sitecore Analytics. Naviagte to /App_Config/Include/Sitecore.Analytics.config and set Analytics.Enabled to false:
    <setting name="Analytics.Enabled" value="false" />
  • Comment out analytics related connection strings. Navigate to /App_Config/ConnectionStrings.config and comment out the following connection strings:
  • <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="tracking.contact" connectionString="mongodb://localhost/tracking_contact" />
    <add name="reporting" connectionString="user id=user;password=password;Data Source=(server);Database=Sitecore_Analytics" />
    
Check Sitecore Knowledge Base article to know more about what features are functional or non-functional or partial functional when xDB is disabled. This article will be updated continuously by Sitecore team.

Comments and suggestions are most welcome. Happy coding!   
Read More...

Sunday, 15 March 2015

How to create a Window Service for MongoDB

5 comments
From Sitecore 7.5 onwards MongoDB will be used as the new collection database for the Sitecore Experience Database (xDB). In the xDB, the collection database acts as a primary storage or central repository for storing contact, device, interaction, history and analytics information. In this blog post I am going to explain how to install MongoDB on Windows and how to create a Window Service for MongoDB that starts MongoDB automatically at boot time.
  1. Download the latest stable production release installer file (.msi) of MongoDB from the MongoDB download section. Ensure you download the correct version of MongoDB (32 Bit or 64 Bit) for your Windows system.
  2. Double click on downloaded .msi installer file. You can specify a different installation directory if you choose the “Custom” installation option. I’ve installed MongoDB 3.0.0 version to C:\mongodb.
  3. You can set up the MongoDB server as a Windows Service that starts automatically at boot time. If you have installed MongoDB in different installation directory, you have to modify the paths as appropriate in next configuration steps.
  4. Open command prompt with administrator privileges. MongoDB requires a data directory to store all data. MongoDB’s default data directory path is \data\db.
  5. Create directories for your database and log files. Execute below commands in command prompt:
    mkdir c:\mongodb\data\db
    mkdir c:\mongodb\data\log
  6. Create a configuration (.cfg) file. This file includes configuration options for mongod but it must include a valid setting for logpath and dbpath. The following command creates a configuration file, specifying both the logpath and the dbpath settings in the configuration file with respect to your installation directory:
    echo logpath=c:\mongodb\data\log\mongod.log> "C:\mongodb\mongod.cfg"
    echo dbpath=c:\mongodb\data\db>> "C:\mongodb\mongod.cfg"
  7. Create the MongoDB service by executing below command.
    sc.exe create MongoDB binPath= "\"C:\mongodb\bin\mongod.exe\" --service --config=\"C:\mongodb\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"
    sc.exe requires a space between “=” and the configuration values (eg “binPath= ”), and a “\” to escape double quotes. The  following log message will display once MongoDB Service is successfully created:
    [SC] CreateService SUCCESS
  8. Start the MongoDB service by typing below command:
    net start MongoDB
    you’ll get below log message once MongoDB service is successfully started.
    The MongoDB service was started successfully.
Comments and suggestions are most welcome. Happy coding!
Read More...