0

I ran this code:

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

Everything looks good, but it seems that nomad kills the process

Result after running:

Picture => Result after running

Still error:

Picture => Still error

When I'm check with ps -ef | grep zoo the process is not there.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
Frank
  • 11
  • 2

1 Answers1

1

Nomad considers programs running as servers not started. I assume that Nomad does not get to the PID.

The solution is: Start a program in frontend mode. This works for me with all programs.

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