github.com/jrxfive/nomad@v0.6.1-0.20170802162750-1fef470e89bf/website/source/docs/agent/configuration/index.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Agent Configuration" 4 sidebar_current: "docs-agent-configuration" 5 description: |- 6 Learn about the configuration options available for the Nomad agent. 7 --- 8 9 # Agent Configuration 10 11 Nomad agents have a variety of parameters that can be specified via 12 configuration files or command-line flags. Configuration files are written in 13 [HCL][hcl]. Nomad can read and combine parameters from multiple configuration 14 files or directories to configure the Nomad agent. 15 16 ## Load Order and Merging 17 18 The Nomad agent supports multiple configuration files, which can be provided 19 using the `-config` CLI flag. The flag can accept either a file or folder: 20 21 ```shell 22 $ nomad agent -config=server.conf -config=/etc/nomad -config=extra.json 23 ``` 24 25 This will load configuration from `server.conf`, from `.hcl` and `.json` files 26 under `/etc/nomad`, and finally from `extra.json`. Files are loaded and merged 27 in lexicographical order. Directories are not loaded recursively. 28 29 As each file is processed, its contents are merged into the existing 30 configuration. When merging, any non-empty values from the latest config file 31 will append or replace parameters in the current configuration. An empty value 32 means `""` for strings, `0` for integer or float values, and `false` for 33 booleans. Since empty values are ignored you cannot disable an parameter like 34 `server` mode once you've enabled it. 35 36 Here is an example Nomad agent configuration that runs in both client and server 37 mode. 38 39 ```hcl 40 bind_addr = "0.0.0.0" # the default 41 42 data_dir = "/var/lib/nomad" 43 44 advertise { 45 # Defaults to the node's hostname. If the hostname resolves to a loopback 46 # address you must manually configure advertise addresses. 47 http = "1.2.3.4" 48 rpc = "1.2.3.4" 49 serf = "1.2.3.4:5648" # non-default ports may be specified 50 } 51 52 server { 53 enabled = true 54 bootstrap_expect = 3 55 } 56 57 client { 58 enabled = true 59 network_speed = 10 60 options { 61 "driver.raw_exec.enable" = "1" 62 } 63 } 64 65 consul { 66 address = "1.2.3.4:8500" 67 } 68 69 ``` 70 71 ~> Note that it is strongly recommended **not** to operate a node as both 72 `client` and `server`, although this is supported to simplify development and 73 testing. 74 75 ## General Parameters 76 77 - `addresses` `(Addresses: see below)` - Specifies the bind address for 78 individual network services. Any values configured in this stanza take 79 precedence over the default [bind_addr](#bind_addr). 80 The values support [go-sockaddr/template format][go-sockaddr/template]. 81 82 - `http` - The address the HTTP server is bound to. This is the most common 83 bind address to change. 84 85 - `rpc` - The address to bind the internal RPC interfaces to. Should be 86 exposed only to other cluster members if possible. 87 88 - `serf` - The address used to bind the gossip layer to. Both a TCP and UDP 89 listener will be exposed on this address. Should be exposed only to other 90 cluster members if possible. 91 92 - `advertise` `(Advertise: see below)` - Specifies the advertise address for 93 individual network services. This can be used to advertise a different address 94 to the peers of a server or a client node to support more complex network 95 configurations such as NAT. This configuration is optional, and defaults to 96 the bind address of the specific network service if it is not provided. Any 97 values configured in this stanza take precedence over the default 98 [bind_addr](#bind_addr). If the bind address is `0.0.0.0` then the first 99 private IP found is advertised. You may advertise an alternate port as well. 100 The values support [go-sockaddr/template format][go-sockaddr/template]. 101 102 - `http` - The address to advertise for the HTTP interface. This should be 103 reachable by all the nodes from which end users are going to use the Nomad 104 CLI tools. 105 106 - `rpc` - The address to advertise for the RPC interface. This address should 107 be reachable by all of the agents in the cluster. 108 109 - `serf` - The address advertised for the gossip layer. This address must be 110 reachable from all server nodes. It is not required that clients can reach 111 this address. 112 113 - `bind_addr` `(string: "0.0.0.0")` - Specifies which address the Nomad 114 agent should bind to for network services, including the HTTP interface as 115 well as the internal gossip protocol and RPC mechanism. This should be 116 specified in IP format, and can be used to easily bind all network services to 117 the same address. It is also possible to bind the individual services to 118 different addresses using the [addresses](#addresses) configuration option. 119 Dev mode (`-dev`) defaults to localhost. 120 The value supports [go-sockaddr/template format][go-sockaddr/template]. 121 122 - `client` <code>([Client][client]: nil)</code> - Specifies configuration which is specific to the Nomad client. 123 124 - `consul` <code>([Consul][consul]: nil)</code> - Specifies configuration for 125 connecting to Consul. 126 127 - `datacenter` `(string: "dc1")` - Specifies the data center of the local agent. 128 All members of a datacenter should share a local LAN connection. 129 130 - `data_dir` `(string: required)` - Specifies a local directory used to store 131 agent state. Client nodes use this directory by default to store temporary 132 allocation data as well as cluster information. Server nodes use this 133 directory to store cluster state, including the replicated log and snapshot 134 data. This must be specified as an absolute path. 135 136 - `disable_anonymous_signature` `(bool: false)` - Specifies if Nomad should 137 provide an anonymous signature for de-duplication with the update check. 138 139 - `disable_update_check` `(bool: false)` - Specifies if Nomad should not check for updates and security bulletins. 140 141 - `enable_debug` `(bool: false)` - Specifies if the debugging HTTP endpoints 142 should be enabled. These endpoints can be used with profiling tools to dump 143 diagnostic information about Nomad's internals. 144 145 - `enable_syslog` `(bool: false)` - Specifies if the agent should log to syslog. 146 This option only works on Unix based systems. 147 148 - `http_api_response_headers` `(map<string|string>: nil)` - Specifies 149 user-defined headers to add to the HTTP API responses. 150 151 - `leave_on_interrupt` `(bool: false)` - Specifies if the agent should 152 gracefully leave when receiving the interrupt signal. By default, the agent 153 will exit forcefully on any signal. 154 155 - `leave_on_terminate` `(bool: false)` - Specifies if the agent should 156 gracefully leave when receiving the terminate signal. By default, the agent 157 will exit forcefully on any signal. 158 159 - `log_level` `(string: "INFO")` - Specifies the verbosity of logs the Nomad 160 agent will output. Valid log levels include `WARN`, `INFO`, or `DEBUG` in 161 increasing order of verbosity. 162 163 - `name` `(string: [hostname])` - Specifies the name of the local node. This 164 value is used to identify individual nodes in a given datacenter and must be 165 unique per-datacenter. 166 167 - `ports` `(Port: see below)` - Specifies the network ports used for different 168 services required by the Nomad agent. 169 170 - `http` - The port used to run the HTTP server. 171 172 - `rpc` - The port used for internal RPC communication between 173 agents and servers, and for inter-server traffic for the consensus algorithm 174 (raft). 175 176 - `serf` - The port used for the gossip protocol for cluster 177 membership. Both TCP and UDP should be routable between the server nodes on 178 this port. 179 180 The default values are: 181 182 ```hcl 183 ports { 184 http = 4646 185 rpc = 4647 186 serf = 4648 187 } 188 ``` 189 190 - `region` `(string: "global")` - Specifies the region the Nomad agent is a 191 member of. A region typically maps to a geographic region, for example `us`, 192 with potentially multiple zones, which map to [datacenters](#datacenter) such 193 as `us-west` and `us-east`. 194 195 - `server` <code>([Server][server]: nil)</code> - Specifies configuration which is specific to the Nomad server. 196 197 - `syslog_facility` `(string: "LOCAL0")` - Specifies the syslog facility to write to. This has no effect unless `enable_syslog` is true. 198 199 - `tls` <code>([TLS][tls]: nil)</code> - Specifies configuration for TLS. 200 201 - `vault` <code>([Vault][vault]: nil)</code> - Specifies configuration for 202 connecting to Vault. 203 204 ## Examples 205 206 ### Custom Region and Datacenter 207 208 This example shows configuring a custom region and data center for the Nomad 209 agent: 210 211 ```hcl 212 region = "europe" 213 datacenter = "ams" 214 ``` 215 216 ### Enable CORS 217 218 This example shows how to enable CORS on the HTTP API endpoints: 219 220 ```hcl 221 http_api_response_headers { 222 "Access-Control-Allow-Origin" = "*" 223 } 224 ``` 225 226 [hcl]: https://github.com/hashicorp/hcl "HashiCorp Configuration Language" 227 [go-sockaddr/template]: https://godoc.org/github.com/hashicorp/go-sockaddr/template 228 [consul]: /docs/agent/configuration/consul.html "Nomad Agent consul Configuration" 229 [vault]: /docs/agent/configuration/vault.html "Nomad Agent vault Configuration" 230 [tls]: /docs/agent/configuration/tls.html "Nomad Agent tls Configuration" 231 [client]: /docs/agent/configuration/client.html "Nomad Agent client Configuration" 232 [server]: /docs/agent/configuration/server.html "Nomad Agent server Configuration"