Jhipster Registry (Eureka server) docker two-way Unicom and high availability deployment
•
Java
Use compose to orchestrate this Eureka server cluster:
Peer1 configuration:
server:
port: 8761
eureka:
instance:
hostname: eureka-peer-1
server:
# see discussion about enable-self-preservation:
# https://github.com/jhipster/generator-jhipster/issues/3654
enable-self-preservation: false
registry-sync-retry-wait-ms: 500
a-sgcache-expiry-timeout-ms: 60000
eviction-interval-timer-in-ms: 30000
peer-eureka-nodes-update-interval-ms: 30000
renewal-threshold-update-interval-ms: 15000
client:
fetch-registry: true
register-with-eureka: true
service-url:
defaultZone: http://admin:${spring.security.user.password:admin}@eureka-peer-2:8762/eureka/
Peer2 configuration:
server:
port: 8762
eureka:
instance:
hostname: eureka-peer-2
server:
# see discussion about enable-self-preservation:
# https://github.com/jhipster/generator-jhipster/issues/3654
enable-self-preservation: false
registry-sync-retry-wait-ms: 500
a-sgcache-expiry-timeout-ms: 60000
eviction-interval-timer-in-ms: 30000
peer-eureka-nodes-update-interval-ms: 30000
renewal-threshold-update-interval-ms: 15000
client:
fetch-registry: true
register-with-eureka: true
service-url:
defaultZone: http://admin:${spring.security.user.password:admin}@eureka-peer-1:8761/eureka/
Build image
Use the official dockerfile:
FROM openjdk:8-jre-alpine
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
JAVA_OPTS="" \
JHIPSTER_SLEEP=0
VOLUME /tmp
EXPOSE 8761
CMD echo "The application will start in ${JHIPSTER_SLEEP}s..." && \
sleep ${JHIPSTER_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /app.war
# add directly the war
ADD *.war /app.war
Build the image and push it to the registry. Here is 192.168 86.8:5000/registry-dev
Write a compose file:
version: "3"
services:
eureka-peer-1 :
image: 192.168.86.8:5000/registry-dev:latest
links:
- eureka-peer-2
ports:
- "8761:8761"
environment:
spring.profiles.active: oauth2,peer1,swagger
entrypoint:
- java
- -Dspring.profiles.active=oauth2,swagger
- -Djava.security.egd=file:/dev/./urandom
- -jar
- /app.war
eureka-peer-2:
image: 192.168.86.8:5000/registry-dev:latest
links:
- eureka-peer-1
expose:
- "8762"
ports:
- "8762:8762"
environment:
spring.profiles.active: oauth2,peer2,swagger
- -Djava.security.egd=file:/dev/./urandom
- -jar
- /app.war
Just start.
Author: jadepeng source: jqpeng's technical Notepad-- http://www.cnblogs.com/xiaoqi Your support is the greatest encouragement to bloggers. Thank you for your careful reading. The copyright of this article belongs to the author. Reprint is welcome, but this statement must be retained without the consent of the author, and the original text connection must be given in an obvious position on the article page, otherwise the right to investigate legal responsibility is reserved.
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码