0
点赞
收藏
分享

微信扫一扫

系列四、Eureka自我保护

蒸熟的土豆 2024-01-02 阅读 33

一、Eureka自我保护

1.1、故障现象

1.2、故障原因 

1.3、怎么禁止自我保护

1.3.1、application.yml(8001) 

server:
  port: 8001

spring:
  application:
    name: cloud-payment-service
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/20230906_springcloud_alibaba?useSSL=false&useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
    username: root
    password: 123456

mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    map-underscore-to-camel-case: true
  mapper-locations: classpath:mappers/*.xml
  global-config:
    db-config:
      # 基于雪花算法生成id
      id-type: assign_id
      logic-delete-field: deleted
      logic-not-delete-value: 0
      logic-delete-value: 1
  type-aliases-package: org.star.entity.model

eureka:
  client:
    # true:表示是否将自己注册进EurekaServer,默认为true
    register-with-eureka: true
    # 是否从EurekaServer抓取已有的注册信息,默认为true。单节点无所谓,集群必须设置为true才能配合ribbon使用负载均衡
    fetch-registry: true
    service-url:
      # 单机版
      defaultZone: http://localhost:7001/eureka
      # 集群版
      # defaultZone: http://eureka7001.com:7001/eureka,http://eureka7002.com:7002/eureka
  instance:
    instance-id: payment8001
    prefer-ip-address: true
    # Eureka客户端向服务端发送心跳的时间间隔,单位为秒(默认是30秒)
    lease-renewal-interval-in-seconds: 1

1.3.2、application.yml(7001) 

server:
  port: 7001

eureka:
  instance:
    hostname: localhost
  client:
    # false:表示不向注册中心注册自己、true:表示向注册中心注册自己
    register-with-eureka: false
    # false:表示自己就是注册中心,我的职责就是维护服务实例,并不需要去检索服务
    fetch-registry: false

 

举报

相关推荐

0 条评论