[apache/dubbo]使用组播作为注册中心无法注册服务

2023-12-11 554 views
3

尊敬的开发者 你好

我的服务配置如下

dubbo:
  application:
    name: ${spring.application.name}
    register-mode: instance
    qos-port: 33333
  registry:
    address: multicast://224.5.6.7:1234?unicast=false
  protocol:
    name: tri
    port: 20880
  consumer:
    check: false
    cache: false
    validation: true
    timeout: 3000

出现了官方文档说的 5-10 问题 https://cn.dubbo.apache.org/zh-cn/overview/mannual/java-sdk/faq/5/10/

版本:dubbo-spring-boot-starter:3.2.0 spring-boot:2.7.2

调用该服务报错,提示No provider available for the service xxxxx

回答

8

能否提供一个demo演示一下?

7

demo在这 https://github.com/wjzxc123/demo

错误如下:

2023-10-07 09:08:27.607  INFO 5636 --- [           main] o.a.dubbo.metadata.MappingCacheManager   :  [DUBBO] Successfully loaded mapping cache from file .mapping.service-A, entries 0, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:27.613  WARN 5636 --- [           main] o.a.d.r.c.m.MigrationRuleListener        :  [DUBBO] Using default configuration rule because config center is not configured!, dubbo version: 3.2.0, current host: 192.168.119.1, error code: 1-4. This may be caused by , go to https://dubbo.apache.org/faq/1/4 to find instructions. 
2023-10-07 09:08:27.615  WARN 5636 --- [           main] o.a.d.r.client.metadata.MetadataUtils    :  [DUBBO] Remote Metadata Report Server is not provided or unavailable, will stop registering service definition to remote center!, dubbo version: 3.2.0, current host: 192.168.119.1, error code: 1-39. This may be caused by , go to https://dubbo.apache.org/faq/1/39 to find instructions. 
2023-10-07 09:08:27.615  INFO 5636 --- [           main] org.apache.dubbo.config.ServiceConfig    :  [DUBBO] Try to register interface application mapping for service com.licon.api.ServiceA, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:27.615  WARN 5636 --- [           main] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] No valid metadata config center found for mapping report., dubbo version: 3.2.0, current host: 192.168.119.1, error code: 0-2. This may be caused by , go to https://dubbo.apache.org/faq/0/2 to find instructions. 
2023-10-07 09:08:27.615 ERROR 5636 --- [           main] org.apache.dubbo.config.ServiceConfig    :  [DUBBO] Failed register interface application mapping for service com.licon.api.ServiceA, dubbo version: 3.2.0, current host: 192.168.119.1, error code: 5-10. This may be caused by configuration server disconnected, go to https://dubbo.apache.org/faq/5/10 to find instructions. 
2023-10-07 09:08:27.616  INFO 5636 --- [           main] o.a.d.c.deploy.DefaultModuleDeployer     :  [DUBBO] Dubbo Module[1.1.0] is starting., dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:27.616  INFO 5636 --- [           main] o.a.d.c.deploy.DefaultModuleDeployer     :  [DUBBO] Dubbo Module[1.1.0] has started., dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:27.847  WARN 5636 --- [           main] o.a.dubbo.common.config.Environment      :  [DUBBO] dynamicConfiguration is null , return globalConfiguration., dubbo version: 3.2.0, current host: 192.168.119.1, error code: 0-12. This may be caused by , go to https://dubbo.apache.org/faq/0/12 to find instructions. 
2023-10-07 09:08:27.847  WARN 5636 --- [           main] o.a.dubbo.common.config.Environment      :  [DUBBO] dynamicConfiguration is null , return globalConfiguration., dubbo version: 3.2.0, current host: 192.168.119.1, error code: 0-12. This may be caused by , go to https://dubbo.apache.org/faq/0/12 to find instructions. 
2023-10-07 09:08:27.867  INFO 5636 --- [           main] o.a.d.r.multicast.MulticastRegistry      :  [DUBBO] Send multicast message: register consumer://192.168.119.1/com.licon.api.ServiceB?application=service-A&background=false&cache=false&category=consumers&check=false&dubbo=2.0.2&executor-management-mode=isolation&file-cache=true&interface=com.licon.api.ServiceB&methods=testB&pid=5636&qos.enable=true&qos.port=33334&register-mode=instance&release=3.2.0&side=consumer&sticky=false&timeout=3000&timestamp=1696640907621&unloadClusterRelated=false&validation=true to /224.5.6.7:1234, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:27.868  INFO 5636 --- [egistryReceiver] o.a.d.r.multicast.MulticastRegistry      :  [DUBBO] Receive multicast message: register consumer://192.168.119.1/com.licon.api.ServiceB?application=service-A&background=false&cache=false&category=consumers&check=false&dubbo=2.0.2&executor-management-mode=isolation&file-cache=true&interface=com.licon.api.ServiceB&methods=testB&pid=5636&qos.enable=true&qos.port=33334&register-mode=instance&release=3.2.0&side=consumer&sticky=false&timeout=3000&timestamp=1696640907621&unloadClusterRelated=false&validation=true from /192.168.119.1:1234, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:27.877  INFO 5636 --- [           main] o.a.d.r.multicast.MulticastRegistry      :  [DUBBO] Subscribe: consumer://192.168.119.1/com.licon.api.ServiceB?application=service-A&background=false&cache=false&category=providers,configurators,routers&check=false&dubbo=2.0.2&executor-management-mode=isolation&file-cache=true&interface=com.licon.api.ServiceB&methods=testB&pid=5636&qos.enable=true&qos.port=33334&register-mode=instance&release=3.2.0&side=consumer&sticky=false&timeout=3000&timestamp=1696640907621&unloadClusterRelated=false&validation=true, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:27.877  INFO 5636 --- [           main] o.a.d.r.multicast.MulticastRegistry      :  [DUBBO] Send multicast message: subscribe consumer://192.168.119.1/com.licon.api.ServiceB?application=service-A&background=false&cache=false&category=providers,configurators,routers&check=false&dubbo=2.0.2&executor-management-mode=isolation&file-cache=true&interface=com.licon.api.ServiceB&methods=testB&pid=5636&qos.enable=true&qos.port=33334&register-mode=instance&release=3.2.0&side=consumer&sticky=false&timeout=3000&timestamp=1696640907621&unloadClusterRelated=false&validation=true to /224.5.6.7:1234, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:27.878  INFO 5636 --- [egistryReceiver] o.a.d.r.multicast.MulticastRegistry      :  [DUBBO] Receive multicast message: subscribe consumer://192.168.119.1/com.licon.api.ServiceB?application=service-A&background=false&cache=false&category=providers,configurators,routers&check=false&dubbo=2.0.2&executor-management-mode=isolation&file-cache=true&interface=com.licon.api.ServiceB&methods=testB&pid=5636&qos.enable=true&qos.port=33334&register-mode=instance&release=3.2.0&side=consumer&sticky=false&timeout=3000&timestamp=1696640907621&unloadClusterRelated=false&validation=true from /192.168.119.1:1234, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.881  WARN 5636 --- [           main] o.a.d.r.multicast.MulticastRegistry      :  [DUBBO] Ignore empty notify urls for subscribe url consumer://192.168.119.1/com.licon.api.ServiceB?application=service-A&background=false&cache=false&category=providers,configurators,routers&check=false&dubbo=2.0.2&executor-management-mode=isolation&file-cache=true&interface=com.licon.api.ServiceB&methods=testB&pid=5636&qos.enable=true&qos.port=33334&register-mode=instance&release=3.2.0&side=consumer&sticky=false&timeout=3000&timestamp=1696640907621&unloadClusterRelated=false&validation=true, dubbo version: 3.2.0, current host: 192.168.119.1, error code: 1-4. This may be caused by , go to https://dubbo.apache.org/faq/1/4 to find instructions. 
2023-10-07 09:08:30.898  INFO 5636 --- [           main] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Local cache mapping is empty, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.900  INFO 5636 --- [           main] o.a.d.r.client.ServiceDiscoveryRegistry  :  [DUBBO] No interface-apps mapping found in local cache, stop subscribing, will automatically wait for mapping listener callback: consumer://192.168.119.1/com.licon.api.ServiceB?application=service-A&background=false&cache=false&category=providers,configurators,routers&check=false&dubbo=2.0.2&executor-management-mode=isolation&file-cache=true&interface=com.licon.api.ServiceB&methods=testB&pid=5636&qos.enable=true&qos.port=33334&register-mode=instance&release=3.2.0&side=consumer&sticky=false&timeout=3000&timestamp=1696640907621&unloadClusterRelated=false&validation=true, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.903  INFO 5636 --- [           main] .r.c.m.DefaultMigrationAddressComparator :  [DUBBO] No instance address available, stop compare., dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.903  INFO 5636 --- [           main] o.a.d.r.c.m.MigrationRuleHandler         :  [DUBBO] Succeed Migrated to APPLICATION_FIRST mode. Service Name: com.licon.api.ServiceB, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.903  INFO 5636 --- [           main] org.apache.dubbo.config.ReferenceConfig  :  [DUBBO] Referred dubbo service: [com.licon.api.ServiceB]. it's not GenericService reference, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.903  WARN 5636 --- [           main] o.a.d.r.client.metadata.MetadataUtils    :  [DUBBO] Remote Metadata Report Server is not provided or unavailable, will stop registering service definition to remote center!, dubbo version: 3.2.0, current host: 192.168.119.1, error code: 1-39. This may be caused by , go to https://dubbo.apache.org/faq/1/39 to find instructions. 
2023-10-07 09:08:30.906  INFO 5636 --- [           main] o.a.d.c.deploy.DefaultModuleDeployer     :  [DUBBO] Dubbo Module[1.1.1] has started., dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.906  INFO 5636 --- [           main] o.a.d.c.d.DefaultMetricsServiceExporter  :  [DUBBO] The MetricsConfig not exist, will not export metrics service., dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.908  INFO 5636 --- [           main] o.a.d.c.b.b.InternalServiceConfigBuilder :  [DUBBO] org.apache.dubbo.metadata.MetadataServiceService Port hasn't been set will use default protocol defined in protocols., dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.909  INFO 5636 --- [           main] o.a.d.c.b.b.InternalServiceConfigBuilder :  [DUBBO] Using tri protocol to export org.apache.dubbo.metadata.MetadataService service on port 38889, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.916  WARN 5636 --- [           main] o.a.dubbo.common.config.Environment      :  [DUBBO] dynamicConfiguration is null , return globalConfiguration., dubbo version: 3.2.0, current host: 192.168.119.1, error code: 0-12. This may be caused by , go to https://dubbo.apache.org/faq/0/12 to find instructions. 
2023-10-07 09:08:30.937  INFO 5636 --- [           main] org.apache.dubbo.config.ServiceConfig    :  [DUBBO] Export dubbo service org.apache.dubbo.metadata.MetadataService to local registry url : injvm://127.0.0.1/org.apache.dubbo.metadata.MetadataService?anyhost=true&application=service-A&background=false&bind.ip=192.168.119.1&bind.port=38889&delay=0&deprecated=false&dubbo=2.0.2&dynamic=true&executor-management-mode=isolation&exporter.listener=injvm&file-cache=true&generic=false&getAndListenInstanceMetadata.1.callback=true&getAndListenInstanceMetadata.return=true&getAndListenInstanceMetadata.sent=true&group=service-A&interface=org.apache.dubbo.metadata.MetadataService&methods=exportInstanceMetadata,getAndListenInstanceMetadata,getExportedServiceURLs,getExportedURLs,getExportedURLs,getExportedURLs,getExportedURLs,getExportedURLs,getInstanceMetadataChangedListenerMap,getMetadataInfo,getMetadataInfos,getMetadataURL,getServiceDefinition,getServiceDefinition,getSubscribedURLs,isMetadataService,serviceName,toSortedStrings,toSortedStrings,version&pid=5636&prefer.serialization=fastjson2,hessian2&qos.enable=true&qos.port=33334&register=false&register-mode=instance&release=3.2.0&revision=3.2.0&side=provider&timestamp=1696640910917&version=1.0.0, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.938  INFO 5636 --- [           main] org.apache.dubbo.config.ServiceConfig    :  [DUBBO] Export dubbo service org.apache.dubbo.metadata.MetadataService to url tri://192.168.119.1:38889/org.apache.dubbo.metadata.MetadataService?anyhost=true&application=service-A&background=false&bind.ip=192.168.119.1&bind.port=38889&delay=0&deprecated=false&dubbo=2.0.2&dynamic=true&executor-management-mode=isolation&file-cache=true&generic=false&getAndListenInstanceMetadata.1.callback=true&getAndListenInstanceMetadata.return=true&getAndListenInstanceMetadata.sent=true&group=service-A&interface=org.apache.dubbo.metadata.MetadataService&methods=exportInstanceMetadata,getAndListenInstanceMetadata,getExportedServiceURLs,getExportedURLs,getExportedURLs,getExportedURLs,getExportedURLs,getExportedURLs,getInstanceMetadataChangedListenerMap,getMetadataInfo,getMetadataInfos,getMetadataURL,getServiceDefinition,getServiceDefinition,getSubscribedURLs,isMetadataService,serviceName,toSortedStrings,toSortedStrings,version&pid=5636&prefer.serialization=fastjson2,hessian2&qos.enable=true&qos.port=33334&register=false&register-mode=instance&release=3.2.0&revision=3.2.0&service-name-mapping=true&side=provider&timestamp=1696640910917&version=1.0.0, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.940  WARN 5636 --- [           main] o.a.d.r.c.m.MigrationRuleListener        :  [DUBBO] Using default configuration rule because config center is not configured!, dubbo version: 3.2.0, current host: 192.168.119.1, error code: 1-4. This may be caused by , go to https://dubbo.apache.org/faq/1/4 to find instructions. 
2023-10-07 09:08:30.940  INFO 5636 --- [           main] org.apache.dubbo.config.ServiceConfig    :  [DUBBO] Try to register interface application mapping for service service-A/org.apache.dubbo.metadata.MetadataService:1.0.0, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.940  WARN 5636 --- [           main] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] No valid metadata config center found for mapping report., dubbo version: 3.2.0, current host: 192.168.119.1, error code: 0-2. This may be caused by , go to https://dubbo.apache.org/faq/0/2 to find instructions. 
2023-10-07 09:08:30.940 ERROR 5636 --- [           main] org.apache.dubbo.config.ServiceConfig    :  [DUBBO] Failed register interface application mapping for service service-A/org.apache.dubbo.metadata.MetadataService:1.0.0, dubbo version: 3.2.0, current host: 192.168.119.1, error code: 5-10. This may be caused by configuration server disconnected, go to https://dubbo.apache.org/faq/5/10 to find instructions. 
2023-10-07 09:08:30.940  INFO 5636 --- [           main] .c.m.ConfigurableMetadataServiceExporter :  [DUBBO] The MetadataService exports urls : [tri://192.168.119.1:38889/org.apache.dubbo.metadata.MetadataService?anyhost=true&application=service-A&background=false&bind.ip=192.168.119.1&bind.port=38889&delay=0&deprecated=false&dubbo=2.0.2&dynamic=true&executor-management-mode=isolation&file-cache=true&generic=false&getAndListenInstanceMetadata.1.callback=true&getAndListenInstanceMetadata.return=true&getAndListenInstanceMetadata.sent=true&group=service-A&interface=org.apache.dubbo.metadata.MetadataService&methods=exportInstanceMetadata,getAndListenInstanceMetadata,getExportedServiceURLs,getExportedURLs,getExportedURLs,getExportedURLs,getExportedURLs,getExportedURLs,getInstanceMetadataChangedListenerMap,getMetadataInfo,getMetadataInfos,getMetadataURL,getServiceDefinition,getServiceDefinition,getSubscribedURLs,isMetadataService,serviceName,toSortedStrings,toSortedStrings,version&pid=5636&prefer.serialization=fastjson2,hessian2&qos.enable=true&qos.port=33334&register=false&register-mode=instance&release=3.2.0&revision=3.2.0&service-name-mapping=true&side=provider&timestamp=1696640910917&version=1.0.0], dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.941  INFO 5636 --- [           main] o.a.d.r.c.m.ServiceInstanceMetadataUtils :  [DUBBO] Start registering instance address to registry., dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.945  WARN 5636 --- [           main] .r.c.m.ServiceInstanceHostPortCustomizer :  [DUBBO] Can't find an instance URL using the default preferredProtocol "dubbo", falling back to the strategy that pick the first found protocol. Please try modifying the config of dubbo.application.protocol, dubbo version: 3.2.0, current host: 192.168.119.1, error code: 4-2. This may be caused by typo in preferred protocol, go to https://dubbo.apache.org/faq/4/2 to find instructions. 
2023-10-07 09:08:30.954  INFO 5636 --- [           main] org.apache.dubbo.metadata.MetadataInfo   :  [DUBBO] metadata revision changed: null -> fe0ab1c0cdbd3d2de76473e31c465314, app: service-A, services: 1, dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.960  INFO 5636 --- [           main] o.a.d.c.d.DefaultApplicationDeployer     :  [DUBBO] Dubbo Application[1.1](service-A) is ready., dubbo version: 3.2.0, current host: 192.168.119.1
2023-10-07 09:08:30.964  INFO 5636 --- [           main] com.licon.ServiceAApplication            : Started ServiceAApplication in 5.64 seconds (JVM running for 6.001)
2

看上去像是后注册服务的服务目录没有初始化,导致后续通过服务目录添加Invoker失败:

先注册的服务: (发布DemoServiceDemoService引用 DemoServiceB,url有绑定的RegistryDirectory,可以更新成功) 屏幕截图 2023-10-08 230442

后注册的服务: (发布DemoServiceB,DemoServiceB 引用 DemoService, url不存在绑定的RegistryDirectory,导致调用 DemoServiceB 时出现类似错误) 屏幕截图 2023-10-08 225043

可以考虑暂时先用ZooKeeper代替 @AlbumenJ

1

image

看一下正常流程应该是怎么样的