You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/08/11 02:02:09 UTC

[GitHub] [dubbo-js] realbillwong opened a new issue #250: 注册 nacos 服务时的端口未指定,导致无法建立长连接

realbillwong opened a new issue #250:
URL: https://github.com/apache/dubbo-js/issues/250


   在 dubbo.ts 的第 [133 行](https://github.com/apache/dubbo-js/blob/master/packages/dubbo-consumer/src/dubbo.ts#L133)
   
   ```javascript
   this.consumers.push({
     dubboServiceInterface: dubboInterface,
     dubboServiceUrl: `consumer://${ip.address()}/${dubboInterface}?${qs.stringify(
       {
         application: this.props.application.name,
         interface: dubboInterface,
         category: 'consumers',
         method: '',
         revision: version,
         version: group,
         group: version,
         timeout: timeout,
         side: 'consumer',
         check: false,
         pid: process.pid
       }
     )}`
   ```
   
   通过 ip.address() 只能获取到当前的 ip,并不能获取到当前程序运行的端口。
   
   然后往 nacos 注册该 consumer 服务的时候([registy-nacos.ts L149-L153](https://github.com/apache/dubbo-js/blob/master/packages/dubbo-registry/src/registry-nacos.ts#L149-L153)),就会使用默认的 80 端口,并导致无法建立连接。
   
   ```javascript
   // registry-nacos.ts L149-L153
   await this.client.registerInstance(dubboServiceInterface, {
     ip,
     port: port || 80,
     metadata
   })
   ```
   
   我找了一圈,似乎并没有可以获取到当前端口的方法。或许要在 registry 的时候,配置一下端口?
   
   另外,因为我的电脑配置了两个 IP 地址,实际上 ip.address() 只能获取到第一个([源码](https://github.com/indutny/node-ip/blob/master/lib/ip.js#L396)),虽然我这不是常见情况,但是可否支持一下配置,如果没有配置的话,则 fallback 到 ip.address()?


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


[GitHub] [dubbo-js] hufeng commented on issue #250: 注册 nacos 服务时的端口未指定,导致无法建立长连接

Posted by GitBox <gi...@apache.org>.
hufeng commented on issue #250:
URL: https://github.com/apache/dubbo-js/issues/250#issuecomment-909193079


    @godkun please help 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


[GitHub] [dubbo-js] hufeng commented on issue #250: 注册 nacos 服务时的端口未指定,导致无法建立长连接

Posted by GitBox <gi...@apache.org>.
hufeng commented on issue #250:
URL: https://github.com/apache/dubbo-js/issues/250#issuecomment-909193079


    @godkun please help 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


[GitHub] [dubbo-js] itzzit commented on issue #250: 注册 nacos 服务时的端口未指定,导致无法建立长连接

Posted by GitBox <gi...@apache.org>.
itzzit commented on issue #250:
URL: https://github.com/apache/dubbo-js/issues/250#issuecomment-936010723


   上面的那个注册方法,group和version入参传反了
   ![image](https://user-images.githubusercontent.com/40759020/136192401-613e2e2a-db5f-4275-a372-c68fb605b187.png)
   


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


[GitHub] [dubbo-js] hufeng commented on issue #250: 注册 nacos 服务时的端口未指定,导致无法建立长连接

Posted by GitBox <gi...@apache.org>.
hufeng commented on issue #250:
URL: https://github.com/apache/dubbo-js/issues/250#issuecomment-909193079


    @godkun please help 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