github.com/hspak/nomad@v0.7.2-0.20180309000617-bc4ae22a39a5/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 - `acl` <code>([ACL][acl]: nil)</code> - Specifies configuration which is specific to ACLs. 78 79 - `addresses` `(Addresses: see below)` - Specifies the bind address for 80 individual network services. Any values configured in this stanza take 81 precedence over the default [bind_addr](#bind_addr). 82 The values support [go-sockaddr/template format][go-sockaddr/template]. 83 84 - `http` - The address the HTTP server is bound to. This is the most common 85 bind address to change. 86 87 - `rpc` - The address to bind the internal RPC interfaces to. Should be 88 exposed only to other cluster members if possible. 89 90 - `serf` - The address used to bind the gossip layer to. Both a TCP and UDP 91 listener will be exposed on this address. Should be exposed only to other 92 cluster members if possible. 93 94 - `advertise` `(Advertise: see below)` - Specifies the advertise address for 95 individual network services. This can be used to advertise a different address 96 to the peers of a server or a client node to support more complex network 97 configurations such as NAT. This configuration is optional, and defaults to 98 the bind address of the specific network service if it is not provided. Any 99 values configured in this stanza take precedence over the default 100 [bind_addr](#bind_addr). If the bind address is `0.0.0.0` then the first 101 private IP found is advertised. You may advertise an alternate port as well. 102 The values support [go-sockaddr/template format][go-sockaddr/template]. 103 104 - `http` - The address to advertise for the HTTP interface. This should be 105 reachable by all the nodes from which end users are going to use the Nomad 106 CLI tools. 107 108 - `rpc` - The address to advertise for the RPC interface. This address should 109 be reachable by all of the agents in the cluster. 110 111 - `serf` - The address advertised for the gossip layer. This address must be 112 reachable from all server nodes. It is not required that clients can reach 113 this address. 114 115 - `bind_addr` `(string: "0.0.0.0")` - Specifies which address the Nomad 116 agent should bind to for network services, including the HTTP interface as 117 well as the internal gossip protocol and RPC mechanism. This should be 118 specified in IP format, and can be used to easily bind all network services to 119 the same address. It is also possible to bind the individual services to 120 different addresses using the [addresses](#addresses) configuration option. 121 Dev mode (`-dev`) defaults to localhost. 122 The value supports [go-sockaddr/template format][go-sockaddr/template]. 123 124 - `client` <code>([Client][client]: nil)</code> - Specifies configuration which is specific to the Nomad client. 125 126 - `consul` <code>([Consul][consul]: nil)</code> - Specifies configuration for 127 connecting to Consul. 128 129 - `datacenter` `(string: "dc1")` - Specifies the data center of the local agent. 130 All members of a datacenter should share a local LAN connection. 131 132 - `data_dir` `(string: required)` - Specifies a local directory used to store 133 agent state. Client nodes use this directory by default to store temporary 134 allocation data as well as cluster information. Server nodes use this 135 directory to store cluster state, including the replicated log and snapshot 136 data. This must be specified as an absolute path. 137 138 - `disable_anonymous_signature` `(bool: false)` - Specifies if Nomad should 139 provide an anonymous signature for de-duplication with the update check. 140 141 - `disable_update_check` `(bool: false)` - Specifies if Nomad should not check for updates and security bulletins. 142 143 - `enable_debug` `(bool: false)` - Specifies if the debugging HTTP endpoints 144 should be enabled. These endpoints can be used with profiling tools to dump 145 diagnostic information about Nomad's internals. 146 147 - `enable_syslog` `(bool: false)` - Specifies if the agent should log to syslog. 148 This option only works on Unix based systems. 149 150 - `http_api_response_headers` `(map<string|string>: nil)` - Specifies 151 user-defined headers to add to the HTTP API responses. 152 153 - `leave_on_interrupt` `(bool: false)` - Specifies if the agent should 154 gracefully leave when receiving the interrupt signal. By default, the agent 155 will exit forcefully on any signal. 156 157 - `leave_on_terminate` `(bool: false)` - Specifies if the agent should 158 gracefully leave when receiving the terminate signal. By default, the agent 159 will exit forcefully on any signal. 160 161 - `log_level` `(string: "INFO")` - Specifies the verbosity of logs the Nomad 162 agent will output. Valid log levels include `WARN`, `INFO`, or `DEBUG` in 163 increasing order of verbosity. 164 165 - `name` `(string: [hostname])` - Specifies the name of the local node. This 166 value is used to identify individual agents. When specified on a server, the 167 name must be unique within the region. 168 169 - `ports` `(Port: see below)` - Specifies the network ports used for different 170 services required by the Nomad agent. 171 172 - `http` - The port used to run the HTTP server. 173 174 - `rpc` - The port used for internal RPC communication between 175 agents and servers, and for inter-server traffic for the consensus algorithm 176 (raft). 177 178 - `serf` - The port used for the gossip protocol for cluster 179 membership. Both TCP and UDP should be routable between the server nodes on 180 this port. 181 182 The default values are: 183 184 ```hcl 185 ports { 186 http = 4646 187 rpc = 4647 188 serf = 4648 189 } 190 ``` 191 192 - `region` `(string: "global")` - Specifies the region the Nomad agent is a 193 member of. A region typically maps to a geographic region, for example `us`, 194 with potentially multiple zones, which map to [datacenters](#datacenter) such 195 as `us-west` and `us-east`. 196 197 - `sentinel` <code>([Sentinel][sentinel]: nil)</code> - Specifies configuration for Sentinel policies. 198 199 - `server` <code>([Server][server]: nil)</code> - Specifies configuration which is specific to the Nomad server. 200 201 - `syslog_facility` `(string: "LOCAL0")` - Specifies the syslog facility to write to. This has no effect unless `enable_syslog` is true. 202 203 - `tls` <code>([TLS][tls]: nil)</code> - Specifies configuration for TLS. 204 205 - `vault` <code>([Vault][vault]: nil)</code> - Specifies configuration for 206 connecting to Vault. 207 208 ## Examples 209 210 ### Custom Region and Datacenter 211 212 This example shows configuring a custom region and data center for the Nomad 213 agent: 214 215 ```hcl 216 region = "europe" 217 datacenter = "ams" 218 ``` 219 220 ### Enable CORS 221 222 This example shows how to enable CORS on the HTTP API endpoints: 223 224 ```hcl 225 http_api_response_headers { 226 "Access-Control-Allow-Origin" = "*" 227 } 228 ``` 229 230 [hcl]: https://github.com/hashicorp/hcl "HashiCorp Configuration Language" 231 [go-sockaddr/template]: https://godoc.org/github.com/hashicorp/go-sockaddr/template 232 [consul]: /docs/agent/configuration/consul.html "Nomad Agent consul Configuration" 233 [vault]: /docs/agent/configuration/vault.html "Nomad Agent vault Configuration" 234 [tls]: /docs/agent/configuration/tls.html "Nomad Agent tls Configuration" 235 [client]: /docs/agent/configuration/client.html "Nomad Agent client Configuration" 236 [sentinel]: /docs/agent/configuration/sentinel.html "Nomad Agent sentinel Configuration" 237 [server]: /docs/agent/configuration/server.html "Nomad Agent server Configuration" 238 [acl]: /docs/agent/configuration/acl.html "Nomad Agent ACL Configuration"