0

In HashiCorp Nomad, is it possible to specify the bind port for a Server and Client (e.g., from 464{6,7,8} to 600{6,7.8}?

The addresses stanza does not allow port specification, and neither does the -bind switch. The advertise stanza does not change the port on which Nomad binds.

The -bind switch allows specifying IP only:

> nomad agent -server -data-dir=/tmp/nomad -bind=0.0.0.0
==> No configuration files loaded
==> Starting Nomad agent...
==> Nomad agent configuration:

       Advertise Addrs: HTTP: <HOSTIP>:4646; RPC: <HOSTIP>:4647; Serf: <HOSTIP>:4648
            Bind Addrs: HTTP: 0.0.0.0:4646; RPC: 0.0.0.0:4647; Serf: 0.0.0.0:4648

Attempting to specify a port errors out:

> nomad agent -server -data-dir=/tmp/nomad -bind=0.0.0.0:6000 
==> Failed to parse HTTP advertise address (, 0.0.0.0:6000, 4646, false): Error resolving bind address "0.0.0.0:6000": lookup 0.0.0.0:6000: no such host
Elle Fie
  • 681
  • 6
  • 21
  • 2
    May I point out that Nomad questions usually live on SO? Source: https://stackexchange.com/search?q=nomad – Elle Fie Dec 20 '19 at 06:19
  • 1
    My comment above is in reference to the user that downvoted my question and my answer, who also pointed out that Nomad questions do not belong on SO. – Elle Fie Jan 03 '20 at 21:28

2 Answers2

2

Use the ports stanza to select ports for the agent, whether in server or client mode.

Elle Fie
  • 681
  • 6
  • 21
1

you should look on hashicorp website how to launch nomad with server.hcl client.hcl and nomad.hcl file

:

echo 'server {
    enabled = true
    bootstrap_expect = 1
    
    }' > /etc/nomad.d/server.hcl
  
echo 'region     = "global"
    datacenter = "dc1"
    data_dir  = "/opt/nomad"
    bind_addr = "1.2.3.4" # the default

    advertise {
    # Defaults to the first private IP address.
    http = "1.2.3.4"
    rpc  = "1.2.3.4" #put your adresse here
    serf = "1.2.3.4:5648" # non-default ports may be specified
              }
    ' > /etc/nomad.d/nomad.hcl

  

and run this :

nomad agent -config /etc/nomad.d