SpringCloud学习系列-Eureka服务注册与发现(2)
构建 microservicecloud-eureka-7001 eureka服务注册中心Module
1.新建microservicecloud-eureka-7001

2.pom
<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">
<modelVersion>4.0.0</modelVersion> <parent>
<groupId>com.atguigu.springcloud</groupId>
<artifactId>microservicecloud</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent> <artifactId>microservicecloud-eureka-7001</artifactId> <dependencies>
<!--eureka-server服务端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
<!-- 修改后立即生效,热部署 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
</dependencies> </project>
3.yml
server:
port: 7001 eureka:
instance:
hostname: localhost #eureka服务端的实例名称
client:
register-with-eureka: false #false表示不向注册中心注册自己。
fetch-registry: false #false表示自己端就是注册中心,我的职责就是维护服务实例,并不需要去检索服务
service-url:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ #设置与Eureka Server交互的地址查询服务和注册服务都需要依赖这个地址。
4.EurekaServer7001_App主启动类
package com.atguigu.springcloud; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication
@EnableEurekaServer//EurekaServer服务器端启动类,接受其它微服务注册进来
public class EurekaServer7001_App
{
public static void main(String[] args)
{
SpringApplication.run(EurekaServer7001_App.class, args);
}
}
5.测试
先要启动EurekaServer
http://localhost:7001/

SpringCloud学习系列-Eureka服务注册与发现(2)的更多相关文章
- SpringCloud学习系列-Eureka服务注册与发现(1)
1.Eureka的基本架构 Spring Cloud 封装了 Netflix 公司开发的 Eureka 模块来实现服务注册和发现(请对比Zookeeper). Eureka 采用了 C-S 的设计架构 ...
- SpringCloud学习系列-Eureka服务注册与发现(3)
修改microservicecloud-provider-dept-8001 1.修改pom 增加内容 <!-- 将微服务provider侧注册进eureka --> <depend ...
- SpringCloud学习系列-Eureka服务注册与发现(4)
actuator与注册微服务信息完善 1.主机名称:服务名称修改 当前问题 含有主机名称 修改修改microservicecloud-provider-dept-8001 的yml文件 修改内容 eu ...
- SpringCloud 进阶之Eureka(服务注册和发现)
1. Eureka 服务注册与发现 Eureka 是一个基于REST的服务,用于服务的的注册与发现; Eureka采用C-S的设计架构,Eureka Server作为服务注册功能的服务器,它是服务注册 ...
- SpringCloud系列——Eureka 服务注册与发现
前言 Eureka是一种基于REST(具像状态传输)的服务,主要用于AWS云中定位服务,以实现中间层服务器的负载平衡和故障转移.本文记录一个简单的服务注册与发现实例. GitHub地址:https:/ ...
- SpringCloud学习笔记:服务注册与发现Eureka(2)
1. Eureka简介 Eureka是一个用于服务注册和发现的组件,分为Eureka Server和Eureka Client,Eureka Server为Eureka服务注册中心,Eureka Cl ...
- SpringCloud学习(3)——Eureka服务注册中心及服务发现
Eureka概述: Eureka是Netflix的一个子模块, 也是核心模块之一.Eureka是一个基于REST的服务, 用于定位服务, 以实现云端中间层服务发现和故障转移.服务注册与发现对于微服务框 ...
- F版本SpringCloud 3—大白话Eureka服务注册与发现
引用:服务注册与发现,就像是租房子一样 前言 今天洛阳下雨了,唉,没有想到有裹上了羽绒服,不穿冷穿了热的尴尬温度.上学工作这么多年都在外面,家里竟然没有一件春天的外套. 日常闲聊之后,开始今天的芝士环 ...
- springcloud(二):Eureka服务注册与发现
Spring Cloud Netflix 该项目是Spring Cloud的子项目之一,主要内容是对Netflix公司一系列开源产品的包装,它为Spring Boot应用提供了自配置的Netflix ...
随机推荐
- linux scp放后台执行方法
客户要搭建异地的容灾dg,压缩备份集500G,只能使用scp,前台跑经常超时,使scp放后台跑完成相关的文件传输: FULLBAK_LFCXJMYB_20190507_6448_1.DBFILE 10 ...
- Python Basics with Numpy
Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if yo ...
- python小游戏2
import hashlib 过段时间会来解释下hashlib的源码(能力有限请大家谅解)#根据md5模块来加密密码 def pwd_md5(pwd): ''' 加密用户输入过来的密码 :param ...
- mavn Nexus Repository Manager漏洞
https://www.secpulse.com/archives/112290.html
- poj1284(欧拉函数+原根)
题目链接:https://vjudge.net/problem/POJ-1284 题意:给定奇素数p,求x的个数,x为满足{(xi mod p)|1<=i<=p-1}={1,2,...,p ...
- Hbase的几个关键问题(转自log.csdn.net/javastart/article/details/43772575)
什么是HBase?何时用HBase?与Hive.Pig的区别?HBase的结构为何HBase速度很快?HBase常用的操作有哪些?HBase的一些配置和监控 什么是HBase? HBase,是Hado ...
- 手撕ES6--Promise
手撕ES6--Promise:https://www.jianshu.com/p/0925eae38d2c 手写一个Promise,附源码分析:https://blog.csdn.net/weixin ...
- HDU 1159 Common Subsequence 最长公共子序列
HDU 1159 Common Subsequence 最长公共子序列 题意 给你两个字符串,求出这两个字符串的最长公共子序列,这里的子序列不一定是连续的,只要满足前后关系就可以. 解题思路 这个当然 ...
- Python 把较长的一行代码分成多行的技巧
概述:在写代码过程中,经常遇到一行代码很长的情况.为了让代码显得整齐干净,就需要把一行代码分成多行来写,Python中有三种小技巧可以实现该功能: 1.用反斜杠\链接多行代码 示例: ...
- 初相识|performance_schema全方位介绍
初相识|performance_schema全方位介绍 |导 语 很久之前,当我还在尝试着系统地学习performance_schema的时候,通过在网上各种搜索资料进行学习,但很遗憾,学习的效果并不 ...