Git Product home page Git Product logo

springcloudlearn's Introduction

目录说明: sc-eureka-single :单机版eureka服务示例,包含注册中心、服务注册、服务调用
sc-eureka-cluster :多机集群版eureka服务示例,包含注册中心、服务注册、服务调用
sc-eureka-single-security :具备权限认证的单机版eureka服务示例,包含注册中心、服务注册、服务调用
sc-gateway :网关示例

一、集群条件:
1.不能用localhost比如:
eureka.client.serviceUrl.defaultZone=http://peer1:8761/eureka/
要采用:
eureka.instance.hostname=peer1
eureka.client.serviceUrl.defaultZone=http://peer1:8761/eureka/,http://peer2:8762/eureka/,http://peer3:8763/eureka/
2.spring.application.name要一致
3.相互注册要开启: eureka.client.register-with-eureka=true eureka.client.fetch-registry=true

二、服务实例实现快速下线快速感知
EurekaServer的ReadWriteMap、ReadOnlyMap缓存机制,造成服务注册下线存在延迟,感知不灵敏。
1.注册中心增加配置 #启用主动失效,并且每次主动失效检测间隔为3s eureka.server.eviction-interval-timer-in-ms=3000
2.服务提供方增加配置 #服务过期时间配置,超过这个时间没有接收到心跳EurekaServer就会将这个实例剔除 #EurekaServer一定要设置eureka.server.eviction-interval-timer-in-ms否则这个配置无效,这个配置一般为服务刷新时间配置的三倍 #默认90s eureka.instance.lease-expiration-duration-in-seconds = 15 3.服务调用方(非必须) #eureka client刷新本地缓存时间.默认30s eureka.client.registryFetchIntervalSeconds=5
http://10.27.137.35:8761/ http://localhost:10000/SERVICEPROVIDER/hello?name=%22111%22&token=111

springcloudlearn's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.