eureka编译 linux,Spring Cloud Eureka集群部署到Linux环境

还是三板斧:先改配置文件,支持集群,然后出包,上传到linux环境(3个节点),最后启动jar包跑起来。

1、在原eureka服务端代码(参见Greenwich.SR2版本的Spring Cloud Eureka实例)基础上修改配置文件即可,这次我们废弃原来的application.properties文件,新增3个yml(用properties也可以,自己选用):

application-es1.yml(给192.1.1.0节点用,它需要指定另外两个节点作为注册中心,其他两个同理):

eureka:

client:

fetch-registry: trueregister-with-eureka: trueservice-url:

defaultZone: http://192.1.1.1:8761/eureka,http://192.1.1.2:8761/eureka

spring:

profiles: es1

application:

name: eureka-server

server:

port:8761

application-es2.yml:

eureka:

client:

fetch-registry: trueregister-with-eureka: trueservice-url:

defaultZone: http://192.1.1.0:8761/eureka,http://192.1.1.2:8761/eureka

spring:

profiles: es2

application:

name: eureka-server

server:

port:8761

application-es3.yml:

eureka:

client:

fetch-registry: trueregister-with-eureka: trueservice-url:

defaultZone: http://192.1.1.0:8761/eureka,http://192.1.1.1:8761/eureka

spring:

profiles: es3

application:

name: eureka-server

server:

port:8761

2、maven出包后直接到linux对应的三个节点上rz -y上传生成的jar包

3、在三个节点上启动eureka-server,分别根据环境指定参数es1、es2、es3,比如我在192.1.1.0上启动,那么我需要指定环境为es1,其他两个同理:

java -jar uiss-discovery-eureka-0.0.1-SNAPSHOT.jar --spring.profiles.active=es1

最后看下eureka界面http://192.1.1.0:8761/,可以看到已经支持集群,另外两个链接界面就不贴了:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值