Backing up a HCL Commerce Search index

You can create a backup of the search index, so that you can roll back to a previous version of the search index at any time.

Before you begin

  • 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 you 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, you must 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:
    1. 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 that contains 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. For more information, 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 you use the backup command on a repeater or subordinate server.
  • To restore a search index backup:
    1. 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 you are restoring the snapshot.20140813015425244 backup.
    2. Create an index.properties file at the same level as the index directory.
      For example, data/index.properties.
    3. In the index.properties file, define a new property that points to the backup index location.
      For example, index=snapshot.20140813015425244.
    4. Save your changes and close the file. Ensure that the user has the correct permissions to access the file.
      For example, the WebSphere Application Server user.
    5. Run the CoreAdminHandler RELOAD command to reload the core. For more information, see CoreAdmin: Reload.

      For example: http://host_name:port/solr/admin/cores?action=reload&core=MC_Master_Catalog_ID_CatalogEntry_en_US

    6. Ensure that the new index is the active index by verifying the directory value by using the core information URL

      For example: http://host_name:port/solr/admin/cores?core=MC_Master_Catalog_ID_CatalogEntry_en_US