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.
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 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:
-
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.
-
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 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.
-
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
-
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