consul服务,zuul的service-id转发失败不知道如何解决?
使用的consul服务注册中心,所有的服务都可见且没有红叉
url方式好使,service-id跳转失败(一直说没有找到可用的服务端)
查过了名称都没问题
好多网上的解决办法都是eureka服务注册中心,我是用的是consul就不知道该如何解决了
springboot:2.6.12
springcloud:2021.0.1
eclipse环境
zuul: routes:
ribbon:
path: /ribbon/**
#url: http://localhost:8521
service-id: spring-cloud-consul-consumer # 转发到消费者 /ribbon/
zuul模块的依赖如下(除去springboot和springcloud):
<!-- springcloud consul--> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
<version>2.2.9.RELEASE</version>
</dependency>
需要跳转的模块的依赖如下(除去springboot和springcloud):
<!-- springcloud consul--> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
<version>2.2.9.RELEASE</version>
</dependency>
错误信息:
route:spring-cloud-consul-consumerexception:Load balancer does not have available server for client: spring-cloud-consul-consumer
回答:
版本不兼容吧,看看 spring-cloud-starter-consul-discovery 用的是哪个版本
https://github.com/spring-clo...
以上是 consul服务,zuul的service-id转发失败不知道如何解决? 的全部内容, 来源链接: utcz.com/p/944769.html