Moving from Solr 3.x to Solr 5.5.x
I have spent a few days trying to translate the configs from a Solr 3.x instance to Solr 5.5.x. The process was a bit devastating and consumed a lot of time. I did a lot of googling and browsing the documentation but I haven’t found one place with all the information essential to get things going. This is a summary of what I have done and what might be helpful for others. Let’s go!
TL;DR Remove everything and use the default solr.xml
found in $SOLR_HOME
for the new version. There are multiple changes to the solr.xml
file. Solr has introduced cores autodiscovery so all <core>
definitions can be removed. More on cores autodiscovery in the next step. The server persistency flag persistent="(true|false)"
has been deprecated and have to be removed. Cores with proper config files will be persisten by default.
🚀 Cores
Copy old core(s) configuration directories into **$SOLR_HOME**
. By default this will be the directory where solr.xml
resides. For each core configuration copy the old directories to the $SOLR_HOME
. The database data folder can stay the way they were in the old version, you will specify it’s folder later on. Create an empty core.properties file in the main core directory. By default solr will only autodiscover the cores which have the file present. The file has to exist and can be empty. The created core will have the same name as the directory the file is in. If you want to change it’s name or add other configuration options place them separately in each line in a simple key=value
manner. It is explained quite well in the solr documentation. This is the place you should define the data directory for each core if it is not inside the core configuration directory. E.g. config with a core name and data directory defined:
In the **conf/solr.xml**
file remove all occurances of **enablePositionIncrements**
with arguments. The parameter has been deprecated in Solr 4 and can’t be used. If you happen to need this setting you should take a look at this thread on Solr jira. Remove all definitions of fields for older versions of Solr. The fields are usually documented with comments about consistency with older versions. I had to remove all this from my schema.xml
to get my instance working:
Change **luceneMatchVersion**
in **solrconfig.xml**
file to the solr version you have installed. The core won’t work if the luceneMatchVersion
won’t be changed to… match the current solr version. So for me it was 5.5.0. Change directory ownership. Check if all the cores directories belong to the solr user and change the ownership with chown -R solr: $SOLR_HOME
🚀 First run & debugging
After making all these changes run your newly created instance or restart it if it was already running and go to admin to check that your cores were loaded. If they were not loaded and you can’t seem to find any information on what has happened try loading the core manually from the admin. It should show you the errors with core initialization with the erroring files specified.
🚀 HTTP requests to the Solr server
In the code making requests to Solr you will need to remove all ContentType
definitions. Solr 5 doesn’t accept passing ContentType in GET as well as POST requests.
🎉 All set!
This is it, let me know if you had any other problems and I will happily add more information. It seems Solr is not a pleasant piece of software at times 😎