POM:

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent> <dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Camden.SR6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
</dependencies>

application.properties

spring.application.name=eureka-server

server.port=10001

#强制不注册到注册服务器
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false #注册中心地址
eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/ #驱逐下线的服务,间隔,5秒,默认是60,建议开发和测试环境配置
#org.springframework.cloud.netflix.eureka.server.EurekaServerConfigBean.evictionIntervalTimerInMs
eureka.server.evictionIntervalTimerInMs=5000

启动类:

package com.yzl.cloud.eureka;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication
@EnableEurekaServer
public class EurekaApplication { public static void main(String[] args) {
new SpringApplicationBuilder(EurekaApplication.class).web(true).run(args); //或者pom引spring-boot-starter-web,然后用下面这个启动
//SpringApplication.run(EurekaApplication.class, args);
} }

启动服务:spring-boot:run或者直接运行启动类

访问:http://localhost:10001/  能看到控制台

SpringCloud之注册中心Eureka搭建的更多相关文章

  1. 十五、springcloud(一)注册中心Eureka

    1.Eureka的基本架构 a.Eureka Server 提供服务注册和发现 b.Service Provider 服务提供方 将自身服务注册到Eureka,从而使服务消费方能够找到 c.Servi ...

  2. SpringCloud(四):服务注册中心Eureka Eureka高可用集群搭建 Eureka自我保护机制

    第四章:服务注册中心 Eureka 4-1. Eureka 注册中心高可用集群概述在微服务架构的这种分布式系统中,我们要充分考虑各个微服务组件的高可用性 问题,不能有单点故障,由于注册中心 eurek ...

  3. springcloud(二):注册中心Eureka

    Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是springcloud体系中最重要最核心的组 ...

  4. SpringCloud注册中心(Eureka)

    注册中心的作用就是用来方便接口暴露出来的一个管理工具,如果所有的接口只是暴露出来,没有一个同一的管理工具,又有谁知道你暴露了哪些接口了,Eureka是一个springcloud的服务注册和发现模块 搭 ...

  5. springcloud注册中心eureka

    1.前提 springcloud的注册中心是以springboot为基础搭建起来的. 开发工具:IDEA 项目管理工具:maven 2.搭建步骤 创建一个web项目(建议使用IDEA工具构建项目) 修 ...

  6. springcloud入门系列(二):注册中心Eureka

    搭建注册中心Eureka 1.pom中依赖 <dependencies> <dependency> <groupId>org.springframework.clo ...

  7. spring cloud 服务注册中心eureka高可用集群搭建

    spring cloud 服务注册中心eureka高可用集群搭建 一,准备工作 eureka可以类比zookeeper,本文用三台机器搭建集群,也就是说要启动三个eureka注册中心 1 本文三台eu ...

  8. 跟我学SpringCloud | 第二篇:注册中心Eureka

    Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是springcloud体系中最重要最核心的组 ...

  9. 二、springcloud Netflix 注册中心

    Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是springcloud体系中最重要最核心的组 ...

随机推荐

  1. 第四十九天 mysql 索引 元类

    一 昨日回顾 视图 触发器 事务 什么是事务 逻辑上的一组操作 要么都成功 要么都失败 如何使用 start transaction 开启事务 mysql 默认一条sql就是一个事务 pymysql默 ...

  2. 洛谷p1091合唱队形题解

    题目 合唱队形首先要满足的是从1这个位置到中间任意的位置为单增的,从中间任意的位置到最后是单减的,且长度最长.这样才能满足出列的同学最少. 如果要满足这个条件那么我们可以先预处理出每个点的从前找的最长 ...

  3. requests简单应用

    requests发送get请求 无参数的get请求: response = requests.get(url='http://ws.webxml.com.cn/WebServices/WeatherW ...

  4. 初次尝试使用jenkins+python+appium构建自动化测试

    初次尝试使用jenkins+python+appium构建自动化测试 因为刚刚尝试使用jenkins+python+appium尝试,只是一个Demo需要很多完善,先记录一下今天的成果,再接再厉 第一 ...

  5. Shell基础 - Bash基础功能

    历史命令 history选项: -c 清空历史命令 -w 立即保存历史命令Linux 下输入过的历史命令,都会保存在根目录下的:~/root/.bash_history 文件中默认保存 1000 条, ...

  6. CF868F Yet Another Minimization Problem 分治决策单调性优化DP

    题意: 给定一个序列,你要将其分为k段,总的代价为每段的权值之和,求最小代价. 定义一段序列的权值为$\sum_{i = 1}^{n}{\binom{cnt_{i}}{2}}$,其中$cnt_{i}$ ...

  7. BZOJ3779重组病毒LCT

    题目描述 黑客们通过对已有的病毒反编译,将许多不同的病毒重组,并重新编译出了新型的重组病毒.这种病毒的繁殖和变异能力极强.为了阻止这种病毒传播,某安全机构策划了一次实验,来研究这种病毒.实验在一个封闭 ...

  8. ComM(通信管理)和CanNm(network)

    1      网络管理组成部分 网络管理部分由通信管理器(简称ComM),通用网络管理器接口(简称NmIf),总线相关的网络管理器(简称NM,包括CanNM,LinNM,FrNM),总线相关的状态管理 ...

  9. mysql 远程连接 10038

    1,先确认本地是否能连上本地能连上就对用户进行授权 mysql>grant all privileges on *.* to 'root'@'%' identified by 'youpassw ...

  10. 关于json_encode转数组为json对象时里有数组格式数据的问题

    前言:这次是给一款小程序提供接口时发现的 别的不多说,下面直接看出现问题的json数据 可以看到,这是一个大的json对象,是由多维数组组成,一般api接口提供的也是这种格式. 但是仔细看红框中的内容 ...