Spring Cloud(2)A Eureka server端 服务注册建立
1. 父项目pom
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.RELEASE</version>
<type>pom</type>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.3.RELEASE</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
2.Eureka pom
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<version>2.1.0.RELEASE</version>
</dependency> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
3. yml 配置
server:
port: 7001 eureka:
instance:
hostname: localhost #eureka服务器的实例名称
client:
register-with-eureka: false #表示不想注册中心注册自己
fetch-registry: false #表示自己就是注册中心
service-url:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ #设置与eureka server交互的地址查询服务
客户端向服务端每30s 发送一次心跳,90s 之后客户端如果没有发送心跳,Service 会去除这个客户端
4.启动类
package com.service; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication
@EnableEurekaServer //服务器启动类,接受其他微服务注册进来
public class Dept_Eureka { public static void main(String[] args){
SpringApplication.run(Dept_Eureka.class,args);
}
}
Spring Cloud(2)A Eureka server端 服务注册建立的更多相关文章
- Spring Cloud Eureka 2 (Eureka Server搭建服务注册中心)
工具:IntelliJ IDEA 2017.1.2 x64.maven3.3.9 打开IDE file===>new===>project next next 选择相应的依赖 next ...
- spring cloud 学习(2) - eureka server注册中心高可用及安全认证
接上节继续,注册中心单点肯定是不牢靠的,可以参考下面的方案做成注册中心集群: 弄成3个节点,每个节点向其它节点注册,这样只要集群中有一个节点正常工作即可.为了方便在本机弄出这种效果,我们先修改下hos ...
- Spring Cloud系列(一):服务注册中心
一.Spring Cloud简介 Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智能路由,微代理,控制总线).分布式系统的协调导致了样 ...
- <Spring Cloud>入门一 Eureka Server
1.搭建父工程 主要是添加版本依赖,此处版本是: spring-boot : 2.0.8.RELEASE spring-cloud : Finchley.SR2 <?xml version=& ...
- Spring Cloud环境搭建: Eureka Server
项目目录结构, 总共三个文件 ├── pom.xml └── src ├── main │ ├── java │ │ └── com │ │ └── rockbb │ │ ...
- Spring Cloud Alibaba 初体验(二) Nacos 服务注册与发现 + 集成 Spring Cloud Gateway
一.服务注册 添加依赖: <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>s ...
- Spring Cloud进阶之路 | 一:服务注册与发现(nacos)
转载请注明作者及出处: 作者:银河架构师 原文链接:https://www.cnblogs.com/luas/p/12068846.html 1.版本 最新稳定版本为1.1.4,也可以从发版说明.博客 ...
- Spring Cloud Eureka Server高可用注册服务中心的配置
前言 Eureka 作为一个云端负载均衡,本身是一个基于REST的服务,在 Spring Cloud 中用于发现和注册服务. 那么当成千上万个微服务注册到Eureka Server中的时候,Eurek ...
- Spring Cloud(二):Spring Cloud Eureka Server高可用注册服务中心的配置
前言 Eureka 作为一个云端负载均衡,本身是一个基于REST的服务,在 Spring Cloud 中用于发现和注册服务. 那么当成千上万个微服务注册到Eureka Server中的时候,Eurek ...
随机推荐
- C++11--右值引用(移动语义)
/*################################################################## * 右值引用 (C++ 11) * 主要用于以下: * 1. ...
- C++进阶--隐式类型转换
//############################################################################ /* 隐式类型转换 * * 类型转换可分为 ...
- Android开发之选项菜单(optinosMenu)
android一共有三种形式的菜单: 1.选项菜单(optinosMenu) 2.上下文菜单(ContextMenu) ...
- 使用 Spring Cloud 和 Docker 构建微服务架构
如何使用Spring Boot.Spring Cloud.Docker和Netflix的一些开源工具来构建一个微服务架构. 本文通过使用Spring Boot.Spring Cloud和Docker构 ...
- linux一些基本知识
一.linux i386是32位的,amd64是64位(一般情况不限intel或者amd) server是服务器版,desktop是桌面版 Desktop是社区开源版,拥有一些新功能新软件 ...
- 中级 jQuery 了解
初级阶段的知识已经结束:中级要接触的东西:jQuery php css3 移动端: get Context("2d") 2d画布: draw Image() 绘制 ...
- 查看设备uuid的命令-blkid
查看设备uuid的命令-blkid 在关联/etc/fstab的时候可以使用 [root@mapper ~]# blkid /dev/sda1: UUID="285510be-b19 ...
- Java - 17 Java 流(Stream)、文件(File)和IO
Java 流(Stream).文件(File)和IO Java.io包几乎包含了所有操作输入.输出需要的类.所有这些流类代表了输入源和输出目标. Java.io包中的流支持很多种格式,比如:基本类型. ...
- Java 7-Java 循环结构 - for, while 及 do…while
Java 循环结构 - for, while 及 do...while 顺序结构的程序语句只能被执行一次.如果您想要同样的操作执行多次,,就需要使用循环结构. Java中有三种主要的循环结构: whi ...
- RecyclerView.Adapter封装,最简单实用的BaseRecyclerViewAdapter;只需重写一个方法,设置数据链式调用;
之前对ListView的BaseAdapter进行过封装,只需重写一个getView方法: 现在慢慢的RecyclerView成为主流,下面是RecyclerView.Adapter的封装: Base ...