Defining a backup target in solr.xml

If you want to to define or modify a backup target, you can do it by downloading, editing, and reuploading the solr.xml file from ZooKeeper.

The solr.xml file of your Solr installation, which is stored in ZooKeeper, can define a backup target repository, and depending on your installation it likely has a default target pointing to HDFS.

HDFS as a backup target is still fine even if your Solr collection uses a local file system (FS) / NRTCachingDirectoryFactory, so even with local FS collections you can store your backups on HDFS.

Similarly to this, other repositories like a LocalFileSystemRepository can also be defined in the solr.xml if you want to store the backups on a location other than HDFS.

If the solr.xml does not have a backup repository at all, it defaults to the local FS repository.

  1. To define or modify a backup target, download the solr.xml file from ZooKeeper using the following solrctl command:
    solrctl cluster --get-solrxml solr.xml
  2. Edit the contents of the solr.xml file.
    This is an example of defining a HDFS backup target in the solr.xml file:
    <backup>
      <repository name="hdfs" class="org.apache.solr.core.backup.repository.HdfsBackupRepository" default="false">
        <str name="location">${solr.hdfs.default.backup.path}</str>
        <str name="solr.hdfs.home">${solr.hdfs.home:}</str>
        <str name="solr.hdfs.confdir">${solr.hdfs.confdir:}</str>
      </repository>
    </backup>
  3. Reupload the modified solr.xml file:
    solrctl cluster --put-solrxml solr.xml