4、SpringCloud微服务核心组件Eureka介绍和闭源后影响
简介:
SpringCloud体系介绍
官方地址:http://projects.spring.io/spring-cloud/
Eureka的基础知识-->画图讲解交互流程,服务提供者<-->服务消费者 ;
Eureka 2.x闭源后选择
参考:https://www.jianshu.com/p/d32ae141f680
https://blog.csdn.net/zjcjava/article/details/78608892
5、服务注册和发现Eureka Server搭建实战
简介:使用IDEA搭建Eureka服务中心Server端并启动,项目基本骨架介绍
官方文档:http://cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html#spring-cloud-eureka-server
第一步:创建项目
第二步: 添加注解 @EnableEurekaServer
第三步:增加配置application.yml
server:
port: 8761
eureka:
instance:
hostname: localhost
client:
#声明自己是个服务端
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
第四步:访问注册中心页面
maven地址: https://www.cnblogs.com/sword-successful/p/6408281.html
6、服务注册和发现之Eureka Client搭建商品服务实战
简介:搭建用商品服务,并将服务注册到注册中心
1、创建一个SpirngBoot应用,增加服务注册和发现依赖
2、模拟商品信息,存储在内存中
3、开发商品列表接口,商品详情接口
4、配置文件加入注册中心地址
使用eureka客户端 官方文档:http://cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html#netflix-eureka-client-starter
7、Eureka服务注册中心配置控制台问题处理
简介:讲解服务注册中心管理后台,(后续还会细讲)
问题:eureka管理后台出现一串红色字体:是警告,说明有服务上线率低
EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE.
关闭检查方法:eureka服务端配置文件加入
server:
enable-self-preservation: false
注意:自我保护模式禁止关闭,默认是开启状态true
问题二:为什么只加一个注册中心地址,就可以注册
By having spring-cloud-starter-netflix-eureka-client on the classpath, your application automatically registers with the Eureka Server. Configuration is required to locate the Eureka server, as shown in the following example:
IDEA 开启多个springboot服务方法:
![]()
项目代码:
https://gitee.com/jiawenzhang/eureka_server
https://gitee.com/jiawenzhang/product_server