github.com/huiliang/nomad@v0.2.1-0.20151124023127-7a8b664699ff/website/source/docs/agent/config.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Configuration" 4 sidebar_current: "docs-agent-config" 5 description: |- 6 Learn about the configuration options available for the Nomad agent. 7 --- 8 9 # Configuration 10 11 Nomad agents are highly configurable and expose many configuration options 12 through the use of config files. Config files are written in 13 [HCL](https://github.com/hashicorp/hcl) or JSON syntax. Multiple configuration 14 files or directories of configuration files may be used jointly to configure the 15 Nomad agent. 16 17 When loading configuration files and directories, the Nomad agent parses each 18 file in lexical order. As each file is processed, its contents are merged into 19 the existing configuration, enabling a layered, additive configuration 20 mechanism. During a merge, configuration values are copied from 21 the next configuration file in the set if they have a non-empty value. An 22 empty value means `""` for strings, `0` for integer or float values, and 23 `false` for booleans. More complex data types like arrays or maps are usually 24 appended together. Any exceptions to these rules are documented alongside the 25 configuration options below. 26 27 A subset of the configuration options can also be specified using the 28 command-line interface. See the [CLI Options](#cli) section for further details. 29 30 Nomad's configuration is broken down into logical groupings. Because of the high 31 number of configuration options available, this page is also broken into 32 sections for easier reading. 33 34 ## General Options 35 36 The following configuration options are available to both client and server 37 nodes, unless otherwise specified: 38 39 * <a id="region">`region`</a>: Specifies the region the Nomad agent is a 40 member of. A region typically maps to a geographic region, for example `us`, 41 with potentially multiple zones, which map to [datacenters](#datacenter) such 42 as `us-west` and `us-east`. Defaults to `global`. 43 44 * `datacenter`: Datacenter of the local agent. All members of a datacenter 45 should share a local LAN connection. Defaults to `dc1`. 46 47 * <a id="name">`name`</a>: The name of the local node. This value is used to 48 identify individual nodes in a given datacenter and must be unique 49 per-datacenter. By default this is set to the local host's name. 50 51 * `data_dir`: A local directory used to store agent state. Client nodes use this 52 directory by default to store temporary allocation data as well as cluster 53 information. Server nodes use this directory to store cluster state, including 54 the replicated log and snapshot data. This option is required to start the 55 Nomad agent. 56 57 * `log_level`: Controls the verbosity of logs the Nomad agent will output. Valid 58 log levels include `WARN`, `INFO`, or `DEBUG` in increasing order of 59 verbosity. Defaults to `INFO`. 60 61 * <a id="bind_addr">`bind_addr`</a>: Used to indicate which address the Nomad 62 agent should bind to for network services, including the HTTP interface as 63 well as the internal gossip protocol and RPC mechanism. This should be 64 specified in IP format, and can be used to easily bind all network services to 65 the same address. It is also possible to bind the individual services to 66 different addresses using the [addresses](#addresses) configuration option. 67 Defaults to the local loopback address `127.0.0.1`. 68 69 * `enable_debug`: Enables the debugging HTTP endpoints. These endpoints can be 70 used with profiling tools to dump diagnostic information about Nomad's 71 internals. It is not recommended to leave this enabled in production 72 environments. Defaults to `false`. 73 74 * `ports`: Controls the network ports used for different services required by 75 the Nomad agent. The value is a key/value mapping of port numbers, and accepts 76 the following keys: 77 <br> 78 * `http`: The port used to run the HTTP server. Applies to both client and 79 server nodes. Defaults to `4646`. 80 * `rpc`: The port used for internal RPC communication between agents and 81 servers, and for inter-server traffic for the consensus algorithm (raft). 82 Defaults to `4647`. Only used on server nodes. 83 * `serf`: The port used for the gossip protocol for cluster membership. Both 84 TCP and UDP should be routable between the server nodes on this port. 85 Defaults to `4648`. Only used on server nodes. 86 87 * <a id="addresses">`addresses`</a>: Controls the bind address for individual 88 network services. Any values configured in this block take precedence over the 89 default [bind_addr](#bind_addr). The value is a map of IP addresses and 90 supports the following keys: 91 <br> 92 * `http`: The address the HTTP server is bound to. This is the most common 93 bind address to change. Applies to both clients and servers. 94 * `rpc`: The address to bind the internal RPC interfaces to. Should be exposed 95 only to other cluster members if possible. Used only on server nodes, but 96 must be accessible from all agents. 97 * `serf`: The address used to bind the gossip layer to. Both a TCP and UDP 98 listener will be exposed on this address. Should be restricted to only 99 server nodes from the same datacenter if possible. Used only on server 100 nodes. 101 102 * `advertise`: Controls the advertise address for individual network services. 103 This can be used to advertise a different address to the peers of a server 104 node to support more complex network configurations such as NAT. This 105 configuration is optional, and defaults to the bind address of the specific 106 network service if it is not provided. This configuration is only applicable 107 on server nodes. The value is a map of IP addresses and supports the 108 following keys: 109 <br> 110 * `rpc`: The address to advertise for the RPC interface. This address should 111 be reachable by all of the agents in the cluster. 112 * `serf`: The address advertised for the gossip layer. This address must be 113 reachable from all server nodes. It is not required that clients can reach 114 this address. 115 116 * `telemetry`: Used to control how the Nomad agent exposes telemetry data to 117 external metrics collection servers. This is a key/value mapping and supports 118 the following keys: 119 <br> 120 * `statsite_address`: Address of a 121 [statsite](https://github.com/armon/statsite) server to forward metrics data 122 to. 123 * `statsd_address`: Address of a [statsd](https://github.com/etsy/statsd) 124 server to forward metrics to. 125 * `disable_hostname`: A boolean indicating if gauge values should not be 126 prefixed with the local hostname. 127 128 * `leave_on_interrupt`: Enables gracefully leaving when receiving the 129 interrupt signal. By default, the agent will exit forcefully on any signal. 130 131 * `leave_on_terminate`: Enables gracefully leaving when receiving the 132 terminate signal. By default, the agent will exit forcefully on any signal. 133 134 * `enable_syslog`: Enables logging to syslog. This option only works on 135 Unix based systems. 136 137 * `syslog_facility`: Controls the syslog facility that is used. By default, 138 `LOCAL0` will be used. This should be used with `enable_syslog`. 139 140 * `disable_update_check`: Disables automatic checking for security bulletins 141 and new version releases. 142 143 * `disable_anonymous_signature`: Disables providing an anonymous signature 144 for de-duplication with the update check. See `disable_update_check`. 145 146 ## Server-specific Options 147 148 The following options are applicable to server agents only and need not be 149 configured on client nodes. 150 151 * `server`: This is the top-level key used to define the Nomad server 152 configuration. It is a key/value mapping which supports the following keys: 153 <br> 154 * `enabled`: A boolean indicating if server mode should be enabled for the 155 local agent. All other server options depend on this value being set. 156 Defaults to `false`. 157 * <a id="bootstrap_expect">`bootstrap_expect`</a>: This is an integer 158 representing the number of server nodes to wait for before bootstrapping. It 159 is most common to use the odd-numbered integers `3` or `5` for this value, 160 depending on the cluster size. A value of `1` does not provide any fault 161 tolerance and is not recommended for production use cases. 162 * `data_dir`: This is the data directory used for server-specific data, 163 including the replicated log. By default, this directory lives inside of the 164 [data_dir](#data_dir) in the "server" sub-path. 165 * `protocol_version`: The Nomad protocol version spoken when communicating 166 with other Nomad servers. This value is typically not required as the agent 167 internally knows the latest version, but may be useful in some upgrade 168 scenarios. 169 * `num_schedulers`: The number of parallel scheduler threads to run. This 170 can be as many as one per core, or `0` to disallow this server from making 171 any scheduling decisions. This defaults to the number of CPU cores. 172 * `enabled_schedulers`: This is an array of strings indicating which 173 sub-schedulers this server will handle. This can be used to restrict the 174 evaluations that worker threads will dequeue for processing. This 175 defaults to all available schedulers. 176 * `node_gc_threshold` This is a string with a unit suffix, such as "300ms", 177 "1.5h" or "25m". Valid time units are "ns", "us" (or "µs"), "ms", "s", 178 "m", "h". Controls how long a node must be in a terminal state before it is 179 garbage collected and purged from the system. 180 181 ## Client-specific Options 182 183 The following options are applicable to client agents only and need not be 184 configured on server nodes. 185 186 * `client`: This is the top-level key used to define the Nomad client 187 configuration. Like the server configuration, it is a key/value mapping which 188 supports the following keys: 189 <br> 190 * `enabled`: A boolean indicating if client mode is enabled. All other client 191 configuration options depend on this value. Defaults to `false`. 192 * <a id="state_dir">`state_dir`</a>: This is the state dir used to store 193 client state. By default, it lives inside of the [data_dir](#data_dir), in 194 the "client" sub-path. 195 * <a id="alloc_dir">`alloc_dir`</a>: A directory used to store allocation data. 196 Depending on the workload, the size of this directory can grow arbitrarily 197 large as it is used to store downloaded artifacts for drivers (QEMU images, 198 JAR files, etc.). It is therefore important to ensure this directory is 199 placed some place on the filesystem with adequate storage capacity. By 200 default, this directory lives under the [data_dir](#data_dir) at the 201 "alloc" sub-path. 202 * <a id="servers">`servers`</a>: An array of server addresses. This list is 203 used to register the client with the server nodes and advertise the 204 available resources so that the agent can receive work. 205 * <a id="node_id">`node_id`</a>: This is the value used to uniquely identify 206 the local agent's node registration with the servers. This can be any 207 arbitrary string but must be unique to the cluster. By default, if not 208 specified, a randomly- generate UUID will be used. 209 * <a id="node_class">`node_class`</a>: A string used to logically group client 210 nodes by class. This can be used during job placement as a filter. This 211 option is not required and has no default. 212 * <a id="meta">`meta`</a>: This is a key/value mapping of metadata pairs. This 213 is a free-form map and can contain any string values. 214 * <a id="options">`options`</a>: This is a key/value mapping of internal 215 configuration for clients, such as for driver configuration. Please see 216 [here](#options_map) for a description of available options. 217 * <a id="network_interface">`network_interface`</a>: This is a string to force 218 network fingerprinting to use a specific network interface 219 * <a id="network_speed">`network_speed`</a>: This is an int that sets the 220 default link speed of network interfaces, in megabytes, if their speed can 221 not be determined dynamically. 222 223 ### Client Options Map <a id="options_map"></a> 224 225 The following is not an exhaustive list of options that can be passed to the 226 Client, but rather the set of options that configure the Client and not the 227 drivers. To find the options supported by an individual driver, see the drivers 228 documentation [here](/docs/drivers/index.html) 229 230 * `consul.address`: The address to the local Consul agent given in the format of 231 `host:port`. The default is the same as the Consul default address, 232 `127.0.0.1:8500`. 233 234 * `driver.whitelist`: A comma seperated list of whitelisted drivers (e.g. 235 "docker,qemu"). If specified, drivers not in the whitelist will be disabled. 236 If the whitelist is empty, all drivers are fingerprinted and enabled where 237 applicable. 238 239 ## Atlas Options 240 241 **NOTE**: Nomad integration with Atlas is awaiting release of Atlas features 242 for Nomad support. Nomad currently only validates configuration options for 243 Atlas but does not use them. 244 See [#183](https://github.com/hashicorp/nomad/issues/183) for more details. 245 246 The following options are used to configure [Atlas](https://atlas.hashicorp.com) 247 integration and are entirely optional. 248 249 * `atlas`: The top-level config key used to contain all Atlas-related 250 configuration options. The value is a key/value map which supports the 251 following keys: 252 <br> 253 * <a id="infrastructure">`infrastructure`</a>: The Atlas infrastructure name to 254 connect this agent to. This value should be of the form 255 `<org>/<infrastructure>`, and requires a valid [token](#token) authorized on 256 the infrastructure. 257 * <a id="token">`token`</a>: The Atlas token to use for authentication. This 258 token should have access to the provided [infrastructure](#infrastructure). 259 * <a id="join">`join`</a>: A boolean indicating if the auto-join feature of 260 Atlas should be enabled. Defaults to `false`. 261 * `endpoint`: The address of the Atlas instance to connect to. Defaults to the 262 public Atlas endpoint and is only used if both 263 [infrastructure](#infrastructure) and [token](#token) are provided. 264 265 ## Command-line Options <a id="cli"></a> 266 267 A subset of the available Nomad agent configuration can optionally be passed in 268 via CLI arguments. The `agent` command accepts the following arguments: 269 270 * `alloc-dir=<path>`: Equivalent to the Client [alloc_dir](#alloc_dir) config 271 option. 272 * `-atlas=<infrastructure>`: Equivalent to the Atlas 273 [infrastructure](#infrastructure) config option. 274 * `-atlas-join`: Equivalent to the Atlas [join](#join) config option. 275 * `-atlas-token=<token>`: Equivalent to the Atlas [token](#token) config option. 276 * `-bind=<address>`: Equivalent to the [bind_addr](#bind_addr) config option. 277 * `-bootstrap-expect=<num>`: Equivalent to the 278 [bootstrap_expect](#bootstrap_expect) config option. 279 * `-client`: Enable client mode on the local agent. 280 * `-config=<path>`: Specifies the path to a configuration file or a directory of 281 configuration files to load. Can be specified multiple times. 282 * `-data-dir=<path>`: Equivalent to the [data_dir](#data_dir) config option. 283 * `-dc=<datacenter>`: Equivalent to the [datacenter](#datacenter) config option. 284 * `-dev`: Start the agent in development mode. This enables a pre-configured 285 dual-role agent (client + server) which is useful for developing or testing 286 Nomad. No other configuration is required to start the agent in this mode. 287 * `-log-level=<level>`: Equivalent to the [log_level](#log_level) config option. 288 * `-meta=<key=value>`: Equivalent to the Client [meta](#meta) config option. 289 * `-network-interface<interface>`: Equivalent to the Client 290 [network_interface](#network_interface) config option. 291 * `-network-speed<MBits>`: Equivalent to the Client 292 [network_speed](#network_speed) config option. 293 * `-node=<name>`: Equivalent to the [name](#name) config option. 294 * `-node-class=<class>`: Equivalent to the Client [node_class](#node_class) 295 config option. 296 * `-node-id=<uuid>`: Equivalent to the Client [node_id](#node_id) config option. 297 * `-region=<region>`: Equivalent to the [region](#region) config option. 298 * `-server`: Enable server mode on the local agent. 299 * `-servers=<host:port>`: Equivalent to the Client [servers](#servers) config 300 option. 301 * `-state-dir=<path>`: Equivalent to the Client [state_dir](#state_dir) config 302 option.