You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "manbab (GitHub)" <gi...@apache.org> on 2019/10/09 03:54:23 UTC

[GitHub] [dubbo-admin] manbab opened issue #522: nacos作为注册中心时,条件路由配置不起作用

dubbo2.7版本,使用nacos作为注册和配置中心
nacos.address = 192.168.0.204:8868
nacos.dataId = EsMobileServerLauncher
nacos.namespace = 18439051-b8bb-471c-950e-49adbdffb455
dubbo.registry.address = nacos://192.168.0.204:8868?namespace=18439051-b8bb-471c-950e-49adbdffb455
条件路由设置如下
conditions:
- => host != 192.168.0.206
enabled: true
force: true
key: com.everstar.mobile.service.INetEventService:1.0.0
priority: 0
runtime: true
scope: service

最后发现还是再206上执行了,这条规则没有产生效果
请问如何配置才能生效


[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] manbab commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "manbab (GitHub)" <gi...@apache.org>.
还需要别的说明么????

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] manbab commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "manbab (GitHub)" <gi...@apache.org>.
dubbo-admin 配置
server.port=8086
admin.registry.address=nacos://192.168.0.204:8868?namespace=18439051-b8bb-471c-950e-49adbdffb455
admin.config-center=nacos://192.168.0.204:8868?namespace=18439051-b8bb-471c-950e-49adbdffb455
admin.metadata-report.address=nacos://192.168.0.204:8868?namespace=18439051-b8bb-471c-950e-49adbdffb455

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] kexianjun commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "kexianjun (GitHub)" <gi...@apache.org>.
I'll check this later

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo-admin] manbab commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "manbab (GitHub)" <gi...@apache.org>.
我试一下,感觉上很奇怪,不会自动补充么

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] manbab commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "manbab (GitHub)" <gi...@apache.org>.
换成配置中心以后,发现com.everstar.mobile.service.INetEventService:1.0.0.condition-router,,这个地方少了个:符号应该再版本号后加个:,变成com.everstar.mobile.service.INetEventService:1.0.0:.condition-router

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] kexianjun commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "kexianjun (GitHub)" <gi...@apache.org>.
> 做了个测试,规则不变,206上服务依然被调用了
> conditions:
> 
> * => host != 192.168.0.206
>   enabled: true
>   force: true
>   key: com.everstar.mobile.service.INetEventService:1.0.0
>   priority: 0
>   runtime: false
>   scope: service

不生效的根本原因应该是 nacos 作为注册中心的时候,消费者端没有订阅 routers:xxx 节点导致的;2.7 以上的版本建议使用动态配置中心来做服务治理

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] kexianjun commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "kexianjun (GitHub)" <gi...@apache.org>.
> 做了个测试,规则不变,206上服务依然被调用了
> conditions:
> 
> * => host != 192.168.0.206
>   enabled: true
>   force: true
>   key: com.everstar.mobile.service.INetEventService:1.0.0
>   priority: 0
>   runtime: false
>   scope: service

不生效的原因应该是 nacos 作为注册中心的时候,消费者端没有订阅 routers:xxx 节点导致的;2.7 以上的版本建议使用动态配置中心来做服务治理

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] kexianjun commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "kexianjun (GitHub)" <gi...@apache.org>.
nacos 动态配置中心的实现有bug,稍后我看看怎么修掉吧

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] kexianjun commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "kexianjun (GitHub)" <gi...@apache.org>.
> 创建和修改条件路由时控制台回报错
> ![image](https://user-images.githubusercontent.com/3623460/66700167-54442800-ed20-11e9-90b3-35f638127ccd.png)

这个控制台页面报错我本地没有复现

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] manbab commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "manbab (GitHub)" <gi...@apache.org>.
在增加路由时,服务列表里的routers:::1.0.0:对应的元数据也被覆盖了

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] manbab commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "manbab (GitHub)" <gi...@apache.org>.
动态配置中心时监听的com.everstar.mobile.service.INetEventService:1.0.0:.condition-router这样一个配置

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] manbab commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "manbab (GitHub)" <gi...@apache.org>.
org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(URL url, NotifyListener listener)
会循环Categories
![image](https://user-images.githubusercontent.com/3623460/66754260-2c8fc400-eec8-11e9-982d-6a5beb7fe54e.png)
org.apache.dubbo.registry.nacos.NacosRegistry.doSubscribe(URL url, NotifyListener listener, Set<String> serviceNames)
里没有循环Categories
![image](https://user-images.githubusercontent.com/3623460/66754344-5812ae80-eec8-11e9-8fc8-0fb81af78620.png)
这个是dubbo2.7.3本身的bug么?

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] kexianjun commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "kexianjun (GitHub)" <gi...@apache.org>.
> org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(URL url, NotifyListener listener)
> 会循环Categories
> ![image](https://user-images.githubusercontent.com/3623460/66754260-2c8fc400-eec8-11e9-982d-6a5beb7fe54e.png)
> org.apache.dubbo.registry.nacos.NacosRegistry.doSubscribe(URL url, NotifyListener listener, Set serviceNames)
> 里没有循环Categories
> ![image](https://user-images.githubusercontent.com/3623460/66754344-5812ae80-eec8-11e9-8fc8-0fb81af78620.png)
> 这个是dubbo2.7.3本身的bug么?

这个不太清楚 nacos 这么写的意图,结果就是 routers:xxx 这个节点没有订阅,你可以去 dubbo 下面提个 issue 问一下

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] manbab commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "manbab (GitHub)" <gi...@apache.org>.
我做下测试

[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] manbab commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "manbab (GitHub)" <gi...@apache.org>.
创建和修改条件路由时控制台回报错
![image](https://user-images.githubusercontent.com/3623460/66700167-54442800-ed20-11e9-90b3-35f638127ccd.png)


[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-admin] manbab commented on issue #522: nacos作为注册中心时,条件路由配置不起作用

Posted by "manbab (GitHub)" <gi...@apache.org>.
routers:com.everstar.mobile.service.INetEventService:1.0.0:  
这个地方正常了,
调用时206还是会执行
我的配置文件如下

> nacos.address = 192.168.1.199:8848
> nacos.dataId = dubbo-EsMobileClientLauncher-cousumer
> nacos.namespace = fd4c2b5d-3649-4558-b85f-50b2f0eb6c4a
> dubbo.registry.address = nacos://192.168.1.199:8848?namespace=fd4c2b5d-3649-4558-b85f-50b2f0eb6c4a



我的启动注解如下
```
@SpringBootApplication
@Configuration
//@EnableCaching
//@EnableSwagger2
@EnableDubbo(scanBasePackages = "com") 
@EnableNacosConfig(globalProperties = @NacosProperties(serverAddr = "${nacos.address}",namespace="${nacos.namespace}"))
@EnableNacosDiscovery(globalProperties = @NacosProperties(serverAddr = "${nacos.address}",namespace="${nacos.namespace}"))
@NacosPropertySource(dataId = "${nacos.dataId}",autoRefreshed=true)
public class EsMobileClientLauncherApplication
```

_不生效的根本原因应该是 nacos 作为注册中心的时候,消费者端没有订阅 routers:xxx 节点导致的;2.7 以上的版本建议使用动态配置中心来做服务治理_
消费者端没有订阅 routers:xxx 节点  这个怎么订阅,上面的配置不能做到订阅么?
动态配置中心,nacos本身就应该算使用了动态配置中心了吧



[ Full content available at: https://github.com/apache/dubbo-admin/issues/522 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org