How I dealt with Sitecore 9 and Solr 6.6.1 lock issue

Sometimes I feel as if computers get emotional. I mean, they get angry and start messing with your work. Also, they start breaking things that weren’t supposed to break. This week, my computer decided to break one of the Solr indexes used by a Sitecore 9 installation.

I got into the same situation as this folk here.

I noticed that Sitecore Forms stopped to show the forms and templates that I had created (again). I checked the logs and saw the error below.

SolrException Error opening new searcher
Figure 1: Solr loga

From what I could find, it seems to be a bad error message due to a corrupted index. The index corruption might have been caused by a failure during the computer restart process. As I recall, I restarted my computer due to a required Windows update.

To fix that, I did the following:

1. Stopped Solr Service

<br>net stop Solr6<br>

Sitecore 9 requires you to install Solr and configure it to run as a Windows service. On top of that, you must enable SSL for Solr. Learn more at Walkthrough: Setting up Solr.

2. Deleted Solr index folders (all of them)

Solr Sitecore Indexes
Figure 2: Solr – Index folders

3. Stopped Sitecore Windows Services

SolrException Sitecore Windows Services
Figure 3: Sitecore 9 – Windows Services

Sitecore Installation Framework install alongside with Sitecore XP 9, the Sitecore Marketing Automation Engine and Sitecore XConnect Search Indexer as a Windows Service for every Sitecore instance.

The Marketing Automation Engine is a stand-alone service that is responsible for enrolling contacts in plans and activities. The xConnect Search Indexer is responsible for adding contact and interaction data to the xDB search index.

4. Run a Powershell Script to re-create all the Solr Indexes

<br>#define parameters<br>$prefix = "Box_Sitecore9"<br>$PSScriptRoot = "X:\Sitecore\SIF\Sitecore 9.0.0 rev. 171002"<br>$SolrUrl = "https://localhost:8989/solr"<br>$SolrRoot = "X:\Solr"<br>$SolrService = "Solr6"</p><p>#install solr cores for xdb<br>$solrParams = @{<br> Path = "$PSScriptRoot\xconnect-solr.json"<br> SolrUrl = $SolrUrl<br> SolrRoot = $SolrRoot<br> SolrService = $SolrService<br> CorePrefix = $prefix<br>}<br>Install-SitecoreConfiguration @solrParams</p><p>#install solr cores for sitecore<br>$solrParams = @{<br> Path = "$PSScriptRoot\sitecore-solr.json"<br> SolrUrl = $SolrUrl<br> SolrRoot = $SolrRoot<br> SolrService = $SolrService<br> CorePrefix = $prefix<br>}<br>Install-SitecoreConfiguration @solrParams<br>

5. Started Sitecore Windows Services

The Marketing Automation Engine and the xConnect Search Indexer services need to be started again.

6. Populate Solr Managed Schema

Solr uses a defined schema when it works with documents. You can modify an existing schema with the Populate Solr Managed Schema tool. This tool automatically populates Sitecore fields and makes sure all fields that Sitecore needs are present. Learn more at Solr managed schemas.

In the Sitecore Launchpad, click on Control Panel, and then, in INDEXING group, click on Populate Solr Managed Schema.

Populate Solr Managed Schema
Figure 4: Sitecore 9 – Populate Solr Managed Schema

7. Reindex everything

In the Sitecore Launchpad, click on Control Panel, and then, in INDEXING group, click on Indexing Manager. Select all indexes and rebuild them all.

That fixed the issue for me.

Update

As recommended in the Sitecore 9 – Update 1 documentation, I installed the Solr 6.6.2 and I’ve never had this problem again.

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s