记dubbo consumer服务因订阅其他有异常的服务导致超时的问题

provider端怎么处理dubbo.cloud.subscribed-services

springCloudAlibaba+dubbo+nacos环境下,重启服务提供者或先启动服务消费者后启动服务提供者的情况下,消费者有时候会出现找不到服务的问题及解决方案(In the spring cloud Alibaba + Dubbo + Nacos environment, when the service provider is restarted or the service consumer is started first and then the service provider, sometimes the consumer can not find the service when calling) · Issue #1805 · alibaba/spring-cloud-alibaba · GitHub

在使用 dubbo 进行服务间调用

服务如果不指定 dubbo.cloud.subscribed-services ,默认会去订阅注册中心所有服务。

即:会因其他订阅的服务无法正常启动,导致服务连接超时,无法正常启动,无法正常连接nacos。

以下日志可以确定,不指定服务的话,会默认订阅许多无关的服务

[2022-03-14 14:40:03:255] [main] [WARN ] [c.a.c.d.m.r.DubboServiceMetadataRepository] The Spring application[name : consumers:com.xxx.app.cart.api.CartServiceApi::] does not expose The REST metadata in the Dubbo services.
[2022-03-14 14:40:03:270] [main] [WARN ] [c.a.c.d.m.r.DubboServiceMetadataRepository] The Spring application[name : consumers:com.xxx.app.main.api.delivery.DeliveryServiceApi::] does not expose The REST metadata in the Dubbo services.
[2022-03-14 14:40:03:286] [main] [WARN ] [c.a.c.d.m.r.DubboServiceMetadataRepository] The Spring application[name : consumers:com.xxx.app.main.api.goldcard.PayMemberPayPackageServiceApi::] does not expose The REST metadata in the Dubbo services.
[2022-03-14 14:40:03:301] [main] [WARN ] [c.a.c.d.m.r.DubboServiceMetadataRepository] The Spring application[name : consumers:com.xxx.app.main.api.member.AddressServiceApi::] does not expose The REST metadata in the Dubbo services.
[2022-03-14 14:40:03:323] [main] [WARN ] [c.a.c.d.m.r.DubboServiceMetadataRepository] The Spring application[name : consumers:com.xxx.app.main.api.member.DictServiceApi::] does not expose The REST metadata in the Dubbo services.
[2022-03-14 14:40:03:339] [main] [WARN ] [c.a.c.d.m.r.DubboServiceMetadataRepository] The Spring application[name : consumers:com.xxx.app.main.api.member.StoreHomeServiceApi::] does not expose The REST metadata in the Dubbo services.
[2022-03-14 14:40:03:359] [main] [WARN ] [c.a.c.d.m.r.DubboServiceMetadataRepository] The Spring application[name : consumers:com.xxx.app.main.api.member.UserInfoServiceApi::] does not expose The REST metadata in the Dubbo services.
[2022-03-14 14:40:03:372] [main] [WARN ] [c.a.c.d.m.r.DubboServiceMetadataRepository] The Spring application[name : consumers:com.xxx.app.sku.api.hd.HdGoodIdServiceApi::] does not expose The REST metadata in the Dubbo services.
[2022-03-14 14:40:03:383] [main] [WARN ] [c.a.c.d.m.r.DubboServiceMetadataRepository] The Spring application[name : consumers:com.xxx.app.sku.api.hotSell.HotSellServiceApi::] does not expose The REST metadata in the Dubbo services.
[2022-03-14 14:40:03:393] [main] [WARN ] [c.a.c.d.m.r.DubboServiceMetadataRepository] The Spring application[name : consumers:com.xxx.app.sku.api.newPeople.NewPeopleServiceApi::] does not expose The REST metadata in the Dubbo services.

其实出现这么多 WARN 级别的日志应该引起重视了。

最终发现是有某个服务出问题,导致连接超时了

org.apache.dubbo.remoting.RemotingException:client(urL:dubbo://10.130.24.33:20881/com.xxx.app.skU.api.sku.SkuServiceApi?

由于 网关服务 只是依赖某个特定的服务,所以通过配置

dubbo.cloud.subscribed-services="xxx-app-main-service"

即可解决问题!
SpringBoot 使用 dubbo 进行服务间调用可参考:https://blog.youkuaiyun.com/mikelv01/article/details/121858934

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值