启动后,Hashicorp Nomad杀死了动物园管理员程序

时间:2018-06-20 16:02:55

标签: nomad

我运行了这段代码:

job "zookeeper" {

    constraint {
        attribute = "${attr.unique.network.ip-address}"
        value     = "130.250.58.163"
    }

    datacenters = ["nosql_dc"]

    type = "service"
    group "zookeeper" {
        count = 1
        restart {
          attempts = 0
        }

        task "instance" {
            driver = "raw_exec"
            kill_timeout = "60s"
            resources {
                network {
                    port "zookeeper_port" {
                        static = 2181
                    }
                }
            }

            config {
                command = "/nosql/zookeeper/bin/zkServer.sh"
                args = ["start"]
            }

            service {
                    name = "zookeeper"
                    port = "zookeeper_port"

                    check {
                      name     = "Zookeeper Check"
                      type     = "tcp"
                      interval = "30s"
                      timeout  = "10s"
                      port     = "zookeeper_port"
                    }
            }
        }
    }
}

一切看起来都不错,但是游牧民族似乎杀死了整个过程

运行后的结果:

Picture => Result after running

仍然错误:

Picture => Still error

当我与ps -ef | grep zoo进行核对时,该过程就不存在了。

1 个答案:

答案 0 :(得分:1)

Nomad认为程序在服务器未启动时运行。 我认为Nomad无法获得PID。

解决方案是:在前端模式下启动程序。 这适用于所有程序。

config {
          command = "/nosql/zookeeper/bin/zkServer.sh"
          args = ["start-foreground"]
}