Backing up a WebSphere Commerce Search index
We can create a backup of the search index, so that we can roll back to a previous version of the search index at any time.
Before beginning
- To be able to use the Solr capabilities of creating backups of the search index, configure the ReplicationHandler in the solrconfig.xml file for every index core we want to back up. For more information about this approach, see Index Replication.
- Creating backups by using Solr APIs requires web access to every host where a backup is required. Therefore, configure the web server to provide this access.
Note: To manage the number of backups that are created, ensure that you configure an appropriate maxNumberOfBackups value.
Procedure
- To back up a search index:
- Create a backup of the search index by running the Solr backup command on the search server:
- http://search_master_hostname:search_master_port/solr/core_name/replication?command=backup
A time-stamped snapshot directory is created containing the backed up index.To configure Solr to automatically create backups during replication, add the following line to the replication handler configuration:
<str name="backupAfter">commit</str>Where, for example, the backup is created after commit operations. Other acceptable values are commit and startup. See Solr Replication.
Note:
- The backupAfter operations are typically triggered on an indexing server. Therefore, they are only applicable on a master server.
- The numberToKeep parameter is required when using the backup command on a repeater or subordinate server.
To restore a search index backup:
- Make a copy of the backup to be used as the active index, to avoid issues such as losing or corrupting the backup. Rename the copy of the backup by using a different naming convention. For example, name the backup copy index.20140813015425244, if we are restoring the snapshot.20140813015425244 backup.
- Create an index.properties file at the same level as the index directory. For example, data/index.properties.
- In the index.properties file, define a new property that points to the backup index location. For example, index=snapshot.20140813015425244.
- Save our changes and close the file. Ensure that the user has the correct permissions to access the file. For example, the WebSphere Application Server user.
- Run the CoreAdminHandler RELOAD command to reload the core. See CoreAdmin: Reload.
For example: http://host_name:port/solr/admin/cores?action=reload&core=MC_Master_Catalog_ID_CatalogEntry_en_US
- Ensure that the new index is the active index by verifying the directory value using the core information URL
For example: http://host_name:port/solr/admin/cores?core=MC_Master_Catalog_ID_CatalogEntry_en_US