Skip to content
/ nacos Public
  • Notifications You must be signed in to change notification settings
  • Fork 12.6k
  • Star 29.3k
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.

Sign up for GitHub

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

Jump to bottom

集群Leader逻辑是否存在问题?含义是什么(Is there a problem with cluster Leader logic? What does it mean) #7158

Closed
kuaile-zc opened this issue Nov 1, 2021 · 8 comments
Closed

集群Leader逻辑是否存在问题?含义是什么(Is there a problem with cluster Leader logic? What does it mean) #7158

kuaile-zc opened this issue Nov 1, 2021 · 8 comments
Labels
expired No active for a long time

Comments

@kuaile-zc
Copy link

kuaile-zc commented Nov 1, 2021

Describe the bug
我查看了nacos页面发现集群状态如下:
I checked the NACOS page and found the cluster status as follows:
{ "lastRefreshTime": 1635749568396, "raftMetaData": { "metaDataMap": { "naming_instance_metadata": { "leader": "nacos-0.nacos-nacos-hs.performance.svc.cluster.local:7848", "raftGroupMember": [ "nacos-0.nacos-nacos-hs.performance.svc.cluster.local:7848", "nacos-2.nacos-nacos-hs.performance.svc.cluster.local:7848", "nacos-1.nacos-nacos-hs.performance.svc.cluster.local:7848" ], "term": 1 }, "naming_persistent_service": { "leader": "nacos-1.nacos-nacos-hs.performance.svc.cluster.local:7848", "raftGroupMember": [ "nacos-0.nacos-nacos-hs.performance.svc.cluster.local:7848", "nacos-2.nacos-nacos-hs.performance.svc.cluster.local:7848", "nacos-1.nacos-nacos-hs.performance.svc.cluster.local:7848" ], "term": 1 }, "naming_persistent_service_v2": { "leader": "nacos-0.nacos-nacos-hs.performance.svc.cluster.local:7848", "raftGroupMember": [ "nacos-0.nacos-nacos-hs.performance.svc.cluster.local:7848", "nacos-2.nacos-nacos-hs.performance.svc.cluster.local:7848", "nacos-1.nacos-nacos-hs.performance.svc.cluster.local:7848" ], "term": 1 }, "naming_service_metadata": { "leader": "nacos-0.nacos-nacos-hs.performance.svc.cluster.local:7848", "raftGroupMember": [ "nacos-0.nacos-nacos-hs.performance.svc.cluster.local:7848", "nacos-2.nacos-nacos-hs.performance.svc.cluster.local:7848", "nacos-1.nacos-nacos-hs.performance.svc.cluster.local:7848" ], "term": 1 } } }, "raftPort": "7848", "readyToUpgrade": true, "site": "unknown", "version": "2.0.3", "weight": 2 }

我发现有好几个配置 naming_instance_metadata naming_persistent_service naming_persistent_service_v2 naming_service_metadata 他们的Leader都不一样。这样是预期中的结果吗?能否详细说明一下 这4个集群leader是什么意思呢?
我感觉如果每一种业务逻辑一个Leader是不是不太合理。

I found several configurations naming_instance_metadata naming_persistent_service naming_persistent_service_v2 naming_service_metadata They all have different leaders. Is this the intended result? Can you elaborate on what these four cluster leaders mean?
I feel that if each business logic a Leader is not too reasonable.

Desktop (please complete the following information):

  • OS: Linux K8s
  • Version nacos 2.0.3
  • Module naming/config
  • SDK nacos
@kuaile-zc
Copy link
Author

kuaile-zc commented Nov 1, 2021

图片

@chenshun00
Copy link

chenshun00 commented Nov 2, 2021

看起来是出现了不一致的数据

@kuaile-zc
Copy link
Author

kuaile-zc commented Nov 2, 2021

看起来是出现了不一致的数据

这个数据不一致是不是处于不正常状态?

@kuaile-zc kuaile-zc mentioned this issue Nov 2, 2021
能否加一个配置,让nacos-2.0.x启动后,doubleWriteEnabled为false。 #7112
Closed
@MajorHe1
Copy link
Collaborator

MajorHe1 commented Nov 2, 2021

我不确定 “每一种业务逻辑一个Leader” 这种表象是否符合nacos设计的初衷,但是我可以确定 naming_instance_metadata naming_persistent_service naming_persistent_service_v2 naming_service_metadata 这里确实是4个用到了raft协议的场景。我猜应该是它们各自单独使用了CP协议的模块所以才会这样。

至于集群是不是出于正常状态,看一下服务注册、服务发现、集群同步这几个功能是否正常,看一下日志里面是否出现了 sync failed 一类的关键字,如果没有集群应该就是正常的。这里的数据来判断不具备说服性。

至于这四个使用raft协议的场景分别是啥:
首先,nacos注册的服务氛围持久服务(ephemeral = false)和临时服务 (ephemeral = true)
临时服务使用distro协议同步,不需要选主,持久服务使用raft协议同步,需要选主。
naming_persistent_service : 使用nacos 1.X的客户端注册的持久服务的raft集群
naming_persistent_service_v2 : 使用nacos 2.X的客户端注册的持久服务的raft集群

其次,在nacos 2.X的版本中,因为服务注册的权威节点计算是基于连接的,但是任意一台nacos节点均可修改该服务的元数据,所以为了达到这个能力,服务的某些元数据(例如enable状态、权重等等)必须通过raft协议同步,所以:
naming_instance_metadata :服务实例的元数据管理对应的raft集群
naming_service_metadata : 服务本身的元数据管理对应的raft集群

参考: https://my.oschina.net/u/3585447/blog/4818143

@kuaile-zc
Copy link
Author

kuaile-zc commented Nov 3, 2021

我不确定 “每一种业务逻辑一个Leader” 这种表象是否符合nacos设计的初衷,但是我可以确定 naming_instance_metadata naming_persistent_service naming_persistent_service_v2 naming_service_metadata 这里确实是4个用到了raft协议的场景。我猜应该是它们各自单独使用了CP协议的模块所以才会这样。

至于集群是不是出于正常状态,看一下服务注册、服务发现、集群同步这几个功能是否正常,看一下日志里面是否出现了 sync failed 一类的关键字,如果没有集群应该就是正常的。这里的数据来判断不具备说服性。

至于这四个使用raft协议的场景分别是啥: 首先,nacos注册的服务氛围持久服务(ephemeral = false)和临时服务 (ephemeral = true) 临时服务使用distro协议同步,不需要选主,持久服务使用raft协议同步,需要选主。 naming_persistent_service : 使用nacos 1.X的客户端注册的持久服务的raft集群 naming_persistent_service_v2 : 使用nacos 2.X的客户端注册的持久服务的raft集群

其次,在nacos 2.X的版本中,因为服务注册的权威节点计算是基于连接的,但是任意一台nacos节点均可修改该服务的元数据,所以为了达到这个能力,服务的某些元数据(例如enable状态、权重等等)必须通过raft协议同步,所以: naming_instance_metadata :服务实例的元数据管理对应的raft集群 naming_service_metadata : 服务本身的元数据管理对应的raft集群

参考: https://my.oschina.net/u/3585447/blog/4818143

感谢你的解答,我会顺着思路研究一下代码。十分感谢!

@stale
Copy link

stale bot commented May 2, 2022

Thanks for your feedback and contribution. But the issue/pull request has not had recent activity more than 180 days. This issue/pull request will be closed if no further activity occurs 7 days later.
We may solve this issue in new version. So can you upgrade to newest version and retry?
If there are still issues or want to contribute again. Please create new issue or pull request again.

@stale stale bot added the expired No active for a long time label May 2, 2022
@MajorHe1 MajorHe1 closed this as completed Jun 6, 2022
@MajorHe1 MajorHe1 mentioned this issue Jun 6, 2022
nacos集群各节点的注册服务数量不一致! #8492
Closed
@jsonpang
Copy link

jsonpang commented Jul 22, 2022

节点元数据不一致会导致实例同步失败 ,不停的刷新页面会发现,出现服务实例不一致的情况

@Scofield-D
Copy link

Scofield-D commented Nov 1, 2023

这四个raft的集群leader确实是四个raft的场景,不是看单个节点的元数据,只要集群下所有节点的这整个一大坨元数据一样就可以了。但是在低于2.1.0版nacos集群存在1.X逻辑兼容,很容易触发注册服务实例数集群间数据同步不一致的情况,管理台上的反应是反复刷会出现显示注册服务不一样(查询接口负载到不同的节点上导致),客户端的反应是不停的报deleteIps(心跳到不同的节点上导致)。一定要升级到2.1.0及以上版本,不然现网很容易出问题,最后升级到2.2.0及以上。(2.1.0后面几个版本bug也较多)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expired No active for a long time
Projects
None yet
Development

No branches or pull requests

5 participants
@jsonpang @chenshun00 @kuaile-zc @MajorHe1 @Scofield-D

Footer

© 2024 GitHub, Inc.

两个鬼故事搞笑的qq表情起名字景字国庆档首日票房破5亿程姓怎么起名字日本的名字怎么起的姓刘的男宝宝起名用什么字好杨姓 的宝宝起名杀手小说成为龙傲天的作精女友后美女秘书长免费婴儿取名生辰八字起黎婉华用海起名edg战队恶魔奶爸国语版属虎的要起什么名字比较好早上好高情商句子8888小游戏剑尊叶玄叶灵小说跌倒了爬起来的励志名言msxml4.0下载五行多缺土起名字起名网生辰八字取名八字免费起名谭家姓男宝起名大全四爷正妻不好当门店起名网免费取名大全贾起名色戒完整版卖酒起名字大全三室一厅户型图少年生前被连续抽血16次?多部门介入两大学生合买彩票中奖一人不认账让美丽中国“从细节出发”淀粉肠小王子日销售额涨超10倍高中生被打伤下体休学 邯郸通报单亲妈妈陷入热恋 14岁儿子报警何赛飞追着代拍打雅江山火三名扑火人员牺牲系谣言张家界的山上“长”满了韩国人?男孩8年未见母亲被告知被遗忘中国拥有亿元资产的家庭达13.3万户19岁小伙救下5人后溺亡 多方发声315晚会后胖东来又人满为患了张立群任西安交通大学校长“重生之我在北大当嫡校长”男子被猫抓伤后确诊“猫抓病”测试车高速逃费 小米:已补缴周杰伦一审败诉网易网友洛杉矶偶遇贾玲今日春分倪萍分享减重40斤方法七年后宇文玥被薅头发捞上岸许家印被限制高消费萧美琴窜访捷克 外交部回应联合利华开始重组专访95后高颜值猪保姆胖东来员工每周单休无小长假男子被流浪猫绊倒 投喂者赔24万小米汽车超级工厂正式揭幕黑马情侣提车了西双版纳热带植物园回应蜉蝣大爆发当地回应沈阳致3死车祸车主疑毒驾恒大被罚41.75亿到底怎么缴妈妈回应孩子在校撞护栏坠楼外国人感慨凌晨的中国很安全杨倩无缘巴黎奥运校方回应护栏损坏小学生课间坠楼房客欠租失踪 房东直发愁专家建议不必谈骨泥色变王树国卸任西安交大校长 师生送别手机成瘾是影响睡眠质量重要因素国产伟哥去年销售近13亿阿根廷将发行1万与2万面值的纸币兔狲“狲大娘”因病死亡遭遇山火的松茸之乡“开封王婆”爆火:促成四五十对奥巴马现身唐宁街 黑色着装引猜测考生莫言也上北大硕士复试名单了德国打算提及普京时仅用姓名天水麻辣烫把捣辣椒大爷累坏了

两个鬼故事 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化