Search code examples
portspecificationsnomad

Change Nomad bind port


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

Solution

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