close
The Wayback Machine - https://web.archive.org/web/20220406145222/https://github.com/alibaba/nacos/issues/7434
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能否考虑配置中心多集群之间数据同步支持?(Can Nacos consider supporting data synchronization between multiple clusters in the configuration center?) #7434

Open
hujun-w-2 opened this issue Dec 16, 2021 · 15 comments
Labels
area/Nacos console good first issue kind/enhancement

Comments

@hujun-w-2
Copy link
Collaborator

@hujun-w-2 hujun-w-2 commented Dec 16, 2021

Is your feature request related to a problem? Please describe.
如果配置需要下发到多个机房,修改配置的时候,需要每个集群都修改一次,如果能做到不同集群之间的配置数据同步会更好。
(If the configuration needs to be delivered to multiple equipment rooms, you need to modify the configuration for each cluster. It is better to synchronize configuration data between clusters. )
Describe the solution you'd like
A clear and concise description of what you want to happen.
虽然数据库这侧可以通过主从实现同步,当时缓存文件这快也可以多集群之间的同步
(While the database side can be synchronized from master to slave, cache files can also be synchronized between multiple clusters )
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
拍脑袋方案:增加集群的管理,在配置变更的时候,同时将配置变更事件发送到其他集群,类似集群类配置同步
(Head shot solution: add the management of the cluster. When the configuration is changed, the configuration change event is sent to other clusters, similar to the cluster configuration synchronization )

Additional context
Add any other context or screenshots about the feature request here.

@li-xiao-shuang li-xiao-shuang added area/Nacos console good first issue kind/enhancement labels Dec 16, 2021
@Malikh12
Copy link

@Malikh12 Malikh12 commented Dec 18, 2021

Ou télécharger le fichier

@Leachan129
Copy link

@Leachan129 Leachan129 commented Dec 18, 2021

Menjaga akun situs saya aman dr bajak atau hacker

@li-xiao-shuang
Copy link
Collaborator

@li-xiao-shuang li-xiao-shuang commented Dec 20, 2021

方案1: 1.每个集群使用不同的数据库 2.将每个集群的地址,账号信息,在控制台写入一个配置cluster config中 3.用户在控制台新增配置时如果选择了同步到其他集群,则继续执行下面的逻辑 4.异步向每个集群通过grpc发送ConfigPublishRequest,发送时根据第一步的集群配置信息,获取grpc连接,并且将连接缓存下来方便下次同步时复用。 5.被通知集群中某个服务收到配置变更请求时,执行原来处理sdk配置变更逻辑。 不支持在 Docs 外粘贴 block 方案2: 1.每个集群使用同一个数据库集群 每个服务定时按照配置更新时间增量从数据库同步 缺点: 1.配置延迟高于方案1 2.不能实现配置同步集群的可选,只能一刀切同步到所有集群

可以考虑以插件或组件的方式来实现嘛

@hujun-w-2
Copy link
Collaborator Author

@hujun-w-2 hujun-w-2 commented Dec 20, 2021

但是如果这样的话,还需要保证cluster-sync的高可用才行

@onewe
Copy link
Contributor

@onewe onewe commented Dec 20, 2021

简单暴力的方式,就整个同步工具,同步配置的时候用一下就行了,没必要一直开着.

@hujun-w-2
Copy link
Collaborator Author

@hujun-w-2 hujun-w-2 commented Dec 20, 2021

就是需要实时同步呀

@onewe
Copy link
Contributor

@onewe onewe commented Dec 20, 2021

也可以定时向主集群同步

@hujun-w-2
Copy link
Collaborator Author

@hujun-w-2 hujun-w-2 commented Dec 20, 2021

这个就是我上面的方案2了

@hujun-w-2
Copy link
Collaborator Author

@hujun-w-2 hujun-w-2 commented Dec 20, 2021

定时同步延迟会高一点

@hujun-w-2
Copy link
Collaborator Author

@hujun-w-2 hujun-w-2 commented Dec 21, 2021

可以消费ConfigDataChangeEvent事件来做这件事情

@chuntaojun
Copy link
Collaborator

@chuntaojun chuntaojun commented Dec 22, 2021

对于第一方案,是不是可以走webhook的形式,将Nacos内部的一些Event通过webhook的方式通知给订阅方,即不会无端为Nacos-Server引入多中心的代码,同时也可以自己根据webhook自行扩展相关逻辑

@Ayoub12321
Copy link

@Ayoub12321 Ayoub12321 commented Jan 12, 2022

I don't understand this app

@MasoudMsd
Copy link

@MasoudMsd MasoudMsd commented Jan 13, 2022

:-?

@hujun-w-2
Copy link
Collaborator Author

@hujun-w-2 hujun-w-2 commented Jan 25, 2022

方案1:

  1. 以插件的方式来实现集群配置同步功能,插件名:cluster-sync-plugin
  2. 通过 nacos-address 进行集群的管理
  3. 用户在控制台新增配置时如果选择了同步到其他集群,则继续执行下面的逻辑
  4. 拦截配置新增修改删除操作,判断是否引用了 cluster-sync-plugin核心类,如果引用,则异步执行cluster-sync-plugin 逻辑:
  • 通过request中携带需要同步的集群名向 nacos-address 获取集群信息
  • 利用nacos提供给sdk添加配置的grpc端口,异步向每个集群发送集群同步请求,失败重试,重试超过一定次数则打印错误日志。
    image

方案2:
1.每个集群使用同一个数据库集群
每个服务定时按照配置更新时间增量从数据库同步
缺点:
1.配置延迟高于方案1
2.不能实现配置同步集群的可选,只能一刀切同步到所有集群

@hujun-w-2 hujun-w-2 changed the title nacos能否考虑配置中心多集群之前数据同步支持?(Can NACOS consider data synchronization support before configuring multiple clusters in the center?) nacos能否考虑配置中心多集群之间数据同步支持?(Can NACOS consider data synchronization support before configuring multiple clusters in the center?) Jan 25, 2022
@hujun-w-2 hujun-w-2 changed the title nacos能否考虑配置中心多集群之间数据同步支持?(Can NACOS consider data synchronization support before configuring multiple clusters in the center?) nacos能否考虑配置中心多集群之间数据同步支持?(Can Nacos consider supporting data synchronization between multiple clusters in the configuration center?) Jan 25, 2022
@Gangjean032716
Copy link

@Gangjean032716 Gangjean032716 commented Mar 1, 2022

Jeff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Nacos console good first issue kind/enhancement
Projects
None yet
Development

No branches or pull requests

10 participants