application.yml

server:
  port: 8761

spring:
  application:
    name: greeting-service
  zipkin:
    base-url: http://localhost:9411 #用来指定Zipkin服务端的地址
  datasource: 
    type: com.alibaba.druid.pool.DruidDataSource
    platform: mysql
    url: jdbc:mysql://localhost:3306/eshop?serverTimezone=UTC&useSSL=false
    username: root
    password: root
    driver-class-name: com.mysql.cj.jdbc.Driver
  rabbitmq:
    host: localhost
    port: 5672
    username: rabbitadmin  
    password: 123456

security.basic.enabled: false #关闭安全验证

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false #表示自己就是注册中心,不用注册自己
    fetchRegistry: false #表示自己就是注册中心,不用去注册中心获取其他服务的地址
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

feign:
  hystrix:
    enabled: true #开启Hystrix对Feign的支持

zuul:
  routes:
    #标识你服务的名字,这里可以自己定义,一般方便和规范来讲还是跟自己服务的名字一样
    say-hello-service:
      #服务映射的路径,通过这路径就可以从外部访问你的服务了,目的是为了不爆露你机器的IP,面向服务的路由了,给你选一个可用的出来,
      #这里zuul是自动依赖hystrix,ribbon的,不是面向单机
      path: /say-hello-service/**
      #这里一定要是你Eureka注册中心的服务的名称,所以这里配置serviceId因为跟eureka结合了,如果单独使用zuul,那么就必须写自己机器的IP了,
      serviceId: say-hello-service

turbine:
  aggregator:
    clusterConfig: default 
    #指定聚合哪些集群,多个使用","分割,默认为default。可使用http://.../turbine.stream?cluster={clusterConfig之一}访问
  appConfig: say-hello-service # 配置Eureka中的serviceId列表,表明监控哪些服务
  clusterNameExpression: new String("default")
  #1.clusterNameExpression指定集群名称,默认表达式appName;此时:turbine.aggregator.clusterConfig需要配置想要监控的应用名称
  #2.当clusterNameExpression: default时,turbine.aggregator.clusterConfig可以不写,因为默认就是default
  #3.当clusterNameExpression: metadata['cluster']时,假设想要监控的应用配置了eureka.instance.metadata-map.cluster: ABC,  则需要配置,同时turbine.aggregator.clusterConfig: ABC



posted on 2023-02-07 12:23  焕然一鑫  阅读(17)  评论(0编辑  收藏  举报

导航