Eureka集群部署

增加多profile配置

---
spring:
  application:
    name: spring-cloud-eureka
  profiles: peer1
server:
  port: 8000
eureka:
  instance:
    hostname: peer1
  client:
    serviceUrl:
      defaultZone: http://peer2:8001/eureka/,http://peer3:8002/eureka/
---
spring:
  application:
    name: spring-cloud-eureka
  profiles: peer2
server:
  port: 8001
eureka:
  instance:
    hostname: peer2
  client:
    serviceUrl:
      defaultZone: http://peer1:8000/eureka/,http://peer3:8002/eureka/
---
spring:
  application:
    name: spring-cloud-eureka
  profiles: peer3
server:
  port: 8002
eureka:
  instance:
    hostname: peer3
  client:
    serviceUrl:
      defaultZone: http://peer1:8000/eureka/,http://peer2:8001/eureka/

启动

nohup java -jar eureka.jar --spring.profiles.active=peer1 > peer1.out &
1.nohup 以及最后的 & 表示启动程序的时候在后台运行,执行完此命令后不打出日志,并且关掉ssh后当前进程不会停止。
2.java -jar eureka.jar 表示用java命令以jar包的形式启动eureka.jar
3.–spring.profiles.active=peer1 两个减号及后台的参数表示启动的时候加载spring.profiles名字为peer1的一系列参数,在上面的例子中表示加载下面的参数:
4.> peer1.out表示将日志输出到peer1.out

你可能感兴趣的:(Eureka集群部署)