You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "sick-cat (via GitHub)" <gi...@apache.org> on 2023/07/31 15:13:34 UTC
[GitHub] [dubbo] sick-cat opened a new issue, #12824: 动态配置指定group,启动时不加载配置
sick-cat opened a new issue, #12824:
URL: https://github.com/apache/dubbo/issues/12824
<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
### Environment
* Dubbo version: 3.2.5
* Operating System version: mac 13.4
* Java version: 1.8
### Steps to reproduce this issue
1. dubbo项目使用apollo作为配置中心,并指定以下属性
```properties
dubbo.config-center.group=mydubbo
dubbo.config-center.namespace=mydubbo
```
2. 在apollo的 mydubbo namespace下,添加一个配置项
kye: myApp. configurators
value:
```yaml
configVersion: v3.0
scope: application
key: myApp
configs:
- side: provider
parameters:
owner: apollo-pub-provider
```
3. 启动项目,注意:apollo中并没有 dubbo namespace。
### Expected Behavior
<!-- What do you expect from the above steps?-->
预期使用 `invoke org.apache.dubbo.metadata.MetadataService.getMetadataInfos()` 获取元数据,会有 owner 属性。
### Actual Behavior
<!-- What actually happens? -->
实际debug下来,发现会从 dubbo namespace中获取数据。并没有使用 `dubbo.config-center.group` 配置的值。
以下是 `org.apache.dubbo.registry.integration.AbstractConfiguratorListener#initWith` 的代码片段:
```java
protected final void initWith(String key) {
ruleRepository.addListener(key, this);
String rawConfig = ruleRepository.getRule(key, DynamicConfiguration.DEFAULT_GROUP);
if (!StringUtils.isEmpty(rawConfig)) {
genConfiguratorsFromRawRule(rawConfig);
}
}
```
`org.apache.dubbo.configcenter.support.apollo.ApolloDynamicConfiguration#getConfig` 中的实现,**理应使用url中的group属性值**。
```java
@Override
public String getConfig(String key, String group, long timeout) throws IllegalStateException {
if (StringUtils.isNotEmpty(group)) {
if (group.equals(url.getApplication())) {
return ConfigService.getAppConfig().getProperty(key, null);
} else {
return ConfigService.getConfig(group).getProperty(key, null);
}
}
return dubboConfig.getProperty(key, null);
}
```
addListener、removeListener也有类似问题,不过这两个方法不影响使用。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] guangweifan commented on issue #12824: 动态配置指定group,启动时不加载配置
Posted by "guangweifan (via GitHub)" <gi...@apache.org>.
guangweifan commented on issue #12824:
URL: https://github.com/apache/dubbo/issues/12824#issuecomment-1671370302
> `group` 这个属性在 registry、config、metadata 里面都是不清晰的,按照标准的设计上 `group` 应该更像是 namespace 的一个纬度,但是 `namespace` 这个参数又已经存在了,所以使用上很容易出非预期的场景。 因此这种 case 下最好的模型是直接使用 `namespace`
疑惑点是使用nacos作为配置中心的前提下, 应用特有外部化配置。配置了namespace和group,但是实际情况group并没有使用配置的group值,而是读取了namespace下group值默认为dubbo.application.name的相关配置文件
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] AlbumenJ commented on issue #12824: 动态配置指定group,启动时不加载配置
Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #12824:
URL: https://github.com/apache/dubbo/issues/12824#issuecomment-1670755803
`group` 这个属性在 registry、config、metadata 里面都是不清晰的,按照标准的设计上 `group` 应该更像是 namespace 的一个纬度,但是 `namespace` 这个参数又已经存在了,所以使用上很容易出非预期的场景。
因此这种 case 下最好的模型是直接使用 `namespace`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] sick-cat commented on issue #12824: 动态配置指定group,启动时不加载配置
Posted by "sick-cat (via GitHub)" <gi...@apache.org>.
sick-cat commented on issue #12824:
URL: https://github.com/apache/dubbo/issues/12824#issuecomment-1692676424
@AlbumenJ
按照我的case,从默认的dubbo namespace中获取配置项后,是否应该再拿用户指定namespace的配置项覆盖默认呢?
现在的情况是:给了用户配置 dubbo.config-center.group=mydubbo 的自由,但是重启发现在mydubbo中的配置没有生效。只有在apollo触发变更事件的时候才会起作用
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [I] 动态配置指定group,启动时不加载配置 [dubbo]
Posted by "sick-cat (via GitHub)" <gi...@apache.org>.
sick-cat closed issue #12824: 动态配置指定group,启动时不加载配置
URL: https://github.com/apache/dubbo/issues/12824
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] AlbumenJ commented on issue #12824: 动态配置指定group,启动时不加载配置
Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #12824:
URL: https://github.com/apache/dubbo/issues/12824#issuecomment-1672433654
> > `group` 这个属性在 registry、config、metadata 里面都是不清晰的,按照标准的设计上 `group` 应该更像是 namespace 的一个纬度,但是 `namespace` 这个参数又已经存在了,所以使用上很容易出非预期的场景。 因此这种 case 下最好的模型是直接使用 `namespace`
>
> 疑惑点是使用nacos作为配置中心的前提下, 应用特有外部化配置。配置了namespace和group,但是实际情况group并没有使用配置的group值,而是读取了namespace下group值默认为dubbo.application.name的相关配置文件
如果吧 dubbo.configcenter 的 group 变成实际存储的 group 会导致实际读取配置的时候如果期望配置项按照 group 隔离的话就无法配置了
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org