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