• 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"

    发布后。容器正常运行

  • 相关阅读:
    刚装的vs无法运行正确的程序
    选择正确的C/C++ runtime library
    【转】how can i build fast
    【转】关于增量链接(incremental linking)
    VS升级后的配置问题
    获得system32等系统文件权限
    Java Web总结二十三发送邮件
    Java Web总结二十二投票系统
    Java Web总结二十一Listener监听器
    Java Web总结二十Filter、装饰设计模式
  • 原文地址:https://www.cnblogs.com/a393060727/p/13323329.html
Copyright © 2020-2023  润新知