public Pair<SolrCore,SolrCore> replicateToDestination(SolrCore bestsrcCore,SolrCore destinationCore) throws Exception {
  Pair<SolrCore,SolrCore> replicationRequestPair=null;
  try {
    SolrInteractionUtils.replicateIndex(destinationCore.host,destinationCore.name,bestsrcCore.host,bestsrcCore.name);
    String fullReplication="http://%s:%s/solr/%s/replication?command=fetchindex&masterUrl=http://%s:%s/solr/%s";
    String replicator=String.format(fullReplication,destinationCore.host,SolrInteractionUtils.DEFAULT_SOLR_PORT,destinationCore.name,bestsrcCore.host,SolrInteractionUtils.DEFAULT_SOLR_PORT,bestsrcCore.name);
    logger.info("Using Replication Command -> " + replicator);
    replicationRequestPair=new Pair<SolrCore,SolrCore>(destinationCore,bestsrcCore);
    logger.info("Adding Replication Request to the Queue: " + destinationCore.host + ":"+ destinationCore.name+ " --> "+ bestsrcCore.host+ ":"+ bestsrcCore.name);
  }
 catch (  Exception e) {
    logger.info("Encountered Exception while Trying to connect to destination host " + destinationCore.host + " or source host"+ bestsrcCore.host);
    if (!replicatorConfig.shouldSkipReplicationFailures()) {
      throw new ReplicationFailureException("Replication failures while tyring to talk to nodes " + destinationCore.host + " or source host"+ bestsrcCore.host);
    }
  }
  return replicationRequestPair;
}

public Pair < SolrCore , SolrCore > replicateToDestination ( SolrCore bestsrcCore , SolrCore destinationCore ) throws Exception { Pair < SolrCore , SolrCore > replicationRequestPair = null ; try { SolrInteractionUtils . replicateIndex ( destinationCore . host , destinationCore . name , bestsrcCore . host , bestsrcCore . name ) ; String fullReplication = "http://%s:%s/solr/%s/replication?command=fetchindex&masterUrl=http://%s:%s/solr/%s" ; String replicator = String . format ( fullReplication , destinationCore . host , SolrInteractionUtils . DEFAULT_SOLR_PORT , destinationCore . name , bestsrcCore . host , SolrInteractionUtils . DEFAULT_SOLR_PORT , bestsrcCore . name ) ; logger . info ( "Using Replication Command -> " + replicator ) ; replicationRequestPair = new Pair < SolrCore , SolrCore > ( destinationCore , bestsrcCore ) ; logger . info ( "Adding Replication Request to the Queue: " + destinationCore . host + ":" + destinationCore . name + " --> " + bestsrcCore . host + ":" + bestsrcCore . name ) ; } catch ( Exception e ) { logger . info ( "Encountered Exception while Trying to connect to destination host " + destinationCore . host + " or source host" + bestsrcCore . host ) ; if ( ! replicatorConfig . shouldSkipReplicationFailures ( ) ) { throw new ReplicationFailureException ( "Replication failures while tyring to talk to nodes " + destinationCore . host + " or source host" + bestsrcCore . host ) ; } } return replicationRequestPair ; }
given source and destionation cores , issue the solr replication command between them
