Skip to content

[ISSUE #14016]: when import or export, chose healthy node to do#14028

Merged
KomachiSion merged 1 commit into
alibaba:developfrom
FangYuan33:fix_issue_14016
Dec 15, 2025
Merged

[ISSUE #14016]: when import or export, chose healthy node to do#14028
KomachiSion merged 1 commit into
alibaba:developfrom
FangYuan33:fix_issue_14016

Conversation

@FangYuan33

Copy link
Copy Markdown
Contributor

关联 ISSUE #14016 ,Hi~ o( ̄▽ ̄)ブ @KomachiSion ,有时间请帮忙 review

问题的原因是 Console 服务 cluster.conf 配置文件中的 Nacos Server 节点下线后 Console 无法感知,导致 Console 在进行导入或导出时将请求发送到了已经 Down 的节点,如果想解决问题只需将请求发送给正常在线的节点即可。

先说我改动的点:将 ConfigImportAndExportServicerandomOneMember 随机获取一个节点的方法改成了 randomOneHealthyMember 随机获取一个在线的节点,判断是否在线的方法是借助 RemoteClusterHandler 先获取到了 Nacos Server 中当前所有节点的状态,并将 Console 本机配置的 cluster.conf 下线的节点移除,那么这样就只剩下了在线的节点,随机选择一个节点发送请求理论上就不会再出现问题。

这么改的原因是:

  1. 首先,我看了下你的建议是:”在RemoteServerMemberManager中独立添加后段server的健康检查功能“,最初我也是按照你的思路来的,准备在这个类中添加相关的检查检查功能,但是后来没这么做的原因是:
    • 我觉得单独在 Console 中添加检查健康机制不如”以 Nacos Server Cluster 中的节点状态为准“,这样节点健康状态的判断只保留在 Server 中,其他地方想用的话直接查询一下就好了,所以我便准备在 RemoteServerMemberManager 添加 RemoteClusterHandler 的查询逻辑获取节点状态,但是发现会触发 Bean 的循环引用,所以不能这么做
    • 另外,我看了下相关逻辑中使用 RemoteServerMemberManager#allMembers 方法的地方很多,所以这个方法我不敢轻易修改,那么想通过 RemoteServerMemberManager 来获取健康的节点信息就需要添加一个新的方法,如果这个新的方法只给 ConfigImportAndExportService 用的话,我觉得本次改动还不如在 ConfigImportAndExportService 改动来得方便
  2. 此外,我还发现其他的 Remote 请求一般都会经过 ClientHttpProxy#executeSyncHttpRequest 方法,这个方法中是有失败重试的,但是我猜测当初设计导入导出功能没走这个方法应该考虑了导入导出功能的特殊性:大数据量的导入导出请求耗时长且会占用大量服务器内存资源,自主重试容易产生性能问题,所以才没有选择走 ClientHttpProxy#executeSyncHttpRequest 方法。那么从这点考虑,在 ConfigImportAndExportService 的添加 ”在发送请求前判断节点的状态并选择合适的节点的逻辑“ 也合理

Console 和 Server 分离部署,可以在 Console 的 cluster.conf 中配置更少的节点,这样其实配置的少数节点提供 Console 的服务,这样对 Nacos Server Cluster 的影响也更小了

@github-actions

Copy link
Copy Markdown

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API新增配置参数修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@KomachiSion KomachiSion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样只能解决导入导出这一个API吧

@FangYuan33

FangYuan33 commented Dec 15, 2025

Copy link
Copy Markdown
Contributor Author

这样只能解决导入导出这一个API吧

目前应该只有导入和导出有问题,其他的 API 基本上都会走到 ClientHttpProxy#executeSyncHttpRequest 方法,这个方法我看了有重试机制,能够通过重试选择到健康的节点

@KomachiSion

Copy link
Copy Markdown
Collaborator

这样只能解决导入导出这一个API吧

目前应该只有导入和导出有问题,其他的 API 基本上都会走到 ClientHttpProxy#executeSyncHttpRequest 方法,这个方法我看了有重试机制,能够通过重试选择到健康的节点

ok 那我运行一下ci 没问题就merge了

@KomachiSion
KomachiSion merged commit ff95939 into alibaba:develop Dec 15, 2025
4 checks passed
@KomachiSion KomachiSion added this to the 3.2.0 milestone Dec 15, 2025
@KomachiSion KomachiSion added area/Nacos console Related to Nacos consle kind/bug Category issues or prs related to bug. labels Dec 15, 2025
@wuyfee

wuyfee commented Dec 15, 2025

Copy link
Copy Markdown

$\color{red}{FAILURE}$
DETAILS
✅ - docker: success
❌ - deploy (standalone & cluster & standalone_auth): failure
❌ - e2e-java-test (standalone & cluster & standalone_auth): skipped
❌ - e2e-go-test (standalone & cluster): skipped
❌ - e2e-cpp-test (standalone & cluster): skipped
❌ - e2e-csharp-test (standalone & cluster): skipped
❌ - e2e-nodejs-test (standalone & cluster): skipped
❌ - e2e-python-test (standalone & cluster): skipped
✅ - clean (standalone & cluster & standalone_auth): success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/Nacos console Related to Nacos consle kind/bug Category issues or prs related to bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants