开发者社区 > 云原生 > 正文

无法更改为zookeeper作为发现注册表服务器而不是Nacos

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

展开
收起
白夜行fighting 2023-06-11 10:12:50 80 0
1 条回答
写回答
取消 提交回答
  • 配置项出现问题: 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

    2023-06-11 11:16:47
    赞同 展开评论 打赏

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关产品

  • 微服务引擎
  • 相关电子书

    更多
    《MSE 微服务网关》 立即下载
    微服务引擎 MSE 治理中心重磅发布 立即下载
    阿里云微服务引擎 MSE 2.0 线上发布 立即下载