断链
使用场景
当P或者D集群节点出现异常时,通过断链清理异常链路,或者需要调整集群PD节点配比时,通过断链关闭已建立的链路。
功能示例
调用断链方式有两种:
一种是通过在D侧发起断链,常用在链路非故障场景。
1 2 3 4 5 6 |
// clusters同建链的clusters auto ret = llmDataDist.UnLinkLlmClusters(clusters, rets); if (ret != LLM_SUCCESS) { printf("[ERROR] UnLinkLlmClusters failed, ret = %u\n", ret); return -1; } |
一种是通过在PD两侧都发强制断链,常用在链路故障场景。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
// PD两侧 std::vector<Status> rets; std::vector<ClusterInfo> clusters; ClusterInfo clusterInfo; IpInfo localIpInfo; localIpInfo.ip = localIp; IpInfo remoteIpInfo; remoteIpInfo.ip = remoteIp; remoteIpInfo.port = PROMPT_LISTEN_PORT; clusterInfo.remote_cluster_id = PROMPT_CLUSTER_ID; clusterInfo.local_ip_infos.emplace_back(std::move(localIpInfo)); // local_ip_info的ip是本地的device ip地址 clusterInfo.remote_ip_infos.emplace_back(std::move(remoteIpInfo)); // remote_ip_info的ip是对端的device ip地址 clusters.emplace_back(std::move(clusterInfo)); auto ret = llmDataDist.UnLinkLlmClusters(clusters, rets, 1000, true); if (ret != LLM_SUCCESS) { printf("[ERROR] UnLinkLlmClusters failed, ret = %u\n", ret); return -1; } |
父主题: 链路管理