eureka学习(一)
eureka是一个注册中心,与zookeeper不同的是,eureka是restful格式的调用,zk是rpc,还有就是zk保证一致和容错,eureka则是可用和容错.
使用时首先要加入依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
yml文件里
server:
port: 7001
eureka:
instance:
hostname: localhost #eureka服务端的实例名称
client:
register-with-eureka: false #falsege表示不向注册 中心注册自己
fetch-registry: false #不需要去检索服务
service-url:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ #设置与eureka server交互的地址查询服务和注册 服务的地址
主启动类里面
@SpringBootApplication
@EnableEurekaServer //标注为eureka服务端
public class EurekaServerApp {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApp.class,args);
}
}
接着可以启动,启动好后在浏览器里输入http://locahost:7001就看到eureka的页面了。
注意:
有时候会报错,可能是引入包冲突了,官网给了如下建议:
Finchley builds and works with Spring Boot 2.0.x, and is not expected to work with Spring Boot 1.5.x.
Note: The Dalston release train will reach end-of-life in December 2018. Edgware will follow the end-of-life cycle of Spring Boot 1.5.x.
The Dalston and Edgware release trains build on Spring Boot 1.5.x, and are not expected to work with Spring Boot 2.0.x.
NOTE: The Camden release train was marked end-of-life.
The Camden release train builds on Spring Boot 1.4.x, but is also tested with 1.5.x.
NOTE: The Brixton and Angel release trains were marked end-of-life (EOL) in July 2017.
The Brixton release train builds on Spring Boot 1.3.x, but is also tested with 1.4.x.
The Angel release train builds on Spring Boot 1.2.x, and is incompatible in some areas with Spring Boot 1.3.x. Brixton builds on Spring Boot 1.3.x and is similarly incompatible with 1.2.x. Some libraries and most apps built on Angel will run fine on Brixton, but changes will be required anywhere that the OAuth2 features from spring-cloud-security 1.0.x are used (they were mostly moved to Spring Boot in 1.3.0).
eureka学习(一)的更多相关文章
- Eureka学习例子
Eureka学习 Spring Cloud下有很多工程: Spring Cloud Config:依靠git仓库实现的中心化配置管理.配置资源可以映射到Spring的不同开发环境中,但是也可以使用在非 ...
- springcloud Eureka学习笔记
最近在学习springcloud,抽空记录下学习笔记;主要记录Eureka的实现过程和高可用性的实现 Eureka是一个服务治理框架,它提供了Eureka Server和Eureka Client两个 ...
- Spring-cloud微服务 Eureka学习教程-分布式搭建EurekaServer、EurekaClient+Ribbon(中级)
我们这里只有一台服务器,所以我们先仿集群搭建. 完整demo项目代码:https://github.com/wades2/EurekaDemo2 在这之前我们先分析分析Eureka相比其他注册中心的好 ...
- Spring-cloud微服务 Eureka学习教程-分布式搭建EurekaServer、EurekaClient(中级)
我们这里只有一台服务器,所以我们先仿集群搭建. 完整demo项目代码:https://github.com/wades2/EurekaDemo2 在这之前我们先分析分析Eureka相比其他注册中心的好 ...
- eureka 学习
Eureka is a REST (Representational State Transfer) based service that is primarily used in the AWS c ...
- Spring Cloud Eureka 学习记录
SpringCloud版本 <groupId>org.springframework.cloud</groupId> <artifactId>spring-clou ...
- Spring-cloud微服务 Eureka学习教程-单服务器配置之快速搭建EurekaServer、EurekaClient(基础)
以下实例代码下载地址:https://github.com/wades2/EurekaDemo Eureka是Spring Cloud Netflix的一个子模块,也是核心模块之一.用于云端服务发现, ...
- eureka学习(二)
eureka服务端创建好后,现在我们让eureka客户端(也就是服务提供者)注册到eureka上去. 首先加入依赖包: <!--将微服务provider注册到eureka--> <d ...
- eureka学习之二:自我保护机制
提供者和消费者:消费者通过注册服务名称,找rpc远程地址,调用提供者的接口 Eureka的自我保护机制:
随机推荐
- flutter Container组件和Text组件
在开始之前,我们先写一个最简单的入口文件: 后面,都是在这个结构的基础上面完成的. 由于Container组件和Text组件都是写在body里面的,所以下面,先将body抽离成一个组件的形式. ...
- JavaScript实现Word、Excel、PPT在线预览
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/qq_27626333/article/d ...
- mysql捕捉所有SQL语句
MySQL可以通过开通general_log参数(可动态修改)来扑捉所有在数据库执行的SQL语句.显示参数:mysql> show variables like 'general%log%';+ ...
- (一)arm交叉编译工具链准备
1.背景 arm机器一般因为资源问题进行编译会影响开发速度,而且很多时候因为资源不够而无法完成编译工作.因此,需要在执行机上进行交叉编译,即使用x86或其他架构机器基于交叉编译工具编译出在arm上可以 ...
- jmeter中如何使用csv文件并读取数据
我现在要测试一个新的网站,需要负载测试这个功能“加入购物车”.要做到 这一点,我需要模拟多个用户登录并进行购物操作,具体的场景为每一个人将同样的物品加入到购物车. JMeter 处理这些请求完全没有问 ...
- OSG+Visual Studio2015项目变量设置;
OSG源码经过CMAKE编译后: 1.配置OSG环境变量: 用户变量的PATH中添加路径 C:\OSG\bin系统变量中添加新变量OSG_FILE_PATH为 C:\OSG\data 2.VS新建项目 ...
- k8s之ingress-nginx部署一直提示健康检查10254端口不通过问题就处理
之前部署了一套k8s集群,但是到部署ingress-nginx的时候,一直提示10254端口拒绝不通:如下图. 这是因为我之前装的是docker1.17.默认的驱动是systemd.因为systemd ...
- 在docker中使用composer install
服务器上docker中没有装composer,只有项目中有composer.phar文件,但是又需要composer来管理依赖,我才接触docker 和 php的composer,希望把解决这个问题的 ...
- keepalive+nginx
1Nginx+keepAlived负载均衡高可用1.1Nginx+keepAlive架构图 1.1.1主机宕机 1.1.2主机恢复 1.1.3高可用环境 两台nginx,一主一备:192.168.10 ...
- C语言中的关键字初识
C89标准定义的32个关键字 关键字 含义 void 声明函数无返回值或者无参数,声明空类型指针 char 声明字符型变量 short 声明短整型变量 int 声明整型变量 long 声明长整型变量 ...