Apache Solr 7.5 Build book_store index backup / restore


If you are worried about data loss, and of course you should be, you need a way to back up your Solr indexes so that you can recover quickly in case of catastrophic failure.

Solr provides two approaches to backing up and restoring Solr cores or collections, depending on how you are running Solr. If you run in SolrCloud mode, you will use the Collections API. If you run Solr in standalone mode, you will use the replication handler.


The backup API requires sending a command to the /replication handler to back up the system.

You can trigger a back-up with an HTTP command like this (replace “gettingstarted” with the name of the core you are working with):



The backup request can also take the following additional parameters:


The path where the backup will be created. If the path is not absolute then the backup path will be relative to Solr’s instance directory.


The snapshot will be created in a directory called snapshot.<name>. If a name is not specified then the directory name would have the following format: snapshot.<yyyyMMddHHmmssSSS>


The number of backups to keep. If maxNumberOfBackups has been specified on the replication handler in solrconfig.xml, maxNumberOfBackups is always used and attempts to use numberToKeep will cause an error. Also, this parameter is not taken into consideration if the backup name is specified. More information about maxNumberOfBackups can be found in the section Configuring the ReplicationHandler.


The name of the repository to be used for the backup. If no repository is specified then the local filesystem repository will be used automatically.


The name of the commit which was used while taking a snapshot using the CREATESNAPSHOT command.


Backup status:

The backup operation can be monitored to see if it has completed by sending the details command to the /replication handler, as in this example:




Now lets have a look in the Solr’s instance directory:

And there we have and the name/ localtion/etc according to the documentation, lets make a new backup and add a name to it.


And there we have it.

Next step, delete all items and restore from snapshot.backup1:

Delete and check that all is removed:

Now, for the magic, lets restore:



And here the index is back…..



Next Standalone Mode Backups:

Backups and restoration uses Solr’s replication handler. Out of the box, Solr includes implicit support for replication so this API can be used. Configuration of the replication handler can, however, be customized by defining your own replication handler in solrconfig.xml