• jenkins 部署docker 容器 eureka 集群 完整配置 多台服务器


    jenkins通过流水线作业pipiline部署

    服务器
    192.168.89.135
    192.168.89.136
    192.168.89.141

    jenkins 构建两个item,一个build,一个deploy

    build不说了

    主要说下deploy。

    增加两个参数选择,需要发布的项目。这里我们主要发布eureka

    application.yml 配置文件

    #注册中心  
    eureka:
      instance:
        hostname: eureka
        prefer-ip-address: true
      client:
        register-with-eureka: false
        fetch-registry: false
        service-url:
          defaultZone: http://myhost1:8761/eureka/,http://myhost2:8761/eureka/,http://myhost3:8761/eureka/
      server:
        eviction-interval-timer-in-ms: 30000
        enable-self-preservation: false
        renewal-percent-threshold: 0.9
        

    运行编译脚本:

    def EUREKA_HOST_A="192.168.89.136"
    def EUREKA_HOST_A_NAME="myhost1"
    def EUREKA_HOST_B="192.168.89.141"
    def EUREKA_HOST_B_NAME="myhost2"
    def EUREKA_HOST_C="192.168.89.135"
    def EUREKA_HOST_C_NAME="myhost3"
    def EUREKA_PORT="8761"



    sh "docker run --restart=always -p ${EUREKA_PORT}:8761 "+ "-d -v ${LOG_PATH}:${LOG_PATH} "+ "-m 1000M --memory-swap -1 "+ "-e eureka.instance.hostname=${my_hostname} "+ "-e eureka.instance.prefer-ip-address=false "+ "-e eureka.client.register-with-eureka=true "+ "-e eureka.client.fetch-registry=true "+ "--add-host=${EUREKA_HOST_A_NAME}:${EUREKA_HOST_A} --add-host=${EUREKA_HOST_B_NAME}:${EUREKA_HOST_B} --add-host=${EUREKA_HOST_C_NAME}:${EUREKA_HOST_C} "+ // 显示真正IP端口 "-e eureka.instance.instance-id=${nodeIp}:${EUREKA_PORT} "+ "--name ${PROJECT_NAME} "+ " $REPOSITORY"

    发布后。容器正常运行

  • 相关阅读:
    2019年春季学期第三周作业
    2019春第二周作业+一些的挑战作业
    查找整数
    寒假作业3编辑总结
    寒假作业2编辑总结
    对自己影响最大的老师
    2019春第九周作业
    2019春第八周作业
    2019春第七周作业
    2019春第六周作业
  • 原文地址:https://www.cnblogs.com/smallfa/p/13359648.html
Copyright © 2020-2023  润新知