Restore a Solr Collection

Use the following procedure to restore a Solr collection. For more information on the commands used, see Cloudera Search Backup and Restore Command Reference.

If you are using a secure (Kerberos-enabled) cluster, specify your jaas.conf file by adding the following parameter to each command:
-jaas /path/to/jaas.conf
If TLS is enabled for the Solr service, specify the truststore and password by using the ZKCLI_JVM_FLAGS environment variable before you begin the procedure:
export ZKCLI_JVM_FLAGS="-Djavax.net.ssl.trustStore=/path/to/truststore \
-Djavax.net.ssl.trustStorePassword=trustStorePassword"
  1. If you are restoring from a backup stored on a remote cluster, copy the backup from the remote cluster to the local cluster. If you are restoring from a local backup, skip this step.

    Run the following commands on the cluster to which you want to restore the collection:

    hdfs dfs -mkdir -p /path/to/restore-staging
    hadoop distcp <protocol>://<namenode>:<port>/path/to/backup /path/to/restore-staging

    For example:

    • HDFS protocol:
      hadoop distcp hdfs://nn01.example.com:8020/path/to/backups/tweets-201803281043 /path/to/restore-staging
    • WebHDFS protocol:
      hadoop distcp webhdfs://nn01.example.com:20101/path/to/backups/tweets-201803281043 /path/to/restore-staging
  2. Start the restore procedure. Run the following command:
    solrctl collection --restore <restoreCollectionName> -l <backupLocation> -b <snapshotName> -i <requestId>

    Make sure that you use a unique <requestID> each time you run this command.

    For example:

    solrctl collection --restore tweets -l /path/to/restore-staging -b tweets-201803281043 -i restore-tweets
  3. Monitor the status of the restore operation. Run the following command periodically:
    solrctl collection --request-status <requestId>

    Look for <str name="state"> in the output. For example (emphasis added):

    solrctl collection --request-status restore-tweets
     <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"> <int name="status"> 0</int> <int name="QTime"> 1</int> </lst> \
    <lst name="status"> <str name="state"> completed</str> <str name="msg"> found restore-tweets in completed tasks</str> </lst> </response>

    The state parameter can be one of the following:

    • running: The restore operation is running.
    • completed: The restore operation is complete.
    • failed: The restore operation failed.
    • notfound: The specified <requestID> does not exist.