Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nacos 节点上下线状态无法及时同步 #11135

Closed
flying-2077 opened this issue Sep 14, 2023 · 7 comments
Closed

nacos 节点上下线状态无法及时同步 #11135

flying-2077 opened this issue Sep 14, 2023 · 7 comments

Comments

@flying-2077
Copy link

背景:
我们提供了节点平滑下线的功能,先将临时节点的enable = false,然后kill 进程,进行发布部署后dubbo 自动注册到nacos。
参数nacos.naming.clean.expired-metadata.expired-time 设置为5s,保证服务注册前,元数据(enable = false)被清除

问题:
服务发布后,成功注册节点到nacos上,但是发现有些节点过了2min,仍然发现enable = false,但是最终enable=true。
是raft 协议的问题吗?还是定时任务的的问题?
Refactor auto cleaner to adapt clean metadata #4354

nacos 版本:2.2.0

@wuxingyun
Copy link

我也碰到了这类似的问题,我在元数据加了 version=1.1.7.1,我新发布服务改为为 version=1.1.8.1,我也把镜像中的jar 反编译查看里面配置是version=1.1.8.1,但是 nacos 上面还是 version=1.1.7.1,但是有些服务却是 version=1.1.8.1

1 similar comment
@wuxingyun
Copy link

我也碰到了这类似的问题,我在元数据加了 version=1.1.7.1,我新发布服务改为为 version=1.1.8.1,我也把镜像中的jar 反编译查看里面配置是version=1.1.8.1,但是 nacos 上面还是 version=1.1.7.1,但是有些服务却是 version=1.1.8.1

@KomachiSion
Copy link
Collaborator

KomachiSion commented Sep 19, 2023

描述上看, 你只设置了过期时间, 没设置扫描周期, 所以在扫描周期期间内重新注册的服务, 会因为重新注册而导致元数据不再过期。至于最终enabled=true, 很可能是有更新脚本又调用接口把状态更新为true了。

可以看下文档, 把扫描间隔也调小。

另外, 运维操作应该保证对称, 下线时调用了enabled=false, 那么 上线时理论上应该在ready后调用enabled=true。

@flying-2077
Copy link
Author

flying-2077 commented Sep 20, 2023

@KomachiSion
1、这个case不是所有的机器都出现的,100台机器中也就几台机器出现问题。
2、最终enable= true,是启动服务后,dubbo服务自动注册导致的,发布平台不断调用nacos接口判断,如果enable=true,表示服务发布成功成功。
3、可以确定,没有主动设置这个enable= true。完全依赖dubbo服务启动后自动注册到nacos,enable = true。

整个平滑发布流程
1、发布平台:调用nacos接口将机器enable=false;
2、dubbo客户端:感知节点变化,从而将invoker移除
3、发布平台:kill dubbo服务端进程,编译打包部署后,拉起dubbo服务端进程。
4、dubbo服务端:通过dubbo自动注册到nacos,依靠dubbo注册,让enable=true,不需要手动设置!
5、发布平台:循环调用nacos接口,判断enable = true后,判断服务已经注册,发布结束
6、dubbo客户端:感知到新服务端加入,重新打入流量,整个平滑发布结束,中间几乎没有流量损失。

其他问题:扫描间隔参数是nacos.naming.clean.expired-metadata.interval 这个吗? 默认值是5s,也很小了

@KomachiSion
Copy link
Collaborator

第4步存在问题,自动注册的实例运行时enable=true,但如果此时上次的元数据未过期,还是会使用旧的enabled=false的元数据。

如果你说一定超过了过期时间和扫描周期很久了,还是=false,那么你可以从两个方向排查:

  1. 是否在实例移除后,还有调用过enbale=false的接口,这种情况是不会被标记为过期的
  2. 看下服务端raft是否有报错,导致删除过期元数据的请求失败了。
  3. 看下是否有Remove expired metadata的日志。

@KomachiSion
Copy link
Collaborator

No more response from author, and community can't reproduce this problem and current information is not enough to find problem.

@KomachiSion KomachiSion closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2023
@wingyiu
Copy link

wingyiu commented Oct 28, 2024

+10086

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

No branches or pull requests

4 participants