Spring cloud server 多机集群配置
多机集群的配置就没有那么多要注意的地方了,同样是部署两套server实例来组成服务注册中心的集群。
部署完成后,访问这两个服务注册中心的页面地址看是否注册的服务列表是否一样。
server1的application.properties配置
#for spring cloud server
spring.application.name=dmcpxy-cloud-server
server.port=8761
server.address=0.0.0.0
eureka.client.serviceUrl.defaultZone=http://test:test@10.3.3.143:${server.port}/eureka
eureka.instance.prefer-ip-address=true
eureka.server.enable-self-preservation=true
eureka.server.eviction-interval-timer-in-ms=5000
eureka.instance.lease-expiration-duration-in-seconds=10
eureka.instance.hostname=${spring.cloud.client.ipAddress}
eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port}
security.basic.enabled=true
security.user.name=test
security.user.password=test
eureka.client.registerWithEureka=false
eureka.client.fetchRegistry=false
########################################################
endpoints.shutdown.enabled=true
endpoints.shutdown.sensitive=false
endpoints.shutdown.path=/admin/shutdown
management.security.enabled=false
management.port=15150
management.address=127.0.0.1
########################################################
server2的application.properties配置
#for spring cloud server
spring.application.name=dmcpxy-cloud-server
server.port=8761
server.address=0.0.0.0
eureka.client.serviceUrl.defaultZone=http://test:test@10.3.3.130:${server.port}/eureka
eureka.instance.prefer-ip-address=true
eureka.server.enable-self-preservation=true
eureka.server.eviction-interval-timer-in-ms=5000
eureka.instance.lease-expiration-duration-in-seconds=10
eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port}
eureka.instance.hostname=${spring.cloud.client.ipAddress}
eureka.client.registerWithEureka=false
eureka.client.fetchRegistry=false
security.basic.enabled=true
security.user.name=test
security.user.password=test
########################################################
endpoints.shutdown.enabled=true
endpoints.shutdown.sensitive=false
endpoints.shutdown.path=/admin/shutdown
management.security.enabled=false
management.port=15150
management.address=127.0.0.1
########################################################