-
Notifications
You must be signed in to change notification settings - Fork 26.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dubbo provider side can't find service when deployed in docker. #1289
Comments
|
感谢你的回复,我们已经在docker中做了端口映射,并且我们通过命令 是可以正常调通并且我们在zookeeper中也是可以发现31838注册的provider服务,但我们通过consumer去调用provider端时,provider端会报如下错误: 我们通过修改DubboProtocol类源码:
经重新编译打包源码后测试调用成功。 docker端口映射代码如下: |
* @reference support annotate on annotation type * Fixes apache#1303 TimeUnit conversion error * Fixes apache#1289, use bind_port as mapping key * Fixes apache#1313, remove destroy check in Registry. * checkout .travis.yml from origin/master * Fix hessian2 serialized short, byte is converted to int bug (apache#1232) * Fix hessian2 serialized short, byte is converted to int bug * Fix hessian2 serialized short, byte is converted to int bug * adapt jdk1.5+ * fixed travis-ci failed because of test cases. (apache#1370) * Merge pull request apache#1377, remove redundant arguments for StatItem.isAllowable() * Merge pull request apache#1378, replace StringBuider with simple string concatenation in log. * Merge pull request apache#1375, remove unnecessary boxing. Fixes apache#1245 * Merge pull request apache#1331, add optional parameter to support hessian protocol method overload and request protocol version. * Merge pull request apache#1376, do not instantiate load balance if there is no invokers Fixes apache#1297 * Merge pull request apache#1384, fix build string bug. * Merge pull request apache#1040, refactor: replace some deprecated methods related with jedis. * Merge pull request apache#1242, remove redundant null check. fixes apache#1231
* @reference support annotate on annotation type * Fixes apache#1303 TimeUnit conversion error * Fixes apache#1289, use bind_port as mapping key * Fixes apache#1313, remove destroy check in Registry. * checkout .travis.yml from origin/master * Fix hessian2 serialized short, byte is converted to int bug (apache#1232) * Fix hessian2 serialized short, byte is converted to int bug * Fix hessian2 serialized short, byte is converted to int bug * adapt jdk1.5+ * fixed travis-ci failed because of test cases. (apache#1370) * Merge pull request apache#1377, remove redundant arguments for StatItem.isAllowable() * Merge pull request apache#1378, replace StringBuider with simple string concatenation in log. * Merge pull request apache#1375, remove unnecessary boxing. Fixes apache#1245 * Merge pull request apache#1331, add optional parameter to support hessian protocol method overload and request protocol version. * Merge pull request apache#1376, do not instantiate load balance if there is no invokers Fixes apache#1297 * Merge pull request apache#1384, fix build string bug. * Merge pull request apache#1040, refactor: replace some deprecated methods related with jedis. * Merge pull request apache#1242, remove redundant null check. fixes apache#1231 * Change Mailing list address * Fixed apache#1398, revert bugs introduced from apache#1375 * Fix time unit problem in UT * Fix time unit problem related with FutureAdapter in UT
* @reference support annotate on annotation type * Fixes apache#1303 TimeUnit conversion error * Fixes apache#1289, use bind_port as mapping key * Fixes apache#1313, remove destroy check in Registry. * checkout .travis.yml from origin/master * Fix hessian2 serialized short, byte is converted to int bug (apache#1232) * Fix hessian2 serialized short, byte is converted to int bug * Fix hessian2 serialized short, byte is converted to int bug * adapt jdk1.5+ * fixed travis-ci failed because of test cases. (apache#1370) * Merge pull request apache#1377, remove redundant arguments for StatItem.isAllowable() * Merge pull request apache#1378, replace StringBuider with simple string concatenation in log. * Merge pull request apache#1375, remove unnecessary boxing. Fixes apache#1245 * Merge pull request apache#1331, add optional parameter to support hessian protocol method overload and request protocol version. * Merge pull request apache#1376, do not instantiate load balance if there is no invokers Fixes apache#1297 * Merge pull request apache#1384, fix build string bug. * Merge pull request apache#1040, refactor: replace some deprecated methods related with jedis. * Merge pull request apache#1242, remove redundant null check. fixes apache#1231 * Change Mailing list address * Fixed apache#1398, revert bugs introduced from apache#1375 * Fix time unit problem in UT * Fix time unit problem related with FutureAdapter in UT * Fix time unit problem related with FutureAdapter in UT * Merge pull request apache#1391, fix typo of method name in qos module. * fix hessian lite test case fail bug (apache#1394) * fix hessian lite test case fail bug * update test * remove ignore * Fix time unit problem related with FutureAdapter in UT * revert file * fix number type is lost in yaml config file (apache#1401) * apache#1399 fi * update test * update readme to add some details (apache#1403) * update readme to add some details update readme to add some details * delete duplicated words delete duplicated words * update README format * apache#1411: Locale deserialize 'zh-hant_CN'
有些部署场景需要动态指定服务注册的地址,如docker bridge网络模式下要指定注册宿主机ip以实现外网通信。dubbo提供了两对启动阶段的系统属性,用于设置对外通信的ip、port地址
DUBBO_IP_TO_REGISTRY --- 注册到注册中心的ip地址
DUBBO_PORT_TO_REGISTRY --- 注册到注册中心的port端口
docker环境下对外服务的端口为DUBBO_PORT_TO_REGISTRY,但服务提供端在读取端口号时读取到的是本地端口号导致无法找到对应的服务。BUG信息如下:
Not found exported service: hbec.app.test.service.TestService:20881 in [hbec.app.test.service.TestService:31838]
问题代码如下:
DubboProtocol类
Invoker<?> getInvoker(Channel channel, Invocation inv) throws RemotingException {
boolean isCallBackServiceInvoke = false;
boolean isStubServiceInvoke = false;
int port = channel.getLocalAddress().getPort();//# 注:在docker环境下该端口取的是本地端口,非环境变量端口
String path = inv.getAttachments().get(Constants.PATH_KEY);
// if it's callback service on client side
isStubServiceInvoke = Boolean.TRUE.toString().equals(inv.getAttachments().get(Constants.STUB_EVENT_KEY));
if (isStubServiceInvoke) {
port = channel.getRemoteAddress().getPort();
}
The text was updated successfully, but these errors were encountered: