eureka server 配置
启动类
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaApplication.class);
}
}
application.yml 配置
server:
port: 8761
spring:
application:
name: eureka_server #集群搭建时建议名称一样
#eureka 一共有四部分配置
#dashboard eureka的web控制台
#service eureka服务端配置
#client eureka客户端配置
#instsance
eureka:
instance:
hostname: localhost #主机名
client:
service-url:
# eureka 服务地址,如果是集群的话;需要指定其它集群eureka地址
default-zone: http://${eureka.instance.hostname}:${server.port}/erueka
# 是否将自己的路径注册到eureka false不注册自己
register-with-eureka: false
#不拉取服务
fetch-registry: false
server:
enable-self-preservation: false
eviction-interval-timer-in-ms: 3000
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>spring_cloud_parent</artifactId>
<groupId>com.yuyy</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eureka_server</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
</dependencies>
</project>
eureka client/微服务 application.yml 配置
server:
port: 8003
spring:
application:
name: eureka-provider
eureka:
instance:
hostname: localhost
# prefer-ip-address: true #将当前的实例IP注册到 eureka service中,默认是false 注册主机名
# ip-address: 127.0.0.1 #设置当前实例 的IP
# instance-id: ${eureka.instance.ip-address}:${spring.application.name}:${server.port} #设置web显示的实例id
lease-renewal-interval-in-seconds: 3 #每个3秒发送一次心跳包
lease-expiration-duration-in-seconds: 9 #如果9秒没有发送,服务器就把服务干掉
client:
service-url:
# default-zone: http://eureka_server1:8761/eureka,http://eureka_server2:8762/eureka
default-zone: http://localhost:8761/eureka
eureka server 配置的更多相关文章
- spring cloud Eureka server配置
参考:http://www.ityouknow.com/springcloud/2017/05/10/springcloud-eureka.html spring boot版本:2.0.3.RELEA ...
- 1.spring cloud eureka server配置
IDEA版本 2017.2.5 JDK 1.8 红色加粗内容为修改部分 1.创建一个新项目 2.选择eureka依赖 3.版本选择(重要)并且更新依赖 <?xml version="1 ...
- 【SpringCloud Eureka源码】从Eureka Client发起注册请求到Eureka Server处理的整个服务注册过程(下)
目录 一.Spring Cloud Eureka Server自动配置及初始化 @EnableEurekaServer EurekaServerAutoConfiguration - 注册服务自动配置 ...
- spring cloud Eureka client配置(consumer通过Eureka发起对provider的调用)
参考:http://www.ityouknow.com/springcloud/2017/05/12/eureka-provider-constomer.html springboot版本:2.0.3 ...
- Spring Cloud Eureka Server高可用注册服务中心的配置
前言 Eureka 作为一个云端负载均衡,本身是一个基于REST的服务,在 Spring Cloud 中用于发现和注册服务. 那么当成千上万个微服务注册到Eureka Server中的时候,Eurek ...
- springboot中关闭eureka server中已注册服务列表自我保护配置
配置集群服务可以向eureka通知应用是否可以使用a.在eureka server的application.properties中加入:# 设为false,关闭自我保护eureka.server.en ...
- Spring Cloud(二):Spring Cloud Eureka Server高可用注册服务中心的配置
前言 Eureka 作为一个云端负载均衡,本身是一个基于REST的服务,在 Spring Cloud 中用于发现和注册服务. 那么当成千上万个微服务注册到Eureka Server中的时候,Eurek ...
- Eureka参数配置->Server端参数
1.基本参数 参数 默认值 说明 eureka.server.enable-self-preservation true 是否开启自我保护模式 eureka.server.renewal-percen ...
- 配置 Eureka Server 集群
简介 为了使 Eureka Server 实现高可用,我们需要为它配置集群.这样当有一台 Eureka Server 有故障时,集群中的其他 Server 可以进行代替.Eureka 集群之中的 No ...
随机推荐
- 2019牛客暑期多校训练营(第一场)I Points Division(dp+线段树优化)
给你n个点,第i个点在的位置为(xi,yi),有两个属性值(ai,bi).现在让你把这n个点划分为A和B两个部分,使得最后不存在i∈A和j∈B,使得xi>=xj且yi<=yj.然后对于所有 ...
- HDU 1754线段树
第一个自己动手写的线段树,1Y还是有点小激动哈(虽然是模版题) 1 #include<cstdio> 2 #include<cstring> 3 #include<alg ...
- zoj3593One Person Game (扩展欧几里德)
There is an interesting and simple one person game. Suppose there is a number axis under your feet. ...
- Educational Codeforces Round 88 (Rated for Div. 2) E、Modular Stability 逆元+思维
题目链接:E.Modular Stability 题意: 给你一个n数,一个k,在1,2,3...n里挑选k个数,使得对于任意非负整数x,对于这k个数的任何排列顺序,然后用x对这个排列一次取模,如果最 ...
- HDU-3081-Marriage Match II 二分图匹配+并查集 OR 二分+最大流
二分+最大流: 1 //题目大意:有编号为1~n的女生和1~n的男生配对 2 // 3 //首先输入m组,a,b表示编号为a的女生没有和编号为b的男生吵过架 4 // 5 //然后输入f组,c,d表示 ...
- 正则指引 pdf 高清版
链接:https://pan.baidu.com/s/1Xeuma4toE_L-MxROvTGBxw 提取码:nqyj
- 一个操作系统的实现sudo mount -o loop pm.img /mnt/floppy mount point /mnt/floppy does not exist losetup device is busy
部分参考:https://blog.csdn.net/u012323667/article/details/79266623 一. sudo mount -o loop pm.img /mnt/flo ...
- Automatic merge failed; fix conflicts and then commit the result.解决方法
产生原因: git pull 的时候会分为两步,第一步先从远程服务器上拉下代码,第二步进行merge.当你merge时候失败了就会产生Automatic merge failed; fix confl ...
- Polya定理应用实例
关于Polya原理的应用经典实例: 问题:用两种颜色去染排成一个圈的6个棋子,如果通过旋转得到只算作一种.问有多少种染色状态. 解:先将棋子表上号: 1 6 2 5 3 4 那么把所有通过旋转 ...
- docker-swarm----多机容器管理
Docker Swarm: 准备三台机器,都装上 Docker docker swarm是docker官方提供的一套容器编排系统.它的架构如下: swarm是一系列节点的集合,而节点可以是一台裸机或者 ...