milvus-logo
LFAI
< Docs

transfer_node()

This method moves a specified number of replicas from a resource group to another.

Invocation

transfer_replica(source, target, collection_name, num_replicas, using="default")

Parameters

ParameterDescriptionTypeRequired
sourceName of the resource group from which replicas are movedStringTrue
targetName of the resource group to which replicas are movedStringTrue
collection_nameName of the collection whose replicas are to be movedStringTrue
num_replicasNumber of replicas to be movedintTrue
usingMilvus connection used to create the collection.StringFalse

Return

No return

Example

source = '__default_resource_group'
target = 'rg'
collection_name = 'c'
num_replicas = 1

try:
    utility.transfer_replica(source, target, collection_name, num_replicas, using="default")
    print(f"Succeeded in moving {num_node} replica(s) of {collection_name} from {source} to {target}.")
except Exception:
    print("Something went wrong while moving replicas.")

# Succeeded in moving 1 replica(s) of c from __default_resource_group to rg.