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
如何配置dubbo.configcenter #342
Comments
@skyjilygao 就是在 ZK 上创建一个节点
项目第一次启动调试的时候, 如果 ZK 没有这个配置, 会看不到元数据, 可以在 @PostConstruct
public void init() throws Exception {
CuratorFramework zkClient = CuratorFrameworkFactory.builder().
connectString("127.0.0.1:2181").
retryPolicy(new ExponentialBackoffRetry(1000, 3)).build();
zkClient.start();
if (zkClient.checkExists().forPath("/dubbo/config/dubbo/dubbo.properties") == null) {
zkClient.create().creatingParentsIfNeeded().forPath("/dubbo/config/dubbo/dubbo.properties");
}
zkClient.setData().forPath("/dubbo/config/dubbo/dubbo.properties", ("dubbo.registry.address=zookeeper://127.0.0.1:2181\n" +
"dubbo.metadata-report.address=zookeeper://127.0.0.1:2181").getBytes());
}
|
@kezhenxu94 谢谢你的回答,我按照你说的做了。加了那段代码。在amdin后台配置管理也显示了配置。如下: |
@skyjilygao 你的Dubbo提供者是2.7版本的吗 |
@skyjilygao 元数据只有2.7及以上的版本支持,另外按照你这个配置,provider 端也要配置
如果还不行,麻烦把你完整的 provider 链接发一下 |
@kezhenxu94 是在提供者端依赖对吧, |
@kexianjun 换成2.7,起不来了居然。 |
@skyjilygao 2.7 以后包名从 com.alibaba 改成 org.apache 了, 代码要做相关修改, 或者引入兼容包 |
@kezhenxu94 我改了。 |
把 demo 项目上传到GitHub吧 |
@kezhenxu94 好的好的,谢谢。
麻烦看下,谢谢。 |
@kezhenxu94 我把这个dubbo-spring-boot-starter依赖去了就能起来了。但是不知道咋回事,后台看不到服务了。 |
@kezhenxu94 可以了。还是依赖dubbo-spring-boot-starter的问题。改成以下依赖就不报错了。
然后元数据也出来了。 |
为什么我找不到 这个jar包 |
@wendongbao 是不是依赖有问题,可以把mvn库里的删除,重新依赖。这是依赖地址:https://mvnrepository.com/artifact/org.apache.dubbo/dubbo-spring-boot-starter/2.7.0 |
要想使用dubbo admin 中的服务测试功能,provider和admin 中的group只能是默认的dubbo ? |
跟楼上同问,dubbo admin中的测试和元数据不支持自定义group么?我用默认的dubbo分组可以显示,自定义的不行。 |
ZK哪里加这个节点那? |
|
我操作的情况和你一样,按照@kezhenxu94的说明进行操作后同样不能出现原数据,后来在服务提供端加入配置dubbo.metadata-report.address=zookeeper://127.0.0.1:2181重启就可以了。另外说明:dubbo.config-center=zookeeper://127.0.0.1:2181不能在服务端配置,会报String不能转为ConfigCenterBean异常,使用的dubbo版本为2.7.3。 |
刚开始学习dubbo,有些不太明白。请问怎么配置dubbo.configcenter,才能看到元数据呢?
我在这里看到说明
dubbo.configcenter 推荐使用,配置中心地址,比如dubbo.configcenter="zookeeper://127.0.0.1:2181" 需要在配置中心中,配置注册中心和元数据中心地址配置格式如下: zookeeper path: /dubbo/config/dubbo/dubbo.properties content: dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.metadata-report.address=zookeeper://127.0.0.1:2181
但不是很明白具体配置的文件在哪。麻烦告知下,谢谢
The text was updated successfully, but these errors were encountered: