addProperties(params, properties);
response = CollectionAdminRequest .addReplicaToShard(DEFAULT_COLLECTION, "shard"+((i%sliceCount)+1)) .setNode(j.getNodeName()) .setType(Replica.Type.TLOG) .process(cloudClient); } else { log.info("create jetty {} in directory {} of type {}", i, jettyDir, Replica.Type.NRT); response = CollectionAdminRequest .addReplicaToShard(DEFAULT_COLLECTION, "shard"+((i%sliceCount)+1)) .setNode(j.getNodeName()) .setType(Replica.Type.NRT) .process(cloudClient); response = CollectionAdminRequest .addReplicaToShard(DEFAULT_COLLECTION, "shard"+((i%sliceCount)+1)) .setNode(j.getNodeName()) .setType(Replica.Type.PULL) .process(cloudClient);
@Override public SolrParams getParams() { ModifiableSolrParams params = new ModifiableSolrParams(super.getParams()); if (shardName == null || shardName.isEmpty()) { params.remove(CoreAdminParams.SHARD); if (routeKey == null) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Either shard or routeKey must be provided"); } params.add(ShardParams._ROUTE_, routeKey); } if (asyncId != null) { params.set(CommonAdminParams.ASYNC, asyncId); } if (node != null) { params.add("node", node); } if (instanceDir != null) { params.add("instanceDir", instanceDir); } if (dataDir != null) { params.add("dataDir", dataDir); } if (properties != null) { addProperties(params, properties); } return params; }
private AddReplica(String collection, String shard, String routeKey, Replica.Type type) { super(CollectionAction.ADDREPLICA); this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection); this.shard = shard; this.routeKey = routeKey; this.type = type; }
/** * Returns a SolrRequest to add a replica to a collection using a route key */ public static AddReplica addReplicaByRouteKey(String collection, String routeKey) { return new AddReplica(collection, null, checkNotNull("routeKey",routeKey), null); }
/** * Returns a SolrRequest to add a replica of the specified type to a shard in a collection. * If the replica type is null, the server default will be used. * */ public static AddReplica addReplicaToShard(String collection, String shard, Replica.Type replicaType) { return new AddReplica(collection, checkNotNull(CoreAdminParams.SHARD, shard), null, replicaType); }