You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "wukaixian (via GitHub)" <gi...@apache.org> on 2023/11/16 02:36:55 UTC

[I] 使用多个注册中心时,默认mapping元数据只会上报到一个注册心,如何实现元数据上报到多个注册中心? [dubbo]

wukaixian opened a new issue, #13371:
URL: https://github.com/apache/dubbo/issues/13371

   `
   <dubbo:registry id="regA" address="nacos://127.0.0.1:8848?namespace=a" register-mode="instance"/>
   <dubbo:registry id="regB" address="nacos://127.0.0.1?namespace=b" register-mode="instance"/>
   `
   如上面代码所示,服务向nacos的两个命名空间注册,服务注册可以正常注册,但元数据只会注册到其中一个命名空间,导致另一个空间订阅时,无法启用应用级服务发现(需要mapping元数据支持),请问如何实现向多个注册中心上报元数据?


-- 
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


Re: [I] How to reigster metadata to multi registry [dubbo]

Posted by "wukaixian (via GitHub)" <gi...@apache.org>.
wukaixian commented on issue #13371:
URL: https://github.com/apache/dubbo/issues/13371#issuecomment-1820068510

   Thanks


-- 
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] 使用多个注册中心时,默认mapping元数据只会上报到一个注册心,如何实现元数据上报到多个注册中心? [dubbo]

Posted by "wukaixian (via GitHub)" <gi...@apache.org>.
wukaixian commented on issue #13371:
URL: https://github.com/apache/dubbo/issues/13371#issuecomment-1813724605

   [#https://github.com/apache/dubbo/blob/b74cf5be3f427867e69832e74f83d6aaa9276708/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java#L588-L625](https://github.com/apache/dubbo/blob/b74cf5be3f427867e69832e74f83d6aaa9276708/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java#L588-L625)
   
   看了注册中心转为元数据中心的代码,多个注册中心转换配置时,只有第一个是有效的,是否有问题?


-- 
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] How to reigster metadata to multi registry [dubbo]

Posted by "wukaixian (via GitHub)" <gi...@apache.org>.
wukaixian commented on issue #13371:
URL: https://github.com/apache/dubbo/issues/13371#issuecomment-1813929583

   It seems that your configuration isn't working as expected. According to the code snippet, `String key = url.toServiceString()`; does not include namespace parameters in the key. In other words, for the same address with different namespaces, only one metadataReport will be initialized. This setup does not support metadata reporting for multiple namespaces.
   
   This might be considered a bug as the key generated from the URL doesn't account for namespace parameters, resulting in a limitation where only one metadataReport is initialized even for different namespaces associated with the same address.
   
   ``` java
    public MetadataReport getMetadataReport(URL url) {
           url = url.setPath(MetadataReport.class.getName())
               .removeParameters(EXPORT_KEY, REFER_KEY);
           String key = url.toServiceString();
   
           MetadataReport metadataReport = serviceStoreMap.get(key);
           if (metadataReport != null) {
               return metadataReport;
           }
   
           // Lock the metadata access process to ensure a single instance of the metadata instance
           lock.lock();
           try {
               metadataReport = serviceStoreMap.get(key);
               if (metadataReport != null) {
                   return metadataReport;
               }
               boolean check = url.getParameter(CHECK_KEY, true) && url.getPort() != 0;
               try {
                   metadataReport = createMetadataReport(url);
               } catch (Exception e) {
                   if (!check) {
                       logger.warn(PROXY_FAILED_EXPORT_SERVICE, "", "", "The metadata reporter failed to initialize", e);
                   } else {
                       throw e;
                   }
               }
   
               if (check && metadataReport == null) {
                   throw new IllegalStateException("Can not create metadata Report " + url);
               }
               if (metadataReport != null) {
                   serviceStoreMap.put(key, metadataReport);
               }
               return metadataReport;
           } finally {
               // Release the lock
               lock.unlock();
           }
       }
   ```


-- 
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] How to reigster metadata to multi registry [dubbo]

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #13371:
URL: https://github.com/apache/dubbo/issues/13371#issuecomment-1813864216

   Try use
   ```
   <dubbo:registry id="regA" address="nacos://127.0.0.1:8848?namespace=a" register-mode="instance"/> 
   <dubbo:registry id="regB" address="nacos:/ /127.0.0.1?namespace=b" register-mode="instance"/>
   <dubbo:metadata id="regAMeta" address="nacos://127.0.0.1:8848?namespace=a" registry="regA"/> 
   <dubbo:metadata id="regBMeta" address="nacos:/ /127.0.0.1?namespace=b" registry="regB"/>
   ```


-- 
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] 使用多个注册中心时,默认mapping元数据只会上报到一个注册心,如何实现元数据上报到多个注册中心? [dubbo]

Posted by "wukaixian (via GitHub)" <gi...@apache.org>.
wukaixian commented on issue #13371:
URL: https://github.com/apache/dubbo/issues/13371#issuecomment-1813698821

   dubbo版本 `3.1.10`


-- 
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] How to reigster metadata to multi registry [dubbo]

Posted by "CrazyHZM (via GitHub)" <gi...@apache.org>.
CrazyHZM closed issue #13371: How to reigster metadata to multi registry
URL: https://github.com/apache/dubbo/issues/13371


-- 
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] How to reigster metadata to multi registry [dubbo]

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #13371:
URL: https://github.com/apache/dubbo/issues/13371#issuecomment-1818103616

   @chickenlj PTAL


-- 
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] How to reigster metadata to multi registry [dubbo]

Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj commented on issue #13371:
URL: https://github.com/apache/dubbo/issues/13371#issuecomment-1818121766

   > According to the code snippet, `String key = url.toServiceString()`; does not include namespace parameters in the key.
   
   Yes, the key does not have `namespace` included. I will file a pull request to fix it.


-- 
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