milvus-logo
LFAI
< Docs
  • Java

transferReplica()

MilvusClient interface. This method transfers a query node from the source resource group to another resource group.

R<RpcStatus> transferReplica(TransferReplicaParam requestParam);

TransferReplicaParam

Use the TransferReplicaParam.Builder to construct a TransferReplicaParam object.

import io.milvus.param. TransferReplicaParam;
TransferReplicaParam.Builder builder =  TransferReplicaParam.newBuilder();

Methods of TransferReplicaParam.Builder:

Method

Description

Parameters

withSourceGroupName(String groupName)

Sets the source group name. groupName cannot be empty or null.

groupName: The name of the source group.

withTargetGroupName(String groupName)

Sets the target group name. groupName cannot be empty or null.

groupName: The name of the target group.

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of a collection.

withReplicaNumber(Long replicaNumber)

Specify number of replicas to transfer.

replicaNumber: The number of replicas to transfer.

build()

Construct a TransferReplicaParam object.

N/A

The TransferReplicaParam.Builder.build() can throw the following exceptions:

  • ParamException: error if the parameter is invalid.

Returns

This method catches all the exceptions and returns an R<RpcStatus> object.

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknown and error message of the exception.

  • If the API succeeds, it returns R.Status.Success.

Example

import io.milvus.param.TransferReplicaParam;

R<RpcStatus> response = client.transferReplica(TransferReplicaParam.newBuilder()
            .withTargetGroupName(sourceName)
            .withTargetGroupName(targetName)
            .withCollectionName(COLLECTION_NAME)
            .withNodeNumber(1)
            .build());

if (response.getStatus() != R.Status.Success.getCode()) {
    throw new RuntimeException(response.getMessage());
}
Feedback

Was this page helpful?