将上篇随笔Spring Cloud Eureka服务Demo级搭建进行改造,改造成一个在本机的伪集群

1.修改hosts文件(windows10 hosts文件位置:C:\Windows\System32\drivers\etc),加入

127.0.0.1 peer1
127.0.0.1 peer2

2.修改eurekaserver工程中的application.yml文件为

spring:
application:
name: eurekaserver
---
server:
port: 8761
spring:
profiles: peer1
eureka:
instance:
hostname: peer1
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://peer2:8762/eureka/
---
server:
port: 8762
spring:
profiles: peer2
eureka:
instance:
hostname: peer2
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://peer1:8761/eureka/

3.打开eurekaserver的启动类

启动peer1:右键→Run As→Run Configuration...,向Arguments内加入--spring.profiles.active=peer1,Run

启动peer2:重复上述操作,将Arguments内参数改为 --spring.profiles.active=peer2,Run

3.接下来启动eurekaclient

4.分别访问 http://localhost:8761http://localhost:8761,发现8761(peer1)中有peer2节点,8762(peer2)中有peer1节点,说明Eureka集群搭建成功

Spring Cloud Eureka Server集群Demo级搭建的更多相关文章

  1. Spring Cloud Eureka的集群配置(六)

    1.再次创建2个Eureka工程 工程名:microservicecloud-eureka-7002 工程名:microservicecloud-eureka-7003 2.pom.xml文件 < ...

  2. Spring Cloud Eureka Server高可用注册服务中心的配置

    前言 Eureka 作为一个云端负载均衡,本身是一个基于REST的服务,在 Spring Cloud 中用于发现和注册服务. 那么当成千上万个微服务注册到Eureka Server中的时候,Eurek ...

  3. Spring Cloud(二):Spring Cloud Eureka Server高可用注册服务中心的配置

    前言 Eureka 作为一个云端负载均衡,本身是一个基于REST的服务,在 Spring Cloud 中用于发现和注册服务. 那么当成千上万个微服务注册到Eureka Server中的时候,Eurek ...

  4. spring boot 2.0.3+spring cloud (Finchley)1、搭建服务注册和发现组件Eureka 以及构建高可用Eureka Server集群

    一 .搭建Eureka 编写Eureka Server 由于有多个spring boot项目,采用maven多module的结构,项目结构如下: 新建一个maven主工程,在主maven的pom文件中 ...

  5. Spring Cloud之微服务注册到Eureka Server集群

    在Spring Cloud之服务注册中心搭建Eureka Server服务注册中⼼ - 池塘里洗澡的鸭子 - 博客园 (cnblogs.com)中已经搭建好了Eureka Server集群,本文就利用 ...

  6. SpringCloud升级之路2020.0.x版-20. 启动一个 Eureka Server 集群

    本系列代码地址:https://github.com/HashZhang/spring-cloud-scaffold/tree/master/spring-cloud-iiford 我们的业务集群结构 ...

  7. (2-2)SpringCloud-服务注册到Eureka Server集群并消费

    服务注册到Eureka Server集群 在(2-1)SpringCloue-Eureka实现高可用注册中心中我们搭建好了高可用的Eureka注册中心,下面我们要把服务注册到Eureka Server ...

  8. spring cloud Eureka server配置

    参考:http://www.ityouknow.com/springcloud/2017/05/10/springcloud-eureka.html spring boot版本:2.0.3.RELEA ...

  9. 配置 Eureka Server 集群

    简介 为了使 Eureka Server 实现高可用,我们需要为它配置集群.这样当有一台 Eureka Server 有故障时,集群中的其他 Server 可以进行代替.Eureka 集群之中的 No ...

随机推荐

  1. Mysql存在则更新,没有则新增

    insert ignore 当插入数据时,如出现错误时,如重复数据,将不返回错误,只以警告形式返回. insert ignore into table(col1,col2) values ('val1 ...

  2. LeetCode 381. Insert Delete GetRandom O(1) - Duplicates allowed (插入删除和获得随机数 常数时间 允许重复项)

    Design a data structure that supports all following operations in average O(1) time. Note: Duplicate ...

  3. 【机器学习】支持向量机(SVM)

    感谢中国人民大学胡鹤老师,课程深入浅出,非常好 关于SVM 可以做线性分类.非线性分类.线性回归等,相比逻辑回归.线性回归.决策树等模型(非神经网络)功效最好 传统线性分类:选出两堆数据的质心,并做中 ...

  4. 在vue2.0中使用sass

    第一步:使用sass必须安装下面三个东西 cnpm install node-sass --save //安装node-sass cnpm install sass-loader --save //安 ...

  5. 如何线上部署node.js项目

    来源:http://blog.csdn.net/chenlinIT/article/details/73343793 前言 最近工作不是很忙,在空闲时间学习用node+express搭建自己的个人博客 ...

  6. angualr高级篇之elem.scope()、elem.isolateScope和$compile(elem)(scope)中scope的区别

    在angular的使用过程中我们经常用$rootScope.$new()为elem创建一个新的作用域scope,然后使用$compile(elem)(scope)编译这个含有指令的元素.那么这里传进去 ...

  7. python抽象篇:面向对象

    1.面向对象概述 面向过程编程:根据操作数据的函数或语句块来设计程序的. 函数式编程:将某功能代码封装到函数中,日后便无需重复编写,仅调用函数即可 面向对象编程:数据和功能结合起来,用称为对象的东西包 ...

  8. Codeforces Round #378 (Div. 2)-C. Epidemic in Monstropolis

    C. Epidemic in Monstropolis time limit per test 1 second memory limit per test 256 megabytes input s ...

  9. jQuery选择器(基本过滤选择器)第三节

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...

  10. RobotFramework自动化测试框架-移动手机自动化测试Get Element Location关键字的使用

    Get Element Location关键字用来获取一个Element的Location位置,该关键字接收一个参数[ locator ] 示例1:使用Get Element Location来获取一 ...