Back up and restore Solr

When you use the backupSolr and restoreSolr toolkit tasks to back up and restore the Solr index and ZooKeeper configuration, a call to the Solr REST API is made. The toolkit tasks create and restore a full backup of the non-transient Solr collections.

Intro

  • The non-transient Solr collections are backed up and restored by using the provided toolkit tasks. The following collection types are non-transient:

    • main_index

    • match_index

    • chart_index

  • You must take the Solr backup before a database backup, and you must restore Solr after you restore the database.

Backup location

In the environment.properties file, the backup.solr.location.dir setting is the location where the Solr index and ZooKeeper configuration backups are created and restored from. This location must be accessible by every Solr node in your deployment.

Toolkit tasks

  • backupSolrThe backupSolr toolkit task backs up the Solr index and ZooKeeper configuration to the backup.solr.location.dir location.For example:

    setup -t backupSolr
  • restoreSolrThe restoreSolr toolkit task restores the Solr index and ZooKeeper configuration from a backup. You must pass the timestamp parameter to the toolkit task with a value for a backup in the backup.solr.location.dir location.You must also specify the hostname parameter, with the hostname of the Liberty server where you are running the command, and that matches the value for the host-name attribute of the <application> element in the topology.xml file. For example:

    setup -t restoreSolr -p timestamp=<timestamp> --hostname <liberty.hostname>

Backup files

When the backupSolr task is run, a directory is created named i2a-solr-<collection_name>-<timestamp> where <timestamp> is the timestamp of when the toolkit task was run and <collection_name> the name of the Solr collection backed up. A directory is created for each non-transient Solr collection, with each collection containing a back up. For example:

- i2a-solr-chart_index-20210420145332
    - backup.properties
    - snapshot.shard1
    - snapshot.shard2
    - zk_backup
- i2a-solr-main_index-20210420145332
    - backup.properties
    - snapshot.shard1
    - snapshot.shard2
    - zk_backup
- i2a-solr-match_index1-20210420145332
    - backup.properties
    - snapshot.shard1
    - snapshot.shard2
    - zk_backup
- i2a-solr-match_index2-20210420145332
    - backup.properties
    - snapshot.shard1
    - snapshot.shard2
    - zk_backup