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 ...
随机推荐
- STL进阶--vector vs deque
vector class Dog; // 例 1: vector<Dog> vec(6); // vec.capacity() == 6, vec.size() == 6, // 默认构造 ...
- Lucene 特殊字符的问题
SolrQuerySyntax http://wiki.apache.org/solr/SolrQuerySyntax solr的处理方式: https://svn.apache.org/repos/ ...
- MIME Types - Complete List
Suffixes applicable Media type and subtype(s) .3dm x-world/x-3dmf .3dmf x-world/x-3dmf .a applicatio ...
- asp.net 项目目录说明
Bin 目录用来存放编译的结果,bin是二进制binrary的英文缩写,因为最初C编译的程序文件都是二进制文件,它有Debug和Release两个版本, 分别对应的文件夹为bin/Debug和bin/ ...
- PAT 乙级 1019 数字黑洞 (20) C++版
1019. 数字黑洞 (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 给定任一个各位数字不完全相同的4位 ...
- java 字节码 指令集 汇编(转)
https://blog.csdn.net/github_35983163/article/details/52945845 网上找的没有指令码这列 自己把它加上 更方便查阅 指令从0x00-0xc ...
- SCCM2012 R2实战系列之五:发现方法
打开SCCM2012的控制台 点击左侧栏的“管理”选项,然后展开“层次结构配置”,点击“发现方法”来配置客户端发现. 勾选“启用Active Directory林发现”.“发现Active Direc ...
- 删除win7任务栏通知区域图标的方法
大家都知道程序运行后会在任务栏的通知区域显示表明正在运行,但是有很多失效的图标也会在此显示,那么怎么样删除那些没用的图标呢? 1.在开始运行里输入:regedit进入注册表编辑器 2.进入注册表编辑器 ...
- Ribbon Workbench The plug-in execution failed because the Sandbox Client encountered an error during initialization
使用 Ribbon Workbench打开解决方案时,出现The plug-in execution failed because the Sandbox Client encountered an ...
- CLion使用OpenCV(Ubuntu 18.04)
项目结构: 设置CMainLists.txt文件中的内容: cmake_minimum_required(VERSION 3.13) project(cv_test) ) find_package(O ...