Search code examples
solrcentos7data-migrationsolr4solr6

Migration of solr cores after solr version upgradation from 4.10.4 to 6.6.0 on Cent os 7


I have upgraded apache solr from 4.10.4 to 6.6.0 on Cent os 7 server, with the help of Upgrade Apache Solr from 4.10.4 to 6.6.0 on Cent os 7

I have taken backup of old solr core namely sample_core in /home/user/old_solr/sample_core folder

How can I migrate my old solr(4.10.4) data in new solr version (6.6.0)


Solution

  • Make sure solr is running

    sudo service solr status
    

    Create new solr core by name sample_core

    use solr user sudo su solr

    Create sample_core /opt/solr-6.6.0/bin/solr create -c sample_core

    If you are not able to create a new core due to existing broken core, remove broken cores

    /opt/solr-6.6.0/bin/solr delete -c <core_name>
    /opt/solr-6.6.0/bin/solr delete -c sample_core
    

    delete data folders from /var/solr/data/< core_name > folder (If exists)

    exit solr user and use superuser by command exit

    use root user by command sudo su

    rm -r -f /var/solr/data/sample_core
    

    copy existing solr schema.xml and solrconfig.xml to newly created core

    use superuser sudo su

    sudo cp -r /home/user/old_solr/sample_core/conf/schema.xml /var/solr/data/sample_core/conf
    sudo cp -r /home/user/old_solr/sample_core/conf/solrconfig.xml /var/solr/data/sample_core/conf
    

    make solr as owner to moved files

    sudo chown -R solr:solr /var/solr/data/sample_core/conf/schema.xml
    sudo chown -R solr:solr /var/solr/data/sample_core/conf/solrconfig.xml
    

    restart solr server

    sudo service solr restart
    

    Reindex solr data

    Now you are ready to reindex solr data, reindexing solr data after upgrading solr version will give best performance without any unknown issues.

    Incase if you want to use old data without reindex

    I have not tried this practically while migration

    copy sample_core data from backup to solr 6.6 data

    sudo cp -r /home/user/old_solr/sample_core/data /var/solr/data/sample_core
    

    change owner to solr

    sudo chown -R solr:solr /var/solr/data/sample_core/data