Diagnose Solr connectivity issues on production

This blog post is for you if you find the following warnings in Sitecore logs:

  • [Index=<indexname>] Crawling Paused
  • [Index=<indexname>] Synchronous Indexing Strategy is disabled while indexing is paused.
  • IndexingStateSwitcher: Indexing is not resumed since indexes have not been initialized yet…
  • Exception: SolrNet.Exceptions.SolrConnectionException, Message: Unable to connect to the remote server

You can see from these log messages that something is really not right with Solr or SolrCloud.

What happened in my case:

  1. Sitecore could not reach our SolrCloud
  2. After the second try Sitecore paused indexing for each indexes
  3. After Sitecore could reach our SolrCloud again, it tried to initialize the indexes but it failed for one index because of a wrong configuration (typo in the core name)
  4. Because of the failure of one index, Sitecore kept the indexing paused

How did I diagnose this? I implemented a small Razor view where I asked the following things from Sitecore:

  • Current status of Solr connection
  • Last status of Solr connection which saved
  • Get Solr indexes and their IsInitialized property
    • If an index is IsInitialized=false, then tried to initialize
@using System.Reflection
@using Sitecore.ContentSearch
@using Sitecore.ContentSearch.SolrProvider
@using Sitecore.ContentSearch.SolrProvider.Agents
<html>
<body>
Solr Status: @SolrStatus.OkSolrStatus()
<br />
Solr Last Status: @typeof(IndexingStateSwitcher).GetField("lastSolrConnectionStatus", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance | BindingFlags.FlattenHierarchy).GetValue(null)
<br />
Solr Indexes
<table>
<thead>
<tr>
<th>Name</th>
<th>IsInitialized</th>
</tr>
</thead>
<tbody>
@foreach (AbstractSearchIndex index in ContentSearchManager.Indexes)
{
<tr>
<td>@index.Name</td>
<td>@index.IsInitialized</td>
@if (!index.IsInitialized)
{
index.Initialize();
}
</tr>
}
</tbody>
</table>
</body>
</html>

I copied this file to the production CM server (it does not cause an application restart) to the sitecore/admin folder and then called the <domain>/sitecore/admin/solr-diagnostic.cshtml.

Don’t forget to delete this file after you are done with the diagnose!

2 thoughts on “Diagnose Solr connectivity issues on production

  1. Hi Tamas,

    This is exactly what I’ve observed in my own environment. It’s initialising indexes that I no longer need. Would you by chance know how I can disbable initialisation of those indexes or disable them all together? I haven’t been able to find a definitive guide and Sitecore support doesn’t seem too helpful either.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s