启动类

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 配置的更多相关文章

  1. spring cloud Eureka server配置

    参考:http://www.ityouknow.com/springcloud/2017/05/10/springcloud-eureka.html spring boot版本:2.0.3.RELEA ...

  2. 1.spring cloud eureka server配置

    IDEA版本 2017.2.5 JDK 1.8 红色加粗内容为修改部分 1.创建一个新项目 2.选择eureka依赖 3.版本选择(重要)并且更新依赖 <?xml version="1 ...

  3. 【SpringCloud Eureka源码】从Eureka Client发起注册请求到Eureka Server处理的整个服务注册过程(下)

    目录 一.Spring Cloud Eureka Server自动配置及初始化 @EnableEurekaServer EurekaServerAutoConfiguration - 注册服务自动配置 ...

  4. spring cloud Eureka client配置(consumer通过Eureka发起对provider的调用)

    参考:http://www.ityouknow.com/springcloud/2017/05/12/eureka-provider-constomer.html springboot版本:2.0.3 ...

  5. Spring Cloud Eureka Server高可用注册服务中心的配置

    前言 Eureka 作为一个云端负载均衡,本身是一个基于REST的服务,在 Spring Cloud 中用于发现和注册服务. 那么当成千上万个微服务注册到Eureka Server中的时候,Eurek ...

  6. springboot中关闭eureka server中已注册服务列表自我保护配置

    配置集群服务可以向eureka通知应用是否可以使用a.在eureka server的application.properties中加入:# 设为false,关闭自我保护eureka.server.en ...

  7. Spring Cloud(二):Spring Cloud Eureka Server高可用注册服务中心的配置

    前言 Eureka 作为一个云端负载均衡,本身是一个基于REST的服务,在 Spring Cloud 中用于发现和注册服务. 那么当成千上万个微服务注册到Eureka Server中的时候,Eurek ...

  8. Eureka参数配置->Server端参数

    1.基本参数 参数 默认值 说明 eureka.server.enable-self-preservation true 是否开启自我保护模式 eureka.server.renewal-percen ...

  9. 配置 Eureka Server 集群

    简介 为了使 Eureka Server 实现高可用,我们需要为它配置集群.这样当有一台 Eureka Server 有故障时,集群中的其他 Server 可以进行代替.Eureka 集群之中的 No ...

随机推荐

  1. Codeforces Round #641 (Div. 2)

    只写了A~D A - Orac and Factors 题意:f(n)就是n的第二小因数,问执行k次 n=f(n)+n 后的结果. 题解:如果一直找第二小的因子的话,1e9肯定得t.看下边样例解释就会 ...

  2. Educational Codeforces Round 88 (Rated for Div. 2) B、New Theatre Square C、Mixing Water

    题目链接:B.New Theatre Square 题意: 你要把所有"." 都变成"*",你可以有两个选择,第一种就是一次铺一个方块(1*1),第二种就是同一 ...

  3. spark 一、编程指南

    总览 第一.每个spark 应用都有一个驱动程序去运行着主函数和再每个节点上的并行操作. spark提供了一个RDD(弹性分布式数据集)的数据集合,可以通过不同的节点并行操作运算,可以通过hdfs文件 ...

  4. pip&conda 换源

    PIP 各种可用源 清华源:https://pypi.tuna.tsinghua.edu.cn/simple 临时指定源 pip install -i https://pypi.tuna.tsingh ...

  5. NLP论文阅读一:Paper阅读方法

    参考:https://pan.baidu.com/s/1MfcmXKopna3aLZHkD3iL3w 一.为什么要读论文? 基础技术:读论文中的related works可以帮助了解该领域的一些主要的 ...

  6. SpringBoot整合Swagger初探

    当下的Web项目大都采用前后端分离+分布式微服务的架构.前后端分离式的开发中,前端开发人员要与后端开发人员协商通信接口,约定接口规范.因此对于开发人员来说能够维持一份及时更新且完整全面的API文档会大 ...

  7. 牛客网多校第5场 I vcd 【树状数组+离散化处理】【非原创】

    题目:戳这里 学习博客:戳这里 作者:阿狸是狐狸啦 n个点,一个点集S是好的,当且仅当对于他的每个子集T,存在一个右边无限延长的矩形,使的这个矩形包含了T,但是和S-T没有交集. 求有多少个这种集合. ...

  8. DB-Engines Ranking : Redis, MongoDB, MySQL

    DB-Engines Ranking http://db-engines.com/en/ranking The DB-Engines Ranking ranks database management ...

  9. webpack 5 模块联合

    webpack 5 模块联合 webpack 5 https://webpack.docschina.org/concepts/module-federation/ https://github.co ...

  10. npm & config settings

    npm & config settings how to check npm config settings https://docs.npmjs.com/cli/config $ npm c ...