跳到主要内容

transfer_node()

Near Deprecation

此操作会将指定数量的查询节点从源资源组移动到目标资源组。

请求语法

python
transfer_node(
source_group: str,
target_group: str,
num_nodes: int,
using: str = "default",
timeout: Optional[float] = None,
) -> None

参数:

  • source_group (str) -

    [必填]

    移出查询节点的源资源组名称。

    如果将其设置为不存在的资源组,则会导致 MilvusException

  • target_group (str) -

    [必填]

    查询节点移动到的源资源组名称。

    如果将其设置为不存在的资源组,则会导致 MilvusException

  • num_nodes (int) -

    [必填]

    要在源资源组和目标资源组之间移动的查询节点数量。

    如果将其设置为大于当前 Zilliz Cloud 集群中实际查询节点数量的整数,则会导致 MilvusException

  • using (str) -

    所使用连接的别名。

    默认值为 default,表示此操作使用默认连接。

  • timeout (float | None)

    此操作的超时时长。将其设置为 None 表示当收到任何响应或发生任何错误时,此操作即超时。

返回类型:

NoneType

返回:

无。

异常:

  • MilvusException

    当此操作期间发生任何错误时,将引发此异常。

示例:

python
from pymilvus import connections, utility

# Connect to YOUR_CLUSTER_ENDPOINT
connections.connect()

# Get the number of query nodes in the source resource group
res = utility.describe_resource_group(name="__default_resource_group")
res.num_available_node # 1

# Create a new resource group
utility.create_resource_group(
name="rg_01",
using="default"
)

# Get the number of query nodes in the target resource group
res = utility.describe_resource_group(name="rg_01")
res.num_available_node # 0

# Move the node from the default resource group to the new one
utility.transfer_node(
source_group="__default_resource_group",
target_group="rg_01",
num_nodes=1
)

# Get the number of query nodes in the source and target resource groups
res = utility.describe_resource_group(name="__default_resource_group")
res.num_available_node # 0

res = utility.describe_resource_group(name="rg_01")
res.num_available_node # 1

以下操作与 transfer_node() 相关:

最低 SDK 版本Inherit
Ctrl I