Open 352926 opened 3 years ago
dubbo服务单独分组,或者单独分名称空间
dubbo.registry.group = dubbo
or
dubbo.registry.parameters.namespace = dubbo
To specify the internal network segment of the container for Dubbo consumption, you can try the following methods:
In the configuration of the Dubbo consumer side, set the Dubbo registration address to the internal network segment (Pod IP address) of the container instead of the load balancing IP address. In this way, the consumer will directly access the Dubbo service inside the container.
If you are using Spring Cloud Alibaba's Nacos as the registration center, you can try to set the registration address of the Dubbo service to the internal network segment of the container in the registration configuration of Nacos.
After this configuration, the consumer of Dubbo will directly access the Dubbo service inside the container without going through the load balancing service.
Environment
当前有如下问题: 10.20.2.18:20880为阿里云k8s上建立的私网集群负载均衡服务
具体现象:任何一台容器 消费dubbo时候,一次成功,一次失败。
出现这个问题的原因是,nacos配置直接用 负载均衡ip做了注册:
dubbo注册服务时使用PodIP注册(172.17.0.190:20880和172.17.0.191:20880),消费的时候却使用了负载均衡ip,即10.20.2.18:20880
网上搜了一圈,好像K8S容器自身与 负载均衡解析到自身时是不通的。
为什么非要指定负载均衡ip?因为公司环境相对复杂,服务器资源在多个阿里云账号下,虽然拉了内网专线
但不属于同一个K8S内网,因此不同账号下的容器内部Pod网络不通(即172网段),需要做负载均衡转发。
因此想到这种解决方案,如果纯spring cloud的话,没有问题,恰恰dubbo和springcloud注册的是同一个服务名(application.name),且指定了同一个ip:10.20.2.18
理想状态,dubbo 服务纯粹仅供系统内部调用,因此注册使用PodIP即可。而对外暴露feign调用的话,使用负载均衡ip做解析
但是目前就是 dubbo虽然注册上去是172网段,但是消费的时候,全部使用10.20.2.18负载均衡网段。
想来想去,这套架构,最合适的方案就是:系统与系统间feign用 负载均衡ip(10.xx),系统内部dubbo用 容器内部网段(172.xx)消费
请问大牛,想要指定dubbo消费网段要怎么做? 或者说,dubbo的服务与 cloud的服务区分开,也能间接解决此问题!
Steps to reproduce this issue
Pls. provide [GitHub address] to reproduce this issue.
Expected Result
172.17.0.191 消费 172.17.0.190:20880或172.17.0.191:20880
Actual Result
172.17.0.191 消费 10.20.2.18:20880 一次通,一次拒绝