我正在运行一个dubbo示例,并且提供程序注册到192.168.1.100
。
我已将/etc/hosts
更改为名称服务器,并成功对其进行了测试。但是当我启动提供程序时,它总是注册到错误的地址。
但是日志显示zk主机正确。 address=zookeeper://114.116.xx.xx:2181
[15/05/19 11:48:14:014 CST] main INFO zookeeper.ZookeeperTransporter: [DUBBO] No valid zookeeper client found from cache, therefore create a new client for url. zookeeper://114.116.xx.xx:2181/ConfigCenterConfig?address=zookeeper://114.116.xx.xx:2181&check=true&configFile=dubbo.properties&group=dubbo&highestPriority=false&namespace=dubbo&prefix=dubbo.config-center&timeout=3000&valid=true, dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:14:014 CST] main WARN config.ConfigurationUtils: [DUBBO] You specified the config centre, but there's not even one single config item in it., dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:14:014 CST] main WARN config.ConfigurationUtils: [DUBBO] You specified the config centre, but there's not even one single config item in it., dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:14:014 CST] main WARN config.AbstractConfig: [DUBBO] There's no valid metadata config found, if you are using the simplified mode of registry url, please make sure you have a metadata address configured properly., dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:14:014 CST] main INFO config.AbstractConfig: [DUBBO] Export dubbo service cn.jcorn.dubbo.api.GreetingService to local registry, dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:14:014 CST] main INFO config.AbstractConfig: [DUBBO] Export dubbo service cn.jcorn.dubbo.api.GreetingService to url dubbo://192.168.1.100:20880/cn.jcorn.dubbo.api.GreetingService?anyhost=true&application=first-dubbo-provider&bind.ip=192.168.1.100&bind.port=20880&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&interface=cn.jcorn.dubbo.api.GreetingService&methods=sayHello&pid=1064®ister=true&release=2.7.1&side=provider×tamp=1557935294228, dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:14:014 CST] main INFO config.AbstractConfig: [DUBBO] There's no valid monitor config found, if you want to open monitor statistics for Dubbo, please make sure your monitor is configured properly., dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:14:014 CST] main INFO config.AbstractConfig: [DUBBO] Register dubbo service cn.jcorn.dubbo.api.GreetingService url dubbo://192.168.1.100:20880/cn.jcorn.dubbo.api.GreetingService?anyhost=true&application=first-dubbo-provider&bind.ip=192.168.1.100&bind.port=20880&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&interface=cn.jcorn.dubbo.api.GreetingService&methods=sayHello&pid=1064®ister=true&release=2.7.1&side=provider×tamp=1557935294228 to registry registry://114.116.164.43:2181/org.apache.dubbo.registry.RegistryService?application=first-dubbo-provider&dubbo=2.0.2&pid=1064®istry=zookeeper&release=2.7.1×tamp=1557935294217, dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:15:015 CST] main INFO server.Server: [DUBBO] qos-server bind localhost:22222, dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:15:015 CST] main INFO transport.AbstractServer: [DUBBO] Start NettyServer bind /0.0.0.0:20880, export /192.168.1.100:20880, dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:15:015 CST] main INFO zookeeper.ZookeeperRegistry: [DUBBO] Load registry cache file C:\Users\I508530\.dubbo\dubbo-registry-first-dubbo-provider-114.116.164.43:2181.cache, data: {cn.jcorn.dubbo.api.GreetingService=empty://192.168.1.100:20880/cn.jcorn.dubbo.api.GreetingService?anyhost=true&application=first-dubbo-provider&bind.ip=192.168.1.100&bind.port=20880&category=configurators&check=false&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&interface=cn.jcorn.dubbo.api.GreetingService&methods=sayHello&pid=19372®ister=true&release=2.7.1&side=provider×tamp=1557935143900}, dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:15:015 CST] main INFO zookeeper.ZookeeperTransporter: [DUBBO] find valid zookeeper client from the cache for address: zookeeper://114.116.164.43:2181/org.apache.dubbo.registry.RegistryService?application=first-dubbo-provider&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=1064&release=2.7.1×tamp=1557935294217, dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:15:015 CST] main INFO zookeeper.ZookeeperRegistry: [DUBBO] Register: dubbo://192.168.1.100:20880/cn.jcorn.dubbo.api.GreetingService?anyhost=true&application=first-dubbo-provider&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&interface=cn.jcorn.dubbo.api.GreetingService&methods=sayHello&pid=1064®ister=true&release=2.7.1&side=provider×tamp=1557935294228, dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:15:015 CST] main INFO zookeeper.ZookeeperRegistry: [DUBBO] Subscribe: provider://192.168.1.100:20880/cn.jcorn.dubbo.api.GreetingService?anyhost=true&application=first-dubbo-provider&bind.ip=192.168.1.100&bind.port=20880&category=configurators&check=false&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&interface=cn.jcorn.dubbo.api.GreetingService&methods=sayHello&pid=1064®ister=true&release=2.7.1&side=provider×tamp=1557935294228, dubbo version: 2.7.1, current host: 192.168.1.100
[15/05/19 11:48:15:015 CST] main INFO zookeeper.ZookeeperRegistry: [DUBBO] Notify urls for subscribe url provider://192.168.1.100:20880/cn.jcorn.dubbo.api.GreetingService?anyhost=true&application=first-dubbo-provider&bind.ip=192.168.1.100&bind.port=20880&category=configurators&check=false&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&interface=cn.jcorn.dubbo.api.GreetingService&methods=sayHello&pid=1064®ister=true&release=2.7.1&side=provider×tamp=1557935294228, urls: [empty://192.168.1.100:20880/cn.jcorn.dubbo.api.GreetingService?anyhost=true&application=first-dubbo-provider&bind.ip=192.168.1.100&bind.port=20880&category=configurators&check=false&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&interface=cn.jcorn.dubbo.api.GreetingService&methods=sayHello&pid=1064®ister=true&release=2.7.1&side=provider×tamp=1557935294228], dubbo version: 2.7.1, current host: 192.168.1.100
dubbo主机应为114.116.xx.xx
,而不是192.168.1.100
。
动物园管理员客户端也显示了错误的地址。
[zk: localhost:2181(CONNECTED) 1] ls /dubbo/cn.jcorn.dubbo.api.GreetingService/providers
[dubbo%3A%2F%2F192.168.1.100%3A20880%2Fcn.jcorn.dubbo.api.GreetingService
答案 0 :(得分:0)
尝试禁用相关的网络适配器。我通过禁用回送网络适配器解决了这个问题
答案 1 :(得分:0)
在Ubuntu上运行代码后,它可以工作。
顺便说一句,我将主机编辑为我的主机名。