首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring consul turbine错误-无法启动到主机的连接,正在放弃:[]

Spring consul turbine错误-无法启动到主机的连接,正在放弃:[]
EN

Stack Overflow用户
提问于 2016-07-27 20:11:10
回答 1查看 568关注 0票数 0

我想从我的涡轮机应用程序中读取在领事注册的服务。我已经为它配置了涡轮机:

Bootstrap.yml

代码语言:javascript
复制
 server:
 port: 8050

spring:
 cloud:
  consul:
   discovery:
  prefer-ip-address: true
 host: *****hostName where consul reside****
 port: 8500

turbine:
 aggregator:
   clusterConfig: dm-geo
 appConfig: dm-geo

有依赖关系-

代码语言:javascript
复制
 <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
 </dependency>

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-netflix-turbine</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</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-consul-discovery</artifactId>
</dependency>

在主应用程序类上-

代码语言:javascript
复制
  @EnableTurbine
  @EnableHystrixDashboard
  @EnableDiscoveryClient

所有这些配置都是在涡轮机应用上完成的。

现在,在consul上注册的每个服务都有依赖关系-

代码语言:javascript
复制
    <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix</artifactId>
    </dependency>

    <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-consul-discovery</artifactId>
   </dependency>

在应用程序类上使用@EnableHystrix @EnableDiscoveryClient,在我们的rest调用方法中使用HystrixCommand,使用适当的回退逻辑调用其他服务。

application.properties:-

代码语言:javascript
复制
  spring.application.name=dm-geo

现在,我们的python脚本使用所需的配置来发现这些服务并在consul上注册。当我尝试获取每个hystrix.stream时,我能够获取hystrix仪表板。

但是在我的涡轮机应用程序中,错误被记录为

代码语言:javascript
复制
"timestamp":"2016-07-27T17:33:14.406+05:30","message":"Could not initiate connection to host, giving up,"logger_name":"com netflix turbine monitor instance InstanceMonitor","thread_name":"InstanceMonitor"

有人能在这方面帮忙吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-20 18:33:09

对于我们的应用涡轮机,现在已经解决了。基本上,流是通过URL进行身份验证的,所以我必须跳过这一步,这样就可以完美地显示涡轮机流和仪表板。例如:

代码语言:javascript
复制
security.ignored = /turbine.stream

在spring boot应用程序中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38612581

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档