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

   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   - [x] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   
   ## Ask your question here
   consumer配置指定dubbo端口是7001,provider配置指定的dubbo端口是5001,<br>
   但是建立连接时却是:The connection of /192.168.0.109:**51490** -> /192.168.0.109:5001 
is established,<br>
   导致调用接口时报No provider异常。
   其中这个5位数的端口不是配置指定的,而且每次重启会改变。
   
   - Dubbo version: 2.7.8
   - Java version: 1.8
   
   服务启动顺序:先启动consumer,再启动provider。
   provider启动完成时**consumer**打出来的日志:
   ```log
   2023-03-02 00:35:55.615  INFO 20228 --- [ncesChangeEvent] 
a.DubboServiceDiscoveryAutoConfiguration : The event of the service 
instances[name : ds-service , size : 1] change is about to be dispatched
   2023-03-02 00:35:55.616  WARN 20228 --- [ncesChangeEvent] 
c.a.c.dubbo.registry.DubboCloudRegistry  : APP ds-service instance changed, 
size changed zero!!!
   2023-03-02 00:35:58.802  INFO 20228 --- [ncesChangeEvent] 
a.DubboServiceDiscoveryAutoConfiguration : The event of the service 
instances[name : ds-service , size : 1] change is about to be dispatched
   2023-03-02 00:35:58.802  INFO 20228 --- [ncesChangeEvent] 
c.a.c.dubbo.registry.DubboCloudRegistry  : APP ds-service instance changed, 
size changed to 1
   2023-03-02 00:35:58.802  WARN 20228 --- [ncesChangeEvent] 
c.a.c.dubbo.registry.DubboCloudRegistry  : Subscription app ds-service, can't 
find metadata handler
   2023-03-02 00:35:58.804  INFO 20228 --- [ncesChangeEvent] 
c.a.c.d.s.DubboMetadataServiceProxy      : The metadata of Dubbo service[name : 
ds-service] is about to be initialized
   2023-03-02 00:35:58.807  INFO 20228 --- [ncesChangeEvent] 
c.a.c.dubbo.registry.DubboCloudRegistry  :  [DUBBO] Register: 
consumer://192.168.187.1/org.apache.dubbo.rpc.service.GenericService?application=ds-web&category=consumers&check=false&dubbo=2.0.2&generic=true&group=ds-service&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&pid=20228&qos.enable=false&release=2.7.8&retries=0&router=-default,revisionRouter&side=consumer&sticky=false&timeout=10000&timestamp=1677688558806&version=1.0.0,
 dubbo version: 2.7.8, current host: 192.168.187.1
   2023-03-02 00:35:58.808  INFO 20228 --- [ncesChangeEvent] 
c.a.c.dubbo.registry.DubboCloudRegistry  :  [DUBBO] Subscribe: 
consumer://192.168.187.1/org.apache.dubbo.rpc.service.GenericService?application=ds-web&category=providers,configurators,routers&check=false&dubbo=2.0.2&generic=true&group=ds-service&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&pid=20228&qos.enable=false&release=2.7.8&retries=0&router=-default,revisionRouter&side=consumer&sticky=false&timeout=10000&timestamp=1677688558806&version=1.0.0,
 dubbo version: 2.7.8, current host: 192.168.187.1
   2023-03-02 00:35:58.843  INFO 20228 --- [lientWorker-4-1] 
o.a.d.r.t.netty4.NettyClientHandler      :  [DUBBO] The connection of 
/192.168.0.109:51490 -> /192.168.0.109:5001 is established., dubbo version: 
2.7.8, current host: 192.168.187.1
   2023-03-02 00:35:58.849  INFO 20228 --- [ncesChangeEvent] 
o.a.d.remoting.transport.AbstractClient  :  [DUBBO] Successed connect to server 
/192.168.0.109:5001 from NettyClient 192.168.187.1 using dubbo version 2.7.8, 
channel is NettyChannel [channel=[id: 0xa98087e1, L:/192.168.0.109:51490 - 
R:/192.168.0.109:5001]], dubbo version: 2.7.8, current host: 192.168.187.1
   2023-03-02 00:35:58.849  INFO 20228 --- [ncesChangeEvent] 
o.a.d.remoting.transport.AbstractClient  :  [DUBBO] Start NettyClient 
/192.168.187.1 connect to the server /192.168.0.109:5001, dubbo version: 2.7.8, 
current host: 192.168.187.1
   2023-03-02 00:35:58.855  INFO 20228 --- [ncesChangeEvent] 
org.apache.dubbo.config.ReferenceConfig  :  [DUBBO] Refer dubbo service 
org.apache.dubbo.rpc.service.GenericService from url 
spring-cloud://192.168.187.128:9090/org.apache.dubbo.registry.RegistryService?anyhost=true&application=ds-web&bind.ip=192.168.0.109&bind.port=5001&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=true&group=ds-service&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&payload=102400000&pid=20228&qos.enable=false&register.ip=192.168.187.1&release=2.7.8&remote.application=ds-service&retries=0&revision=2.2.6.RELEASE&router=-default,revisionRouter&sca_revision=0&side=consumer&sticky=false&timeout=10000&timestamp=1677688558806&version=1.0.0,
 dubbo version: 2.7.8, current host: 192.168.187.1
   ```
   **provider**最后一行日志:
   ```log
   2023-03-02 00:35:58.858  INFO 15492 --- [erverWorker-3-1] 
o.a.d.r.t.netty4.NettyServerHandler      :  [DUBBO] The connection of 
/192.168.0.109:51490 -> /192.168.0.109:5001 is established., dubbo version: 
2.7.8, current host: 192.168.187.1
   ```
   
   **consumer**的配置:
   ```yaml
   dubbo:
     protocol:
       name: dubbo
       payload: 102400000
       port: 7001
     registry:
       address: spring-cloud://192.168.187.128
     cloud:
       subscribed-services: ds-service
     consumer:
       check: false
       retries: 0
       timeout: 10000
     application:
       name: ds-web
   ```
   **provider**的配置:
   ```yaml
   dubbo:
     scan:
       base-package: com.demo.dsservice
     protocol:
       name: dubbo
       payload: 102400000
       port: 5001
     registry:
       address: spring-cloud://192.168.187.128
     cloud:
       subscribed-services: 
     consumer:
       check: false
       timeout: 10000
     application:
       name: ds-service
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to