组件名:Netflix Eureka 

作用:支撑微服务的自注册、自发现,提供负载均衡能力

开发环境使用IDEA

1.新建Eureka Server,新建maven项目,配置pom.xml
  1. <parent>
  2. <groupId>org.springframework.cloud</groupId>
  3. <artifactId>spring-cloud-starter-parent</artifactId>
  4. <version>Camden.SR5</version>
  5. </parent>
  6. <dependencies>
  7. <dependency>
  8. <groupId>org.springframework.cloud</groupId>
  9. <artifactId>spring-cloud-starter</artifactId>
  10. </dependency>
  11. <dependency>
  12. <groupId>org.springframework.cloud</groupId>
  13. <artifactId>spring-cloud-starter-eureka-server</artifactId>
  14. </dependency>
  15. </dependencies>

2.新建包及启动类
  1. @SpringBootApplication
  2. @EnableEurekaServer
  3. public class Application {
  4. public static void main(String[] args){
  5. SpringApplication.run(Application.class,args);
  6. }
  7. }

 3.新建配置文件application.yml
  1. server:
  2. port: 1000
  3. eureka:
  4. instance:
  5. hostname: localhost
  6. client:
  7. register-with-eureka: false
  8. fetch-registry: false
  9. spring:
  10. application:
  11. name: eureka-server
这里主要注意我们的服务注册端口是1000

4.运行程序,打开浏览器127.0.0.1:1000
 
erueka服务器启动成功,目前还未有服务注册

代码:https://github.com/tilv37/eureka-server

Spring Cloud探路(一) Erueka服务器的建立的更多相关文章

  1. Spring Cloud Gateway注册到服务器中心(Consul)

    Spring Cloud Gateway注册到服务器中心(Consul) 准备环境 启动Consul(./consul agent -dev)作为服务中心,默认是8500端口,然后启动spring-c ...

  2. Spring Cloud探路(三)REST 客户端Feign

    Declarative REST Client: Feign Feign is a declarative web service client. It makes writing web servi ...

  3. Spring Cloud探路(二) Erueka客户端的建立

    接上篇 1.pom.xml与上篇一致 2.新建包及Application启动类 @Configuration @ComponentScan @EnableEurekaClient @EnableAut ...

  4. 朱晔和你聊Spring系列S1E8:凑活着用的Spring Cloud(含一个实际业务贯穿所有组件的完整例子)

    本文会以一个简单而完整的业务来阐述Spring Cloud Finchley.RELEASE版本常用组件的使用.如下图所示,本文会覆盖的组件有: Spring Cloud Netflix Zuul网关 ...

  5. Dapr 能否取代 Spring Cloud?

    很多人都是使用SpringBoot 和 Spring Cloud来开发微服务.Dapr 也是开发微服务的框架,它和Spring Cloud有什么区别呢,其实这不是一个区别的问题,它是不同的时代需要不同 ...

  6. 微服务架构-选择Spring Cloud,放弃Dubbo

    Spring Cloud 在国内中小型公司能用起来吗?从 2016 年初一直到现在,我们在这条路上已经走了一年多. 在使用 Spring Cloud 之前,我们对微服务实践是没有太多的体会和经验的.从 ...

  7. 放弃Dubbo,选择最流行的Spring Cloud微服务架构实践与经验总结

    http://developer.51cto.com/art/201710/554633.htm Spring Cloud 在国内中小型公司能用起来吗?从 2016 年初一直到现在,我们在这条路上已经 ...

  8. spring cloud 配置纲要Properties

    名称 默认 描述 encrypt.fail-on-error true 标记说,如果存在加密或解密错误,进程将失败. encrypt.key   对称密钥.作为一个更强大的替代方案,考虑使用密钥库. ...

  9. 聊聊Spring Cloud Config

    Spring Cloud Config 转自:https://blog.csdn.net/fjnpysh/article/details/71307311 现今这个时候,微服务大行其道,互联网应用遍地 ...

随机推荐

  1. 配置了两天python【python可以的】

    首先是看cs231n 发现代码的版本是py2 而我只装了 py3(anaconda3) 怎么办呢 于是想办法装了 anaconda2 并与之共存 ,调用的时候用 activate py2调用 http ...

  2. 去掉goland中间的令人烦躁的竖线

    去掉“configured in code Style options”前面的勾即可.

  3. golang之下载安装配置

    1.下载:根据操作系统和计算架构选择合适的安装包,操作系统类型有linux.mac.windows等,计算架构分为32位的386计算架构和64位的amd64计算架构 2.安装:推荐安装到 /usr/l ...

  4. svn upgrade

    在我们把我们服务器上的svn 版本号升级以后,我们之前的代码再执行svn命令时,会提示需要执行svn upgrade命令把当前的代码由低版本的svn 上迁移到高版本的svn 上去. 直接执行svn u ...

  5. gitlab 添加本地项目

    1.安装git    https://git-scm.com/downloads 2.新建工程 3.创建密钥 a.桌面右键 b.cd ~/.ssh/ 如果提示 “ No such file or di ...

  6. Windows中查看PowerShell版本和virbox版本,vagrant 版本

    我并不是很熟悉什么是PowerShell,但是有种直觉是:如果想在Windows中使用系统自带的功能取代bash shell,PowerShell或许是比DOS批处理更好的选择.不过,从头开始再来一门 ...

  7. 【Mysql的那些事】数据库之ORM操作

    1:ORM的基础操作(必会) <1> all(): 查询所有结果 <2> filter(**kwargs): 它包含了与所给筛选条件相匹配的对象 <3> get(* ...

  8. rm: cannot remove `libtoolT’: No such file or directory

    安装源码包第一步./configure检测是否可编译时,检测出问题rm: cannot remove `libtoolT’: No such file or directory 解决方案:将confi ...

  9. ADO.NET sqlHelper类(DBHelper类)

    1.配置文件 <connectionStrings> <add name="constr" connectionString="Data Source= ...

  10. 前端web设置div宽高一样

    <div class="constant-width-to-height-ratio"></div> .constant-width-to-height-r ...