【问题标题】:Nomad and Waypoint cannot launch more than 2 jobsNomad 和 Waypoint 不能启动超过 2 个工作
【发布时间】:2022-10-14 18:45:59
【问题描述】:

我目前正在尝试部署几个D b游牧集群.测试 - 开发 - qa - ppd我正在使用带有 var 文件的航点来自动化部署。 我有奇怪的问题,我无法启动多于2分贝作业,当我启动新的数据库工作旧的 2 个工作消失了,被新的数据库作业取代之前推出的。

航点文件

# waypoint up -var-file=/opt/waypoint/xx/xx-api/dev/dev.wpvars
project = "xx-db"

# An application to deploy.
app "xx-db" {
    build {
        use "docker" {
            dockerfile = "${path.app}/${var.dockerfile_path}"
        }
        
        
        # Uncomment below to use a remote docker registry to push your built images.
        #
         registry {
           use "docker" {
             #image = "registry.example.com/image"
             image =  "${var.registry_path}/xx-db-${var.env}"
             tag   = "${var.version}"
           }
         }

    }



 # Deploy to Docker
    deploy {
           use "nomad-jobspec" {
      jobspec = templatefile("${path.app}/finess-db.hcl", {
    datacenter = var.datacenter
  env = var.env

          })
    }
    }
}




variable env {
    type = string
    default = ""
}

variable dockerfile_path {
    type = string
    default = "Dockerfile"
}

variable "registry_path" {
    type = string
    default = "registry.repo.proxy-xx-xx.xx.xx.xx.net"
               
}

variable datacenter {
    type = string
    default = "xx"
}

variable "version" {
  type    = string
  default = gitrefpretty()
  env     = ["gitrefpretty()"]
               
}

新工作后,旧的测试和形成消失

job "xxx-psqldb-${env}" {
        datacenters = ["xxx"]
        type = "service"
          vault {
          policies = ["xxx"]
          change_mode = "noop"
          }
        update {
                stagger = "30s"
                max_parallel = 1
        }

        group "xxx-psqldb-${env}" {
                count = "1"
                restart {
                        attempts = 3
                        delay = "60s"
                        interval = "1h"
                        mode = "fail"
                }
                network {
                        mode = "host"
                        port "pgsqldb" { to = 5432 }
                }
                task "xxx-psqldb-${env}" {
                        driver = "docker"
                        config {
                                image = "${artifact.image}:${artifact.tag}"
                                ports = [
                                        "pgsqldb"
                                        ]
                                volumes = [
                                    "name=xxxpsqldb${env},io_priority=high,size=5,repl=1:/var/lib/postgresql/data"
                                ]
                                volume_driver = "pxd"

                        }
                        template {
                                data = <<EOH
POSTGRES_USER="{{ with secret "app/xxx/db/admin" }}{{ .Data.data.user }}{{end}}"
POSTGRES_PASSWORD="{{ with secret "app/xxx/db/admin" }}{{ .Data.data.password }}{{end}}"

EOH
                                destination = "secrets/db"
                                env = true
                        }
                        resources {
                                cpu = 256
                                memory = 256
                        }
                        service {
                                name = "xxx-psql-svc-${env}"
                                tags = ["urlprefix-xxx-psql-${env} proto=tcp"]
                                port = "pgsqldb"
                                 check {
                                         name         = "alive"
                                         type         = "tcp"
                                         interval     = "10s"
                                         timeout      = "5s"
                                         port         = "pgsqldb"
                                }

                        }

                }
        }
}

当我为前端应用程序或后端应用程序启动其他工作时,我遇到了同样的问题.

我应该在集群中配置一些东西吗?

谢谢帮助

【问题讨论】:

    标签: nomad waypoint


    【解决方案1】:

    只删除文件数据.db航点恢复.db.lock解决的问题。

    谢谢

    【讨论】:

      【解决方案2】:

      我遇到过类似的问题。

      TLDR:使用-prune=false

      解释

      正如waypoint docs 提到的:

      ...如果 -prune=false 未设置,Waypoint 可能会通过“修剪”以前的版本来删除您的工作

      此外,这目前将您锁定为使用 CLI

      CLI 标志是当今唯一的自定义方式

      如所述here

      该问题也可以在hashicorp disuss 上找到。

      【讨论】:

        猜你喜欢
        • 2017-08-19
        • 1970-01-01
        • 2022-01-27
        • 2019-08-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-18
        • 1970-01-01
        相关资源
        最近更新 更多