spring-cloud-alibaba dubbo
描述你遇到的问题
我只是按照spring-cloud-alibaba-dubbo的自述来做一个项目。 我想使用zookeeper而不是nacos,但当启动应用程序并尝试连接远程zookeepper服务器时,它无法连接我在中配置的正确远程地址application.yml,但始终尝试连接localhost:2181。
pom.xml
4.0.0 org.springframework.cloud spring-cloud-build 2.1.3.RELEASE com.novawind.cloud sargeras 1.0.0 sargeras based on spring-cloud-alibaba-dubbo 1.8 2.7.1 2.1.2.RELEASE 4.0.1 com.alibaba.cloud spring-cloud-alibaba-dependencies 2.1.0.RELEASE pom import org.apache.dubbo dubbo ${dubbo.version} org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test org.springframework.boot spring-boot-actuator com.alibaba.cloud spring-cloud-starter-dubbo org.springframework.cloud spring-cloud-starter-zookeeper-discovery org.apache.zookeeper zookeeper ${spring-cloud-zookeeper.version} org.apache.zookeeper zookeeper 3.4.12 org.apache.curator curator-framework ${curator.version} org.springframework.boot spring-boot-maven-plugin application.yml dubbo: scan: base-packages: com.novawind.cloud.sargeras.service protocol: name: dubbo port: -1 registry: address: zookeeper://warwick01:2181 spring: application: name: sargeras-app main: allow-bean-definition-overriding: true # cloud: # nacos: # discovery: # server-addr: warwick01:8848 # server-addr: warwick01:8848 console outputs 2019-11-06 10:35:44.014 INFO 7828 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib 2019-11-06 10:35:44.014 INFO 7828 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.io.tmpdir=/tmp 2019-11-06 10:35:44.014 INFO 7828 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.compiler= 2019-11-06 10:35:44.014 INFO 7828 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.name=Linux 2019-11-06 10:35:44.014 INFO 7828 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.arch=amd64 2019-11-06 10:35:44.014 INFO 7828 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.version=4.15.0-041500rc4-generic 2019-11-06 10:35:44.014 INFO 7828 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.name=xiongfeng 2019-11-06 10:35:44.014 INFO 7828 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.home=/home/xiongfeng 2019-11-06 10:35:44.014 INFO 7828 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.dir=/home/xiongfeng/projects/cloud/sargeras 2019-11-06 10:35:44.015 INFO 7828 --- [ main] org.apache.zookeeper.ZooKeeper : Initiating client connection, connectString=localhost:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState@6a282fdd 2019-11-06 10:35:44.025 INFO 7828 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) 2019-11-06 10:35:44.026 INFO 7828 --- [ main] o.a.c.f.imps.CuratorFrameworkImpl : Default schema 2019-11-06 10:35:44.030 INFO 7828 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Socket error occurred: localhost/127.0.0.1:2181: 拒绝连接 2019-11-06 10:35:45.133 INFO 7828 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) 2019-11-06 10:35:45.134 INFO 7828 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Socket error occurred: localhost/127.0.0.1:2181: 拒绝连接 2019-11-06 10:35:46.235 INFO 7828 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) 2019-11-06 10:35:46.236 INFO 7828 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Socket error occurred: localhost/127.0.0.1:2181: 拒绝连接 原提问者GitHub用户bearwind配置项出现问题: dubbo: scan: base-packages: com.novawind.cloud.sargeras.service protocol: name: dubbo port: -1 registry: address: zookeeper://warwick01:2181 # address should be spring-cloud://warwick01:2181 spring: application: name: sargeras-app main: allow-bean-definition-overriding: true cloud: zookeeper: # add spring cloud zookeeper connect-string connect-string: warwick01:8848
原回答者GitHub用户fangjian0423
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。