一切顺势而行 2019-07-03 21:29 采纳率: 17.6%
浏览 398
已结题

springcloud 断路器监控使用遇到的问题

1.springcloud Finacy Release hystrix dashboard eureka 作为注册中心
hystrix 访问下载 hystrix 文件 /hystrix 一直ping ,使用zookeeper 作为注册中心的时候没有问题。

2.使用zookeeper 作为注册中心,使用Tubline 作为监控的时候一直报EurekaClient not found ,但是jar包是引入了,就是不知道为为什么找不到

已经加入hystrix 注解和 hystrix 注解对应的jar 包 和 spring-boot-acuator 的jar包 已经在bean 中创建那个/hystrix.stream 的 servlet

使用zookeeper 作为注册中心的时候是可以的,

@EnableHystrix
@EnableHystrixDashboard
@EnableEurekaClient
@EnableDiscoveryClient
//@SpringBootApplicat ion(exclude = {EurekaClientAutoConfiguration.class})
@SpringBootApplication
public class SpringcloudClientApplication {

@Bean
@LoadBalanced
RestTemplate restTemplate(){
    return new RestTemplate();
}

public static void main(String[] args) {
    SpringApplication.run(SpringcloudClientApplication.class, args);
}

}

#服务端口号
server:
port: 8090
#应用名称
spring:
application:
name: eureka-client
data:
mongodb:
uri: mongodb://192.168.209.128:27017/user
cloud:
#zookeeper:
#connect-string: 192.168.209.128:2181
#discovery:
#register: true
#enabled: true
#instance-id: 1
#root: /zkRoot
config:
enabled: true
discovery:
enabled: true
loadbalancer:
retry:
enabled: true
#consule:
#host: 127.0.0.1
#port: 8500
#discovery:
#register: false
security:
user:
name: wumging
password: wuming
# Redis数据库索引(默认为0)

redis:
database: 10
host: 192.168.209.128
port: 6379
timeout : 1000
ribbon:
eureka:
enabled: true
feign:
hystrix:
enabled: false

management :
endpoints:
web:
exposure:
include: hystrix.stream

#turbine:
#app-config: eureka-server,eureka-server2
#aggregator:
#clusterConfig: default
#clusterNameExpression: "'default'"
#combine-host-port: true
#instanceUrlSuffix: /hystrix.stream

hystrix:
common:
default:
execution:
timeout:
enabled: false

isolation:
thread:
timeoutInMilliseconds: 5000

#服务注册地址
eureka:
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/

            <dependencies>
    <dependency>
        <groupId>org.springcloud</groupId>
        <artifactId>springcloud-common</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <!-- <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-zookeeper-discovery</artifactId>
    </dependency> -->
    <!-- <dependency>
        <groupId>org.apache.zookeeper</groupId>
        <artifactId>zookeeper</artifactId>
        <version>3.4.8</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>-->
    <dependency> 
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>

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

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-hystrix</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-turbine</artifactId>
    </dependency>

-->

org.springframework.cloud
spring-cloud-starter-netflix-eureka-client

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

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-netflix-zuul</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</artifactId>
    </dependency> 
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
</dependencies>
  • 写回答

1条回答 默认 最新

  • dabocaiqq 2019-07-04 00:11
    关注
    评论

报告相同问题?

悬赏问题

  • ¥20 SQL server表计算问题
  • ¥15 C# P/Invoke的效率问题
  • ¥20 thinkphp适配人大金仓问题
  • ¥20 Oracle替换.dbf文件后无法连接,如何解决?(相关搜索:数据库|死循环)
  • ¥15 数据库数据成问号了,前台查询正常,数据库查询是?号
  • ¥15 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)
  • ¥15 彩灯控制电路,会的加我QQ1482956179
  • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传
  • ¥15 (关键词-电路设计)
  • ¥15 如何解决MIPS计算是否溢出