I want to write a java client based on SolrJ which pulls the entire core data to a file from a remote Solr server. Later on I want to replay this file to another remote Solr server core.
What is the best method to implement this functionality?
It's now possible with latest Solr versions.
To achieve backup on one Solr Server and restore on another one needs to do the following:
-Dsolr.hdfs.home=...
to be added into start script):<solr>
...
<backup>
<repository name="hdfs-repo" class="org.apache.solr.core.backup.repository.HdfsBackupRepository" default="false">
<str name="location">${solr.hdfs.home}/backup</str>
<str name="solr.hdfs.home">${solr.hdfs.home:}</str>
<str name="solr.hdfs.confdir">${solr.hdfs.confdir:}</str>
</repository>
</backup>
</solr>
SolrClient client1 = ...;
CollectionAdminRequest.Backup request1 = new CollectionAdminRequest.Backup(oldCollectionName, backupName);
request1.setRepositoryName("hdfs-repo");
request1.process(client1);
SolrClient client2 = ...;
CollectionAdminRequest.Restore request2 = new CollectionAdminRequest.Restore(newCollectionName, backupName);
request2.setRepositoryName("hdfs-repo");
request2.process(client2);
This example works with Solr 7.5, but looks like the feature was already there in 6.6 (See Backup/Restore in 6.6).