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

支持动态添加新的namespace吗 #259

Closed
qshuai opened this issue Nov 9, 2022 · 8 comments
Closed

支持动态添加新的namespace吗 #259

qshuai opened this issue Nov 9, 2022 · 8 comments
Assignees

Comments

@qshuai
Copy link

qshuai commented Nov 9, 2022

我想实现运行时动态添加namespace,然后可以在cache中查询到新添加namespace的配置数据,现在的api可以做到么?

@qshuai
Copy link
Author

qshuai commented Nov 24, 2022

我自己二开实现了该特性,需要的朋友可以移步:https://github.com/qshuai/agollo#%E5%8A%A8%E6%80%81namespace%E7%89%B9%E6%80%A7

@zouyx
Copy link
Member

zouyx commented Dec 9, 2022

我自己二开实现了该特性,需要的朋友可以移步:https://github.com/qshuai/agollo#%E5%8A%A8%E6%80%81namespace%E7%89%B9%E6%80%A7

如果有可能,可以提交 pr。
我代表社区感谢对 apolloconfig 社区的贡献。

@fengqi
Copy link
Contributor

fengqi commented Dec 28, 2022

你的实现方式是这样吗:
定时拉取全部namespace,然后配置正则匹配想要的部分

调整成这样是不是比较好:
在application这里配置要启用的namespace,如:namespace=mysql,redis,kafka,当修改的时候这个值是会自动同步到client的,client根据这个值去获取配置就好了,不用定时任务,也不用正则

按照目前的代码结构,只需要有个内置的change监听,设置调用下SetCurrentApolloConfig就可以了

@qshuai
Copy link
Author

qshuai commented Dec 29, 2022

你的实现方式是这样吗: 定时拉取全部namespace,然后配置正则匹配想要的部分

调整成这样是不是比较好: 在application这里配置要启用的namespace,如:namespace=mysql,redis,kafka,当修改的时候这个值是会自动同步到client的,client根据这个值去获取配置就好了,不用定时任务,也不用正则

按照目前的代码结构,只需要有个内置的change监听,设置调用下SetCurrentApolloConfig就可以了

嗯呢,不错的想法!

@fengqi
Copy link
Contributor

fengqi commented Dec 29, 2022

不过我好奇应用场景是什么,按说新增配置不应该都是需要提前适配代码的吗,这就需要重新部署或者重新启动的。

@qshuai
Copy link
Author

qshuai commented Jan 1, 2023

不过我好奇应用场景是什么,按说新增配置不应该都是需要提前适配代码的吗,这就需要重新部署或者重新启动的。

一个可能但不一定合理的场景:一个类目相关的服务,提供类目相关配置的查询能力,而类目是可以横向扩展的;也就是说在服务启动的时候,并不知道有多少个类目需要配置。为了实现无需重启服务就能提供这样能力的诉求,就衍生了这么一个功能。

一开始我并不同意业务方的诉求,其实这个诉求可以通过如下方式满足:搭建一个类目的后台管理,再加上一个持久化存储,程序实时查询数据库的数据即可。但是业务方看中了apollo配置中心已经存在的灰度发布、审核流程、变更历史查询等能力,不想重复建设,把配置中心当做数据库在使用了。所以~

@fengqi
Copy link
Contributor

fengqi commented Jan 3, 2023

确实不太合理,当成数据库用了

@stale
Copy link

stale bot commented Mar 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 4, 2023
@stale stale bot closed this as completed Apr 3, 2023
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

3 participants