Disappearing cores in Solr after restart

You are setting up Solr cores, and it is getting disappeared on restart. Is this happening with you? Yes, It did happen to me as well when i got a chance to setup Solr for one of the Sitecore project.

I installed Solr 6.2 and completed all the installation and configuring steps. Than i started to create multiple cores for multiple indexes (Sitecore indexex like master/web/core/analytics etc.).

I created first core by copying the folder “configsets\basic_configs\conf” as per instructions and renamed it to relevant index say “sitecore_master_index”. I created a core for it in Solr using Solr admin UI. Everything works fine (even after restart 🙂). Than i started to create multiple cores for other indexes (core/web/analytics) by copying “sitecore_master_index” folder. I was able to create cores and it was working fine. When i came to office next day than i realized that cores are not showing in Solr admin UI.

What is the solution?

I tried many options to persist my cores, yes i also tried to add property persistent=”true” to <solr> node in Solr.xml, but no luck there too.

Than after fighting a lot, in logging tab i saw an error mentioning that Multiple cores found with the name “sitecore_master_index” while discovering cores. Here is an interesting fact about how Solr finds the core: “In older versions of Solr, cores had to be predefined as <core> tags in solr.xml in order for Solr to know about them. Now, however, Solr supports automatic discovery of cores and they no longer need to be explicitly defined. The recommended way is to dynamically create cores/collections using the APIs.”

As i got to know that issue is there with the name of cores, i checked the “core.properties” file inside other core folders like sitecore_core_index, sitecore_web_index, sitecore_analytics_index etc. and i found that name property having same value as sitecore_master_index as shown in below image:

solr1

Which was causing the issue while discovering cores. Giving unique core names solved the all issues and cores getting persisted after restart without specifying persistent=”true” property in Solr.config.

Please also specify if you faced similar situation and solved the issue in a different way, will be interesting to hear that.