spring cloud eureka client 写法

Posted whm-blog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spring cloud eureka client 写法相关的知识,希望对你有一定的参考价值。

spring:
  application:
    name: $app:unicom-statistic

  cloud:
    config:
      uri: http://$config-ip:192.168.0.110:8500
      profile: $profile:dev
      label: master
  task:
    scheduling:
      pool:
        size: 5
  # 数据源
  datasource:
    username: $db.username
    password: $db.password
    type: com.zaxxer.hikari.HikariDataSource
    driver-class-name: com.mysql.cj.jdbc.NonRegisteringDriver
    url: jdbc:mysql://$db.host/$db.name?useSSL=false&serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8
    hikari:
      minimum-idle: 1
      maximum-pool-size: 3
    tomcat:
      min-idle: 1
      max-active: 3
mybatis:
  mapper-locations: classpath*:cloud/cjy/travel/module/**/permenentPeopleDao/*.xml,classpath*:cloud/cjy/travel/**/permenentPeopleDao/*.xml,classpath*:cloud/cjy/travel/module/common/**/permenentPeopleDao/*.xml


# eureka 配置
eureka:
  instance:
    # 一个 项目部署多个时, appname 应该一致, instance-id 不一致
    appname: unicom-statistic  
    # instance-id: $spring.cloud.client.ip-address:$server.port 
    instance-id: $spring.application.name-$spring.cloud.client.ip-address
  client:
    fetch-registry: true
    service-url:
      defaultZone: http://$eureka-server.user:$eureka-server.password@$eureka-server.host/eureka/

# feign 超时 配置,不可修改
feign-timeout: 1800000 # 半小时
feign:
  client:
    default:
      #这里时间一定要调长,否则feign客户端会报ReadTimeOut  服务端报Error parsing HTTP request header
      connectTimeout: 60000
      readTimeout: $feign-timeout
      loggerLevel: basic
  httpclient:
    connection-timeout: 60000
ribbon:
  ReadTimeout: $feign-timeout
  ConnectTimeout: 60000

 

以上是关于spring cloud eureka client 写法的主要内容,如果未能解决你的问题,请参考以下文章

Eureka 源码

spring cloud 2.x版本 Gateway路由网关教程

eureka 提供服务

Nacos——微服务下的服务注册

spring cloud 之 Eureka

spring cloud 之eureka配置