github.com/outbrain/consul@v1.4.5/website/source/docs/agent/options.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Configuration" 4 sidebar_current: "docs-agent-config" 5 description: |- 6 The agent has various configuration options that can be specified via the command-line or via configuration files. All of the configuration options are completely optional. Defaults are specified with their descriptions. 7 --- 8 9 # Configuration 10 11 The agent has various configuration options that can be specified via 12 the command-line or via configuration files. All of the configuration 13 options are completely optional. Defaults are specified with their 14 descriptions. 15 16 Configuration precedence is evaluated in the following order: 17 18 1. Command line arguments 19 2. Environment Variables 20 3. Configuration files 21 22 When loading configuration, Consul loads the configuration from files and 23 directories in lexical order. For example, configuration file 24 `basic_config.json` will be processed before `extra_config.json`. Configuration 25 can be in either [HCL](https://github.com/hashicorp/hcl#syntax) or JSON format. 26 Available in Consul 1.0 and later, the HCL support now requires an `.hcl` or 27 `.json` extension on all configuration files in order to specify their format. 28 29 Configuration specified later will be merged into configuration specified 30 earlier. In most cases, "merge" means that the later version will override the 31 earlier. In some cases, such as event handlers, merging appends the handlers to 32 the existing configuration. The exact merging behavior is specified for each 33 option below. 34 35 Consul also supports reloading configuration when it receives the 36 SIGHUP signal. Not all changes are respected, but those that are 37 documented below in the 38 [Reloadable Configuration](#reloadable-configuration) section. The 39 [reload command](/docs/commands/reload.html) can also be used to trigger a 40 configuration reload. 41 42 ## <a name="commandline_options"></a>Command-line Options 43 44 The options below are all specified on the command-line. 45 46 * <a name="_advertise"></a><a href="#_advertise">`-advertise`</a> - The 47 advertise address is used to change the address that we advertise to other 48 nodes in the cluster. By default, the [`-bind`](#_bind) address is advertised. 49 However, in some cases, there may be a routable address that cannot be bound. 50 This flag enables gossiping a different address to support this. If this 51 address is not routable, the node will be in a constant flapping state as 52 other nodes will treat the non-routability as a failure. In Consul 1.0 and 53 later this can be set to a 54 [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) 55 template. 56 57 * <a name="_advertise-wan"></a><a href="#_advertise-wan">`-advertise-wan`</a> - The 58 advertise WAN address is used to change the address that we advertise to server nodes 59 joining through the WAN. This can also be set on client agents when used in combination 60 with the <a href="#translate_wan_addrs">`translate_wan_addrs`</a> configuration 61 option. By default, the [`-advertise`](#_advertise) address is advertised. However, in some 62 cases all members of all datacenters cannot be on the same physical or virtual network, 63 especially on hybrid setups mixing cloud and private datacenters. This flag enables server 64 nodes gossiping through the public network for the WAN while using private VLANs for gossiping 65 to each other and their client agents, and it allows client agents to be reached at this 66 address when being accessed from a remote datacenter if the remote datacenter is configured 67 with <a href="#translate_wan_addrs">`translate_wan_addrs`</a>. In Consul 1.0 and 68 later this can be set to a 69 [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) 70 template 71 72 * <a name="_bootstrap"></a><a href="#_bootstrap">`-bootstrap`</a> - This flag is used to control if a 73 server is in "bootstrap" mode. It is important that 74 no more than one server *per* datacenter be running in this mode. Technically, a server in bootstrap mode 75 is allowed to self-elect as the Raft leader. It is important that only a single node is in this mode; 76 otherwise, consistency cannot be guaranteed as multiple nodes are able to self-elect. 77 It is not recommended to use this flag after a cluster has been bootstrapped. 78 79 * <a name="_bootstrap_expect"></a><a href="#_bootstrap_expect">`-bootstrap-expect`</a> - This flag 80 provides the number of expected servers in the datacenter. 81 Either this value should not be provided or the value must agree with other servers in 82 the cluster. When provided, Consul waits until the specified number of servers are 83 available and then bootstraps the cluster. This allows an initial leader to be elected 84 automatically. This cannot be used in conjunction with the legacy [`-bootstrap`](#_bootstrap) flag. 85 This flag requires [`-server`](#_server) mode. 86 87 * <a name="_bind"></a><a href="#_bind">`-bind`</a> - The address that should be bound to 88 for internal cluster communications. 89 This is an IP address that should be reachable by all other nodes in the cluster. 90 By default, this is "0.0.0.0", meaning Consul will bind to all addresses on 91 the local machine and will [advertise](/docs/agent/options.html#_advertise) 92 the first available private IPv4 address to the rest of the cluster. If there 93 are **multiple private IPv4 addresses** available, Consul will exit with an error 94 at startup. If you specify "[::]", Consul will 95 [advertise](/docs/agent/options.html#_advertise) the first available public 96 IPv6 address. If there are **multiple public IPv6 addresses** available, Consul 97 will exit with an error at startup. 98 Consul uses both TCP and UDP and the same port for both. If you 99 have any firewalls, be sure to allow both protocols. **In Consul 1.0 and later this can be set to a [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) template that needs to resolve to a single address.** 100 101 * <a name="_serf_wan_bind"></a><a href="#_serf_wan_bind">`-serf-wan-bind`</a> - 102 The address that should be bound to for Serf WAN gossip communications. By 103 default, the value follows the same rules as [`-bind` command-line 104 flag](#_bind), and if this is not specified, the `-bind` option is used. This 105 is available in Consul 0.7.1 and later. In Consul 1.0 and later this can be 106 set to a 107 [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) 108 template 109 110 * <a name="_serf_lan_bind"></a><a href="#_serf_lan_bind">`-serf-lan-bind`</a> - 111 The address that should be bound to for Serf LAN gossip communications. This 112 is an IP address that should be reachable by all other LAN nodes in the 113 cluster. By default, the value follows the same rules as [`-bind` command-line 114 flag](#_bind), and if this is not specified, the `-bind` option is used. This 115 is available in Consul 0.7.1 and later. In Consul 1.0 and later this can be 116 set to a 117 [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) 118 template 119 120 * <a name="_client"></a><a href="#_client">`-client`</a> - The address to which 121 Consul will bind client interfaces, including the HTTP and DNS servers. By 122 default, this is "127.0.0.1", allowing only loopback connections. In Consul 123 1.0 and later this can be set to a space-separated list of addresses to bind 124 to, or a 125 [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) 126 template that can potentially resolve to multiple addresses. 127 128 * <a name="_config_file"></a><a href="#_config_file">`-config-file`</a> - A configuration file 129 to load. For more information on 130 the format of this file, read the [Configuration Files](#configuration_files) section. 131 This option can be specified multiple times to load multiple configuration 132 files. If it is specified multiple times, configuration files loaded later 133 will merge with configuration files loaded earlier. During a config merge, 134 single-value keys (string, int, bool) will simply have their values replaced 135 while list types will be appended together. 136 137 * <a name="_config_dir"></a><a href="#_config_dir">`-config-dir`</a> - A directory of 138 configuration files to load. Consul will 139 load all files in this directory with the suffix ".json" or ".hcl". The load order 140 is alphabetical, and the the same merge routine is used as with the 141 [`config-file`](#_config_file) option above. This option can be specified multiple times 142 to load multiple directories. Sub-directories of the config directory are not loaded. 143 For more information on the format of the configuration files, see the 144 [Configuration Files](#configuration_files) section. 145 146 * <a name="_config_format"></a><a href="#_config_format">`-config-format`</a> - The format 147 of the configuration files to load. Normally, Consul detects the format of the 148 config files from the ".json" or ".hcl" extension. Setting this option to 149 either "json" or "hcl" forces Consul to interpret any file with or without 150 extension to be interpreted in that format. 151 152 * <a name="_data_dir"></a><a href="#_data_dir">`-data-dir`</a> - This flag 153 provides a data directory for the agent to store state. This is required for 154 all agents. The directory should be durable across reboots. This is especially 155 critical for agents that are running in server mode as they must be able to 156 persist cluster state. Additionally, the directory must support the use of 157 filesystem locking, meaning some types of mounted folders (e.g. VirtualBox 158 shared folders) may not be suitable. **Note:** both server and non-server 159 agents may store ACL tokens in the state in this directory so read access may 160 grant access to any tokens on servers and to any tokens used during service 161 registration on non-servers. On Unix-based platforms the files are written 162 with 0600 permissions so you should ensure only trusted processes can execute 163 as the same user as Consul. On Windows, you should ensure the directory has 164 suitable permissions configured as these will be inherited. 165 166 * <a name="_datacenter"></a><a href="#_datacenter">`-datacenter`</a> - This flag controls the datacenter in 167 which the agent is running. If not provided, 168 it defaults to "dc1". Consul has first-class support for multiple datacenters, but 169 it relies on proper configuration. Nodes in the same datacenter should be on a single 170 LAN. 171 172 * <a name="_dev"></a><a href="#_dev">`-dev`</a> - Enable development server 173 mode. This is useful for quickly starting a Consul agent with all persistence 174 options turned off, enabling an in-memory server which can be used for rapid 175 prototyping or developing against the API. In this mode, [Connect is 176 enabled](/docs/connect/configuration.html) and will by default create a new 177 root CA certificate on startup. This mode is **not** intended for production 178 use as it does not write any data to disk. The gRPC port is also defaulted to 179 `8502` in this mode. 180 181 * <a name="_disable_host_node_id"></a><a href="#_disable_host_node_id">`-disable-host-node-id`</a> - Setting 182 this to true will prevent Consul from using information from the host to generate a deterministic node ID, 183 and will instead generate a random node ID which will be persisted in the data directory. This is useful 184 when running multiple Consul agents on the same host for testing. This defaults to false in Consul prior 185 to version 0.8.5 and in 0.8.5 and later defaults to true, so you must opt-in for host-based IDs. Host-based 186 IDs are generated using https://github.com/shirou/gopsutil/tree/master/host, which is shared with HashiCorp's 187 [Nomad](https://www.nomadproject.io/), so if you opt-in to host-based IDs then Consul and Nomad will use 188 information on the host to automatically assign the same ID in both systems. 189 190 * <a name="_disable_keyring_file"></a><a href="#_disable_keyring_file">`-disable-keyring-file`</a> - If set, 191 the keyring will not be persisted to a file. Any installed keys will be lost on shutdown, and only the given 192 `-encrypt` key will be available on startup. This defaults to false. 193 194 * <a name="_dns_port"></a><a href="#_dns_port">`-dns-port`</a> - the DNS port to listen on. 195 This overrides the default port 8600. This is available in Consul 0.7 and later. 196 197 * <a name="_domain"></a><a href="#_domain">`-domain`</a> - By default, Consul responds to DNS queries 198 in the "consul." domain. This flag can be used to change that domain. All queries in this domain 199 are assumed to be handled by Consul and will not be recursively resolved. 200 201 * <a name="_enable_script_checks"></a><a 202 href="#_enable_script_checks">`-enable-script-checks`</a> This controls 203 whether [health checks that execute scripts](/docs/agent/checks.html) are 204 enabled on this agent, and defaults to `false` so operators must opt-in to 205 allowing these. This was added in Consul 0.9.0. 206 207 ~> **Security Warning:** Enabling script checks in some configurations may 208 introduce a remote execution vulnerability which is known to be targeted by 209 malware. We strongly recommend `-enable-local-script-checks` instead. See [this 210 blog post](https://www.hashicorp.com/blog/protecting-consul-from-rce-risk-in-specific-configurations) 211 for more details. 212 213 * <a name="_enable_local_script_checks"></a><a href="#_enable_local_script_checks">`-enable-local-script-checks`</a> 214 Like [`enable_script_checks`](#_enable_script_checks), but only enable them when they are defined in the local 215 configuration files. Script checks defined in HTTP API registrations will still not be allowed. 216 217 * <a name="_encrypt"></a><a href="#_encrypt">`-encrypt`</a> - Specifies the secret key to 218 use for encryption of Consul 219 network traffic. This key must be 16-bytes that are Base64-encoded. The 220 easiest way to create an encryption key is to use 221 [`consul keygen`](/docs/commands/keygen.html). All 222 nodes within a cluster must share the same encryption key to communicate. 223 The provided key is automatically persisted to the data directory and loaded 224 automatically whenever the agent is restarted. This means that to encrypt 225 Consul's gossip protocol, this option only needs to be provided once on each 226 agent's initial startup sequence. If it is provided after Consul has been 227 initialized with an encryption key, then the provided key is ignored and 228 a warning will be displayed. 229 230 * <a name="_grpc_port"></a><a href="#_grpc_port">`-grpc-port`</a> - the gRPC API 231 port to listen on. Default -1 (gRPC disabled). See [ports](#ports) 232 documentation for more detail. 233 234 * <a name="_hcl"></a><a href="#_hcl">`-hcl`</a> - A HCL configuration fragment. 235 This HCL configuration fragment is appended to the configuration and allows 236 to specify the full range of options of a config file on the command line. 237 This option can be specified multiple times. This was added in Consul 1.0. 238 239 * <a name="_http_port"></a><a href="#_http_port">`-http-port`</a> - the HTTP API port to listen on. 240 This overrides the default port 8500. This option is very useful when deploying Consul 241 to an environment which communicates the HTTP port through the environment e.g. PaaS like CloudFoundry, allowing 242 you to set the port directly via a Procfile. 243 244 * <a name="_log_file"></a><a href="#_log_file">`-log-file`</a> - to redirect all the Consul agent log messages to a file. This can be specified with the complete path along with the name of the log. In case the path doesn't have the filename, the filename defaults to `consul-{timestamp}.log`. Can be combined with <a href="#_log_rotate_bytes"> -log-rotate-bytes</a> and <a href="#_log_rotate_duration"> -log-rotate-duration </a> for a fine-grained log rotation experience. 245 246 * <a name="_log_rotate_bytes"></a><a href="#_log_rotate_bytes">`-log-rotate-bytes`</a> - to specify the number of bytes that should be written to a log before it needs to be rotated. Unless specified, there is no limit to the number of bytes that can be written to a log file. 247 248 * <a name="_log_rotate_duration"></a><a href="#_log_rotate_duration">`-log-rotate-duration`</a> - to specify the maximum duration a log should be written to before it needs to be rotated. Unless specified, logs are rotated on a daily basis (24 hrs). 249 250 * <a name="_join"></a><a href="#_join">`-join`</a> - Address of another agent 251 to join upon starting up. This can be 252 specified multiple times to specify multiple agents to join. If Consul is 253 unable to join with any of the specified addresses, agent startup will 254 fail. By default, the agent won't join any nodes when it starts up. 255 Note that using 256 <a href="#retry_join">`retry_join`</a> could be more appropriate to help 257 mitigate node startup race conditions when automating a Consul cluster 258 deployment. 259 260 In Consul 1.1.0 and later this can be set to a 261 [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) 262 template 263 264 <a name="_retry_join"></a> 265 266 * `-retry-join` - Similar to [`-join`](#_join) but allows retrying a join if the 267 first attempt fails. This is useful for cases where you know the address will 268 eventually be available. The list can contain IPv4, IPv6, or DNS addresses. In 269 Consul 1.1.0 and later this can be set to a 270 [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) 271 template. If Consul is running on the non-default Serf LAN port, this must be 272 specified as well. IPv6 must use the "bracketed" syntax. If multiple values 273 are given, they are tried and retried in the order listed until the first 274 succeeds. Here are some examples: 275 276 ```sh 277 # Using a DNS entry 278 $ consul agent -retry-join "consul.domain.internal" 279 ``` 280 281 ```sh 282 # Using IPv4 283 $ consul agent -retry-join "10.0.4.67" 284 ``` 285 286 ```sh 287 # Using IPv6 288 $ consul agent -retry-join "[::1]:8301" 289 ``` 290 291 ### Cloud Auto-Joining 292 293 As of Consul 0.9.1, `retry-join` accepts a unified interface using the 294 [go-discover](https://github.com/hashicorp/go-discover) library for doing 295 automatic cluster joining using cloud metadata. For more information, see 296 the [Cloud Auto-join page](/docs/agent/cloud-auto-join.html). 297 298 ```sh 299 # Using Cloud Auto-Joining 300 $ consul agent -retry-join "provider=aws tag_key=..." 301 ``` 302 303 * <a name="_retry_interval"></a><a href="#_retry_interval">`-retry-interval`</a> - Time 304 to wait between join attempts. Defaults to 30s. 305 306 * <a name="_retry_max"></a><a href="#_retry_max">`-retry-max`</a> - The maximum number 307 of [`-join`](#_join) attempts to be made before exiting 308 with return code 1. By default, this is set to 0 which is interpreted as infinite 309 retries. 310 311 * <a name="_join_wan"></a><a href="#_join_wan">`-join-wan`</a> - Address of 312 another wan agent to join upon starting up. This can be specified multiple 313 times to specify multiple WAN agents to join. If Consul is unable to join with 314 any of the specified addresses, agent startup will fail. By default, the agent 315 won't [`-join-wan`](#_join_wan) any nodes when it starts up. 316 317 In Consul 1.1.0 and later this can be set to a 318 [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) 319 template. 320 321 * <a name="_retry_join_wan"></a><a href="#_retry_join_wan">`-retry-join-wan`</a> - Similar 322 to [`retry-join`](#_retry_join) but allows retrying a wan join if the first attempt fails. 323 This is useful for cases where we know the address will become available eventually. 324 As of Consul 0.9.3 [Cloud Auto-Joining](#cloud-auto-joining) is supported as well. 325 326 In Consul 1.1.0 and later this can be set to a 327 [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) 328 template 329 330 * <a name="_retry_interval_wan"></a><a href="#_retry_interval_wan">`-retry-interval-wan`</a> - Time 331 to wait between [`-join-wan`](#_join_wan) attempts. 332 Defaults to 30s. 333 334 * <a name="_retry_max_wan"></a><a href="#_retry_max_wan">`-retry-max-wan`</a> - The maximum 335 number of [`-join-wan`](#_join_wan) attempts to be made before exiting with return code 1. 336 By default, this is set to 0 which is interpreted as infinite retries. 337 338 * <a name="_log_level"></a><a href="#_log_level">`-log-level`</a> - The level of logging to 339 show after the Consul agent has started. This defaults to "info". The available log levels are 340 "trace", "debug", "info", "warn", and "err". You can always connect to an 341 agent via [`consul monitor`](/docs/commands/monitor.html) and use any log level. Also, the 342 log level can be changed during a config reload. 343 344 * <a name="_node"></a><a href="#_node">`-node`</a> - The name of this node in the cluster. 345 This must be unique within the cluster. By default this is the hostname of the machine. 346 347 * <a name="_node_id"></a><a href="#_node_id">`-node-id`</a> - Available in Consul 0.7.3 and later, this 348 is a unique identifier for this node across all time, even if the name of the node or address 349 changes. This must be in the form of a hex string, 36 characters long, such as 350 `adf4238a-882b-9ddc-4a9d-5b6758e4159e`. If this isn't supplied, which is the most common case, then 351 the agent will generate an identifier at startup and persist it in the <a href="#_data_dir">data directory</a> 352 so that it will remain the same across agent restarts. Information from the host will be used to 353 generate a deterministic node ID if possible, unless [`-disable-host-node-id`](#_disable_host_node_id) is 354 set to true. 355 356 * <a name="_node_meta"></a><a href="#_node_meta">`-node-meta`</a> - Available in Consul 0.7.3 and later, 357 this specifies an arbitrary metadata key/value pair to associate with the node, of the form `key:value`. 358 This can be specified multiple times. Node metadata pairs have the following restrictions: 359 - A maximum of 64 key/value pairs can be registered per node. 360 - Metadata keys must be between 1 and 128 characters (inclusive) in length 361 - Metadata keys must contain only alphanumeric, `-`, and `_` characters. 362 - Metadata keys must not begin with the `consul-` prefix; that is reserved for internal use by Consul. 363 - Metadata values must be between 0 and 512 (inclusive) characters in length. 364 - Metadata values for keys beginning with `rfc1035-` are encoded verbatim in DNS TXT requests, otherwise 365 the metadata kv-pair is encoded according [RFC1464](https://www.ietf.org/rfc/rfc1464.txt). 366 367 * <a name="_pid_file"></a><a href="#_pid_file">`-pid-file`</a> - This flag provides the file 368 path for the agent to store its PID. This is useful for sending signals (for example, `SIGINT` 369 to close the agent or `SIGHUP` to update check definite 370 371 * <a name="_protocol"></a><a href="#_protocol">`-protocol`</a> - The Consul protocol version to 372 use. This defaults to the latest version. This should be set only when [upgrading](/docs/upgrading.html). 373 You can view the protocol versions supported by Consul by running `consul -v`. 374 375 * <a name="_raft_protocol"></a><a href="#_raft_protocol">`-raft-protocol`</a> - This controls the internal 376 version of the Raft consensus protocol used for server communications. This must be set to 3 in order to 377 gain access to Autopilot features, with the exception of [`cleanup_dead_servers`](#cleanup_dead_servers). 378 Defaults to 3 in Consul 1.0.0 and later (defaulted to 2 previously). See 379 [Raft Protocol Version Compatibility](/docs/upgrade-specific.html#raft-protocol-version-compatibility) 380 for more details. 381 382 * <a name="_raft_snapshot_threshold"></a><a href="#_raft_snapshot_threshold">`-raft-snapshot-threshold`</a> - This controls the 383 minimum number of raft commit entries between snapshots that are saved to disk. This is a low-level parameter that should 384 rarely need to be changed. Very busy clusters experiencing excessive disk IO may increase this value to reduce disk IO, and minimize 385 the chances of all servers taking snapshots at the same time. Increasing this trades off disk IO for disk space since the log will 386 grow much larger and the space in the raft.db file can't be reclaimed till the next snapshot. Servers may take longer to recover from 387 crashes or failover if this is increased significantly as more logs will need to be replayed. In Consul 1.1.0 and later this 388 defaults to 16384, and in prior versions it was set to 8192. 389 390 * <a name="_raft_snapshot_interval"></a><a href="#_raft_snapshot_interval">`-raft-snapshot-interval`</a> - This controls how often servers 391 check if they need to save a snapshot to disk. his is a low-level parameter that should rarely need to be changed. Very busy clusters 392 experiencing excessive disk IO may increase this value to reduce disk IO, and minimize the chances of all servers taking snapshots at the same time. 393 Increasing this trades off disk IO for disk space since the log will grow much larger and the space in the raft.db file can't be reclaimed 394 till the next snapshot. Servers may take longer to recover from crashes or failover if this is increased significantly as more logs 395 will need to be replayed. In Consul 1.1.0 and later this defaults to `30s`, and in prior versions it was set to `5s`. 396 397 * <a name="_recursor"></a><a href="#_recursor">`-recursor`</a> - Specifies the address of an upstream DNS 398 server. This option may be provided multiple times, and is functionally 399 equivalent to the [`recursors` configuration option](#recursors). 400 401 * <a name="_rejoin"></a><a href="#_rejoin">`-rejoin`</a> - When provided, Consul will ignore a 402 previous leave and attempt to rejoin the cluster when starting. By default, Consul treats leave 403 as a permanent intent and does not attempt to join the cluster again when starting. This flag 404 allows the previous state to be used to rejoin the cluster. 405 406 * <a name="_segment"></a><a href="#_segment">`-segment`</a> - (Enterprise-only) This flag is used to set 407 the name of the network segment the agent belongs to. An agent can only join and communicate with other agents 408 within its network segment. See the [Network Segments Guide](/docs/guides/segments.html) for more details. 409 By default, this is an empty string, which is the default network segment. 410 411 * <a name="_serf_lan_port"></a><a href="#_serf_lan_port">`-serf-lan-port`</a> - the Serf LAN port to listen on. 412 This overrides the default Serf LAN port 8301. This is available in Consul 1.2.2 and later. 413 414 * <a name="_serf_wan_port"></a><a href="#_serf_wan_port">`-serf-wan-port`</a> - the Serf WAN port to listen on. 415 This overrides the default Serf WAN port 8302. This is available in Consul 1.2.2 and later. 416 417 * <a name="_server"></a><a href="#_server">`-server`</a> - This flag is used to control if an 418 agent is in server or client mode. When provided, 419 an agent will act as a Consul server. Each Consul cluster must have at least one server and ideally 420 no more than 5 per datacenter. All servers participate in the Raft consensus algorithm to ensure that 421 transactions occur in a consistent, linearizable manner. Transactions modify cluster state, which 422 is maintained on all server nodes to ensure availability in the case of node failure. Server nodes also 423 participate in a WAN gossip pool with server nodes in other datacenters. Servers act as gateways 424 to other datacenters and forward traffic as appropriate. 425 426 * <a name="_server_port"></a><a href="#_server_port">`-server-port`</a> - the server RPC port to listen on. 427 This overrides the default server RPC port 8300. This is available in Consul 1.2.2 and later. 428 429 * <a name="_non_voting_server"></a><a href="#_non_voting_server">`-non-voting-server`</a> - (Enterprise-only) 430 This flag is used to make the server not participate in the Raft quorum, and have it only receive the data 431 replication stream. This can be used to add read scalability to a cluster in cases where a high volume of 432 reads to servers are needed. 433 434 * <a name="_syslog"></a><a href="#_syslog">`-syslog`</a> - This flag enables logging to syslog. This 435 is only supported on Linux and OSX. It will result in an error if provided on Windows. 436 437 * <a name="_ui"></a><a href="#_ui">`-ui`</a> - Enables the built-in web UI 438 server and the required HTTP routes. This eliminates the need to maintain the 439 Consul web UI files separately from the binary. 440 441 * <a name="_ui_dir"></a><a href="#_ui_dir">`-ui-dir`</a> - This flag provides the directory containing 442 the Web UI resources for Consul. This will automatically enable the Web UI. The directory must be 443 readable to the agent. Starting with Consul version 0.7.0 and later, the Web UI assets are included in the binary so this flag is no longer necessary; specifying only the `-ui` flag is enough to enable the Web UI. Specifying both the '-ui' and '-ui-dir' flags will result in an error. 444 445 ## <a name="configuration_files"></a>Configuration Files 446 447 In addition to the command-line options, configuration can be put into 448 files. This may be easier in certain situations, for example when Consul is 449 being configured using a configuration management system. 450 451 The configuration files are JSON formatted, making them easily readable 452 and editable by both humans and computers. The configuration is formatted 453 as a single JSON object with configuration within it. 454 455 Configuration files are used for more than just setting up the agent, 456 they are also used to provide check and service definitions. These are used 457 to announce the availability of system servers to the rest of the cluster. 458 They are documented separately under [check configuration](/docs/agent/checks.html) and 459 [service configuration](/docs/agent/services.html) respectively. The service and check 460 definitions support being updated during a reload. 461 462 #### Example Configuration File 463 464 ```javascript 465 { 466 "datacenter": "east-aws", 467 "data_dir": "/opt/consul", 468 "log_level": "INFO", 469 "node_name": "foobar", 470 "server": true, 471 "watches": [ 472 { 473 "type": "checks", 474 "handler": "/usr/bin/health-check-handler.sh" 475 } 476 ], 477 "telemetry": { 478 "statsite_address": "127.0.0.1:2180" 479 } 480 } 481 ``` 482 483 #### Example Configuration File, with TLS 484 485 ```javascript 486 { 487 "datacenter": "east-aws", 488 "data_dir": "/opt/consul", 489 "log_level": "INFO", 490 "node_name": "foobar", 491 "server": true, 492 "addresses": { 493 "https": "0.0.0.0" 494 }, 495 "ports": { 496 "https": 8501 497 }, 498 "key_file": "/etc/pki/tls/private/my.key", 499 "cert_file": "/etc/pki/tls/certs/my.crt", 500 "ca_file": "/etc/pki/tls/certs/ca-bundle.crt" 501 } 502 ``` 503 504 See, especially, the use of the `ports` setting: 505 506 ```javascript 507 "ports": { 508 "https": 8501 509 } 510 ``` 511 512 Consul will not enable TLS for the HTTP API unless the `https` port has been 513 assigned a port number `> 0`. We recommend using `8501` for `https` as this 514 default will automatically work with some tooling. 515 516 #### Configuration Key Reference 517 518 * <a name="acl"></a><a href="#acl">`acl`</a> - This object allows a number 519 of sub-keys to be set which controls the ACL system. Configuring the 520 ACL system within the ACL stanza was added in Consul 1.4.0 521 522 The following sub-keys are available: 523 524 * <a name="acl_enabled"></a><a href="#acl_enabled">`enabled`</a> - Enables ACLs. 525 526 * <a name="acl_policy_ttl"></a><a href="#acl_policy_ttl">`policy_ttl`</a> - Used to control 527 Time-To-Live caching of ACL policies. By default, this is 30 seconds. This setting has a 528 major performance impact: reducing it will cause more frequent refreshes while increasing 529 it reduces the number of refreshes. However, because the caches are not actively invalidated, 530 ACL policy may be stale up to the TTL value. 531 532 * <a name="acl_token_ttl"></a><a href="#acl_token_ttl">`token_ttl`</a> - Used to control 533 Time-To-Live caching of ACL tokens. By default, this is 30 seconds. This setting has a 534 major performance impact: reducing it will cause more frequent refreshes while increasing 535 it reduces the number of refreshes. However, because the caches are not actively invalidated, 536 ACL token may be stale up to the TTL value. 537 538 * <a name="acl_down_policy"></a><a href="#acl_down_policy">`down_policy`</a> - Either 539 "allow", "deny", "extend-cache" or "async-cache"; "extend-cache" is the default. In the case that a 540 policy or token cannot be read from the [`primary_datacenter`](#primary_datacenter) or leader 541 node, the down policy is applied. In "allow" mode, all actions are permitted, "deny" restricts 542 all operations, and "extend-cache" allows any cached objects to be used, ignoring their TTL 543 values. If a non-cached ACL is used, "extend-cache" acts like "deny". 544 The value "async-cache" acts the same way as "extend-cache" but performs updates 545 asynchronously when ACL is present but its TTL is expired, thus, if latency is bad between 546 the primary and secondary datacenters, latency of operations is not impacted. 547 548 * <a name="acl_default_policy"></a><a href="#acl_default_policy">`default_policy`</a> - Either 549 "allow" or "deny"; defaults to "allow" but this will be changed in a future major release. 550 The default policy controls the behavior of a token when there is no matching rule. In "allow" mode, 551 ACLs are a blacklist: any operation not specifically prohibited is allowed. In "deny" mode, ACLs are 552 a whitelist: any operation not specifically allowed is blocked. *Note*: this will not take effect until 553 you've enabled ACLs. 554 555 * <a name="acl_enable_key_list"></a><a href="#acl_enable_key_list">`enable_key_list`</a> - Either "enabled" or "disabled", defaults to "disabled". When enabled, the `list` permission will be required on the prefix being recursively read from the KV store. Regardless of being enabled, the full set of KV entries under the prefix will be filtered to remove any entries that the request's ACL token does not grant at least read persmissions. This option is only available in Consul 1.0 and newer. 556 557 * <a name="acl_enable_token_replication"></a><a href="#acl_enable_token_replication">`enable_token_replication`</a> - By 558 default secondary Consul datacenters will perform replication of only ACL policies. Setting this configuration will 559 also enable ACL token replication. 560 561 * <a name="acl_enable_token_persistence"></a><a href="#acl_enable_token_persistence">`enable_token_persistence`</a> - Either 562 `true` or `false`. When `true` tokens set using the API will be persisted to disk and reloaded when an agent restarts. 563 564 * <a name="acl_tokens"></a><a href="#acl_tokens">`tokens`</a> - This object holds 565 all of the configured ACL tokens for the agents usage. 566 567 * <a name="acl_tokens_master"></a><a href="#acl_tokens_master">`master`</a> - Only used 568 for servers in the [`primary_datacenter`](#primary_datacenter). This token will be created with management-level 569 permissions if it does not exist. It allows operators to bootstrap the ACL system 570 with a token Secret ID that is well-known. 571 <br/><br/> 572 The `master` token is only installed when a server acquires cluster leadership. If 573 you would like to install or change the `acl_master_token`, set the new value for `master` 574 in the configuration for all servers. Once this is done, restart the current leader to force a 575 leader election. If the `master` token is not supplied, then the servers do not create a master 576 token. When you provide a value, it should be a UUID. To maintain backwards compatibility 577 and an upgrade path this restriction is not currently enforced but will be in a future major 578 Consul release. 579 580 * <a name="acl_tokens_default"></a><a href="#acl_tokens_default">`default`</a> - When provided, 581 the agent will use this token when making requests to the Consul servers. Clients can 582 override this token on a per-request basis by providing the "?token" query parameter. 583 When not provided, the empty token, which maps to the 'anonymous' ACL token, is used. 584 585 * <a name="acl_tokens_agent"></a><a href="#acl_tokens_agent">`agent`</a> - Used for clients 586 and servers to perform internal operations. If this isn't specified, then the 587 <a href="#acl_tokens_default">`default`</a> will be used. 588 <br/><br/> 589 This token must at least have write access to the node name it will register as in order to set any 590 of the node-level information in the catalog such as metadata, or the node's tagged addresses. There 591 are other places this token is used, please see [ACL Agent Token](/docs/guides/acl.html#acl-agent-token) 592 for more details. 593 594 * <a name="acl_tokens_agent_master"></a><a href="#acl_tokens_agent_master">`agent_master`</a> - 595 Used to access <a href="/api/agent.html">agent endpoints</a> that require agent read 596 or write privileges, or node read privileges, even if Consul servers aren't present to validate 597 any tokens. This should only be used by operators during outages, regular ACL tokens should normally 598 be used by applications. 599 600 * <a name="acl_tokens_replication"></a><a href="#acl_tokens_replication">`replication`</a> - 601 The ACL token used to authorize secondary datacenters with the primary datacenter for replication 602 operations. This token is required for servers outside the [`primary_datacenter`](#primary_datacenter) when 603 ACLs are enabled. This token may be provided later using the [agent token API](/api/agent.html#update-acl-tokens) 604 on each server. This token must have at least "read" permissions on ACL data but if ACL 605 token replication is enabled then it must have "write" permissions. This also enables 606 Connect replication in Consul Enterprise, for which the token will require both operator 607 "write" and intention "read" permissions for replicating CA and Intention data. 608 609 * <a name="acl_datacenter"></a><a href="#acl_datacenter">`acl_datacenter`</a> - **This field is 610 deprecated in Consul 1.4.0. See the [`primary_datacenter`](#primary_datacenter) field instead.** 611 612 This designates the datacenter which is authoritative for ACL information. It must be provided to enable ACLs. All servers and datacenters must agree on the ACL datacenter. Setting it on the servers is all you need for cluster-level enforcement, but for the APIs to forward properly from the clients, 613 it must be set on them too. In Consul 0.8 and later, this also enables agent-level enforcement 614 of ACLs. Please see the [ACL Guide](/docs/guides/acl.html) for more details. 615 616 * <a name="acl_default_policy_legacy"></a><a href="#acl_default_policy_legacy">`acl_default_policy`</a> - **Deprecated in Consul 1.4.0. 617 See the [`acl.default_policy`](#acl_default_policy) field instead.** Either 618 "allow" or "deny"; defaults to "allow". The default policy controls the behavior of a token when 619 there is no matching rule. In "allow" mode, ACLs are a blacklist: any operation not specifically 620 prohibited is allowed. In "deny" mode, ACLs are a whitelist: any operation not 621 specifically allowed is blocked. *Note*: this will not take effect until you've set `primary_datacenter` 622 to enable ACL support. 623 624 * <a name="acl_down_policy_legacy"></a><a href="#acl_down_policy_legacy">`acl_down_policy`</a> - **Deprecated in Consul 1.4.0. 625 See the [`acl.down_policy`](#acl_down_policy) field instead.**Either 626 "allow", "deny", "extend-cache" or "async-cache"; "extend-cache" is the default. In the case that the 627 policy for a token cannot be read from the [`primary_datacenter`](#primary_datacenter) or leader 628 node, the down policy is applied. In "allow" mode, all actions are permitted, "deny" restricts 629 all operations, and "extend-cache" allows any cached ACLs to be used, ignoring their TTL 630 values. If a non-cached ACL is used, "extend-cache" acts like "deny". 631 The value "async-cache" acts the same way as "extend-cache" but performs updates 632 asynchronously when ACL is present but its TTL is expired, thus, if latency is bad between 633 ACL authoritative and other datacenters, latency of operations is not impacted. 634 635 * <a name="acl_agent_master_token_legacy"></a><a href="#acl_agent_master_token_legacy">`acl_agent_master_token`</a> - 636 **Deprecated in Consul 1.4.0. See the [`acl.tokens.agent_master`](#acl_tokens_agent_master) field instead.** 637 Used to access <a href="/api/agent.html">agent endpoints</a> that require agent read 638 or write privileges, or node read privileges, even if Consul servers aren't present to validate 639 any tokens. This should only be used by operators during outages, regular ACL tokens should normally 640 be used by applications. This was added in Consul 0.7.2 and is only used when 641 <a href="#acl_enforce_version_8">`acl_enforce_version_8`</a> is set to true. Please see 642 [ACL Agent Master Token](/docs/guides/acl.html#acl-agent-master-token) for more details. 643 644 * <a name="acl_agent_token_legacy"></a><a href="#acl_agent_token_legacy">`acl_agent_token`</a> - 645 **Deprecated in Consul 1.4.0. See the [`acl.tokens.agent`](#acl_tokens_agent) field instead.** 646 Used for clients and servers to perform internal operations. If this isn't specified, then the 647 <a href="#acl_token">`acl_token`</a> will be used. This was added in Consul 0.7.2. 648 649 This token must at least have write access to the node name it will register as in order to set any 650 of the node-level information in the catalog such as metadata, or the node's tagged addresses. There 651 are other places this token is used, please see [ACL Agent Token](/docs/guides/acl.html#acl-agent-token) 652 for more details. 653 654 * <a name="acl_enforce_version_8"></a><a href="#acl_enforce_version_8">`acl_enforce_version_8`</a> - 655 **Deprecated in Consul 1.4.0** 656 Used for clients and servers to determine if enforcement should occur for new ACL policies being 657 previewed before Consul 0.8. Added in Consul 0.7.2, this defaults to false in versions of 658 Consul prior to 0.8, and defaults to true in Consul 0.8 and later. This helps ease the 659 transition to the new ACL features by allowing policies to be in place before enforcement begins. 660 Please see the [ACL Guide](/docs/guides/acl.html#version_8_acls) for more details. 661 662 * <a name="acl_master_token_legacy"></a><a href="#acl_master_token_legacy">`acl_master_token`</a> - 663 **Deprecated in Consul 1.4.0. See the [`acl.tokens.master`](#acl_tokens_master) field instead.** Only used 664 for servers in the [`primary_datacenter`](#primary_datacenter). This token will be created with management-level 665 permissions if it does not exist. It allows operators to bootstrap the ACL system 666 with a token ID that is well-known. 667 668 The `acl_master_token` is only installed when a server acquires cluster leadership. If 669 you would like to install or change the `acl_master_token`, set the new value for `acl_master_token` 670 in the configuration for all servers. Once this is done, restart the current leader to force a 671 leader election. If the `acl_master_token` is not supplied, then the servers do not create a master 672 token. When you provide a value, it can be any string value. Using a UUID would ensure that it looks 673 the same as the other tokens, but isn't strictly necessary. 674 675 * <a name="acl_replication_token_legacy"></a><a href="#acl_replication_token_legacy">`acl_replication_token`</a> - 676 **Deprecated in Consul 1.4.0. See the [`acl.tokens.replication`](#acl_tokens_replication) field instead.** 677 Only used for servers outside the [`primary_datacenter`](#primary_datacenter) running Consul 0.7 or later. 678 When provided, this will enable [ACL replication](/docs/guides/acl.html#replication) using this 679 token to retrieve and replicate the ACLs to the non-authoritative local datacenter. In Consul 0.9.1 680 and later you can enable ACL replication using [`enable_acl_replication`](#enable_acl_replication) 681 and then set the token later using the [agent token API](/api/agent.html#update-acl-tokens) on each 682 server. If the `acl_replication_token` is set in the config, it will automatically set 683 [`enable_acl_replication`](#enable_acl_replication) to true for backward compatibility. 684 685 If there's a partition or other outage affecting the authoritative datacenter, and the 686 [`acl_down_policy`](/docs/agent/options.html#acl_down_policy) is set to "extend-cache", tokens not 687 in the cache can be resolved during the outage using the replicated set of ACLs. Please see the 688 [ACL Guide](/docs/guides/acl.html#replication) replication section for more details. 689 690 * <a name="acl_token_legacy"></a><a href="#acl_token_legacy">`acl_token`</a> - 691 **Deprecated in Consul 1.4.0. See the [`acl.tokens.default`](#acl_tokens_default) field instead.** 692 When provided, the agent will use this 693 token when making requests to the Consul servers. Clients can override this token on a per-request 694 basis by providing the "?token" query parameter. When not provided, the empty token, which maps to 695 the 'anonymous' ACL policy, is used. 696 697 * <a name="acl_ttl_legacy"></a><a href="#acl_ttl_legacy">`acl_ttl`</a> - 698 **Deprecated in Consul 1.4.0. See the [`acl.token_ttl`](#acl_token_ttl) field instead.**Used to control Time-To-Live caching of ACLs. 699 By default, this is 30 seconds. This setting has a major performance impact: reducing it will cause 700 more frequent refreshes while increasing it reduces the number of refreshes. However, because the caches 701 are not actively invalidated, ACL policy may be stale up to the TTL value. 702 703 * <a name="addresses"></a><a href="#addresses">`addresses`</a> - This is a nested object that allows 704 setting bind addresses. In Consul 1.0 and later these can be set to a space-separated list of 705 addresses to bind to, or a [go-sockaddr](https://godoc.org/github.com/hashicorp/go-sockaddr/template) 706 template that can potentially resolve to multiple addresses. 707 708 `http`, `https` and `grpc` all support binding to a Unix domain socket. A 709 socket can be specified in the form `unix:///path/to/socket`. A new domain 710 socket will be created at the given path. If the specified file path already 711 exists, Consul will attempt to clear the file and create the domain socket 712 in its place. The permissions of the socket file are tunable via the 713 [`unix_sockets` config construct](#unix_sockets). 714 715 When running Consul agent commands against Unix socket interfaces, use the 716 `-http-addr` argument to specify the path to the socket. You can also place 717 the desired values in the `CONSUL_HTTP_ADDR` environment variable. 718 719 For TCP addresses, the environment variable value should be an IP address 720 _with the port_. For example: `10.0.0.1:8500` and not `10.0.0.1`. However, 721 ports are set separately in the <a href="#ports">`ports`</a> structure when 722 defining them in a configuration file. 723 724 The following keys are valid: 725 - `dns` - The DNS server. Defaults to `client_addr` 726 - `http` - The HTTP API. Defaults to `client_addr` 727 - `https` - The HTTPS API. Defaults to `client_addr` 728 - `grpc` - The gRPC API. Defaults to `client_addr` 729 730 * <a name="advertise_addr"></a><a href="#advertise_addr">`advertise_addr`</a> Equivalent to 731 the [`-advertise` command-line flag](#_advertise). 732 733 * <a name="serf_wan"></a><a href="#serf_wan_bind">`serf_wan`</a> Equivalent to 734 the [`-serf-wan-bind` command-line flag](#_serf_wan_bind). 735 736 * <a name="serf_lan"></a><a href="#serf_lan_bind">`serf_lan`</a> Equivalent to 737 the [`-serf-lan-bind` command-line flag](#_serf_lan_bind). 738 739 * <a name="advertise_addr_wan"></a><a href="#advertise_addr_wan">`advertise_addr_wan`</a> Equivalent to 740 the [`-advertise-wan` command-line flag](#_advertise-wan). 741 742 * <a name="autopilot"></a><a href="#autopilot">`autopilot`</a> Added in Consul 0.8, this object 743 allows a number of sub-keys to be set which can configure operator-friendly settings for Consul servers. 744 For more information about Autopilot, see the [Autopilot Guide](/docs/guides/autopilot.html). 745 746 The following sub-keys are available: 747 748 * <a name="cleanup_dead_servers"></a><a href="#cleanup_dead_servers">`cleanup_dead_servers`</a> - This controls 749 the automatic removal of dead server nodes periodically and whenever a new server is added to the cluster. 750 Defaults to `true`. 751 752 * <a name="last_contact_threshold"></a><a href="#last_contact_threshold">`last_contact_threshold`</a> - Controls 753 the maximum amount of time a server can go without contact from the leader before being considered unhealthy. 754 Must be a duration value such as `10s`. Defaults to `200ms`. 755 756 * <a name="max_trailing_logs"></a><a href="#max_trailing_logs">`max_trailing_logs`</a> - Controls 757 the maximum number of log entries that a server can trail the leader by before being considered unhealthy. Defaults 758 to 250. 759 760 * <a name="server_stabilization_time"></a><a href="#server_stabilization_time">`server_stabilization_time`</a> - 761 Controls the minimum amount of time a server must be stable in the 'healthy' state before being added to the 762 cluster. Only takes effect if all servers are running Raft protocol version 3 or higher. Must be a duration value 763 such as `30s`. Defaults to `10s`. 764 765 * <a name="redundancy_zone_tag"></a><a href="#redundancy_zone_tag">`redundancy_zone_tag`</a> - (Enterprise-only) 766 This controls the [`-node-meta`](#_node_meta) key to use when Autopilot is separating servers into zones for 767 redundancy. Only one server in each zone can be a voting member at one time. If left blank (the default), this 768 feature will be disabled. 769 770 * <a name="disable_upgrade_migration"></a><a href="#disable_upgrade_migration">`disable_upgrade_migration`</a> - (Enterprise-only) 771 If set to `true`, this setting will disable Autopilot's upgrade migration strategy in Consul Enterprise of waiting 772 until enough newer-versioned servers have been added to the cluster before promoting any of them to voters. Defaults 773 to `false`. 774 775 * <a name="bootstrap"></a><a href="#bootstrap">`bootstrap`</a> Equivalent to the 776 [`-bootstrap` command-line flag](#_bootstrap). 777 778 * <a name="bootstrap_expect"></a><a href="#bootstrap_expect">`bootstrap_expect`</a> Equivalent 779 to the [`-bootstrap-expect` command-line flag](#_bootstrap_expect). 780 781 * <a name="bind_addr"></a><a href="#bind_addr">`bind_addr`</a> Equivalent to the 782 [`-bind` command-line flag](#_bind). 783 784 * <a name="ca_file"></a><a href="#ca_file">`ca_file`</a> This provides a file path to a PEM-encoded 785 certificate authority. The certificate authority is used to check the authenticity of client and 786 server connections with the appropriate [`verify_incoming`](#verify_incoming) or 787 [`verify_outgoing`](#verify_outgoing) flags. 788 789 * <a name="ca_path"></a><a href="#ca_path">`ca_path`</a> This provides a path to a directory of PEM-encoded 790 certificate authority files. These certificate authorities are used to check the authenticity of client and 791 server connections with the appropriate [`verify_incoming`](#verify_incoming) or 792 [`verify_outgoing`](#verify_outgoing) flags. 793 794 * <a name="cert_file"></a><a href="#cert_file">`cert_file`</a> This provides a file path to a 795 PEM-encoded certificate. The certificate is provided to clients or servers to verify the agent's 796 authenticity. It must be provided along with [`key_file`](#key_file). 797 798 * <a name="check_update_interval"></a><a href="#check_update_interval">`check_update_interval`</a> 799 This interval controls how often check output from 800 checks in a steady state is synchronized with the server. By default, this is 801 set to 5 minutes ("5m"). Many checks which are in a steady state produce 802 slightly different output per run (timestamps, etc) which cause constant writes. 803 This configuration allows deferring the sync of check output for a given interval to 804 reduce write pressure. If a check ever changes state, the new state and associated 805 output is synchronized immediately. To disable this behavior, set the value to "0s". 806 807 * <a name="client_addr"></a><a href="#client_addr">`client_addr`</a> Equivalent to the 808 [`-client` command-line flag](#_client). 809 810 * <a name="connect"></a><a href="#connect">`connect`</a> 811 This object allows setting options for the Connect feature. 812 813 The following sub-keys are available: 814 815 * <a name="connect_enabled"></a><a href="#connect_enabled">`enabled`</a> Controls whether 816 Connect features are enabled on this agent. Should be enabled on all clients and 817 servers in the cluster in order for Connect to function properly. Defaults to false. 818 819 * <a name="connect_ca_provider"></a><a href="#connect_ca_provider">`ca_provider`</a> Controls 820 which CA provider to use for Connect's CA. Currently only the `consul` and `vault` providers 821 are supported. This is only used when initially bootstrapping the cluster. For an existing 822 cluster, use the [Update CA Configuration Endpoint](/api/connect/ca.html#update-ca-configuration). 823 824 * <a name="connect_ca_config"></a><a href="#connect_ca_config">`ca_config`</a> An object which 825 allows setting different config options based on the CA provider chosen. This is only 826 used when initially bootstrapping the cluster. For an existing cluster, use the [Update CA 827 Configuration Endpoint](/api/connect/ca.html#update-ca-configuration). 828 829 The following providers are supported: 830 831 #### Consul CA Provider (`ca_provider = "consul"`) 832 833 * <a name="consul_ca_private_key"></a><a href="#consul_ca_private_key">`private_key`</a> The 834 PEM contents of the private key to use for the CA. 835 836 * <a name="consul_ca_root_cert"></a><a href="#consul_ca_root_cert">`root_cert`</a> The 837 PEM contents of the root certificate to use for the CA. 838 839 #### Vault CA Provider (`ca_provider = "vault"`) 840 841 * <a name="vault_ca_address"></a><a href="#vault_ca_address">`address`</a> The address of the Vault 842 server to connect to. 843 844 * <a name="vault_ca_token"></a><a href="#vault_ca_token">`token`</a> The Vault token to use. 845 846 * <a name="vault_ca_root_pki"></a><a href="#vault_ca_root_pki">`root_pki_path`</a> The 847 path to use for the root CA pki backend in Vault. This can be an existing backend with a CA already 848 configured, or a blank/unmounted backend in which case Connect will automatically mount/generate the CA. 849 The Vault token given above must have `sudo` access to this backend, as well as permission to mount 850 the backend at this path if it is not already mounted. 851 852 * <a name="vault_ca_intermediate_pki"></a><a href="#vault_ca_intermediate_pki">`intermediate_pki_path`</a> 853 The path to use for the temporary intermediate CA pki backend in Vault. *Connect will overwrite any data 854 at this path in order to generate a temporary intermediate CA*. The Vault token given above must have 855 `write` access to this backend, as well as permission to mount the backend at this path if it is not 856 already mounted. 857 858 #### Common CA Config Options 859 860 <p>There are also a number of common configuration options supported by all providers:</p> 861 862 * <a name="ca_leaf_cert_ttl"></a><a href="#ca_leaf_cert_ttl">`leaf_cert_ttl`</a> The upper bound on the 863 lease duration of a leaf certificate issued for a service. In most 864 cases a new leaf certificate will be requested by a proxy before this 865 limit is reached. This is also the effective limit on how long a 866 server outage can last (with no leader) before network connections 867 will start being rejected, and as a result the defaults is `72h` to 868 last through a weekend without intervention. This value cannot be 869 lower than 1 hour or higher than 1 year. 870 871 This value is also used when rotating out old root certificates from 872 the cluster. When a root certificate has been inactive (rotated out) 873 for more than twice the *current* `leaf_cert_ttl`, it will be removed 874 from the trusted list. 875 876 * <a name="ca_csr_max_per_second"></a><a 877 href="#ca_csr_max_per_second">`csr_max_per_second`</a> Sets a rate 878 limit on the maximum number of Certificate Signing Requests (CSRs) the 879 servers will accept. This is used to prevent CA rotation from causing 880 unbounded CPU usage on servers. It defaults to 50 which is 881 conservative - a 2017 Macbook can process about 100 per second using 882 only ~40% of one CPU core - but sufficient for deployments up to ~1500 883 service instances before the time it takes to rotate is impacted. For 884 larger deployments we recommend increasing this based on the expected 885 number of server instances and server resources, or use 886 `csr_max_concurrent` instead if servers have more than one core. 887 Setting this to zero disables rate limiting. Added in 1.4.1. 888 889 * <a name="ca_csr_max_concurrent"></a><a 890 href="#ca_csr_max_concurrent">`csr_max_concurrent`</a> Sets a limit 891 on how many Certificate Signing Requests will be processed 892 concurrently. Defaults to 0 (disabled). This is useful when you have 893 more than one or two cores available to the server. For example on an 894 8 core server, setting this to 1 will ensure that even during a CA 895 rotation no more than one server core on the leader will be consumed 896 at a time with generating new certificates. Setting this is 897 recommended _instead_ of `csr_max_per_second` where you know there are 898 multiple cores available since it is simpler to reason about limiting 899 CSR resources this way without artificially slowing down rotations. 900 Added in 1.4.1. 901 902 * <a name="connect_proxy"></a><a href="#connect_proxy">`proxy`</a> 903 [**Deprecated**](/docs/connect/proxies/managed-deprecated.html) This 904 object allows setting options for the Connect proxies. The following 905 sub-keys are available: 906 * <a name="connect_proxy_allow_managed_registration"></a><a 907 href="#connect_proxy_allow_managed_registration">`allow_managed_api_registration`</a> 908 [**Deprecated**](/docs/connect/proxies/managed-deprecated.html) 909 Allows managed proxies to be configured with services that are 910 registered via the Agent HTTP API. Enabling this would allow anyone 911 with permission to register a service to define a command to execute 912 for the proxy. By default, this is false to protect against 913 arbitrary process execution. 914 * <a name="connect_proxy_allow_managed_root"></a><a 915 href="#connect_proxy_allow_managed_root">`allow_managed_root`</a> 916 [**Deprecated**](/docs/connect/proxies/managed-deprecated.html) 917 Allows Consul to start managed proxies if Consul is running as root 918 (EUID of the process is zero). We recommend running Consul as a 919 non-root user. By default, this is false to protect inadvertently 920 running external processes as root. 921 * <a name="connect_proxy_defaults"></a><a 922 href="#connect_proxy_defaults">`proxy_defaults`</a> 923 [**Deprecated**](/docs/connect/proxies/managed-deprecated.html) This 924 object configures the default proxy settings for service definitions 925 with [managed proxies](/docs/connect/proxies/managed-deprecated.html) 926 (now deprecated). It accepts the fields `exec_mode`, `daemon_command`, 927 and `config`. These are used as default values for the respective 928 fields in the service definition. 929 930 * <a name="datacenter"></a><a href="#datacenter">`datacenter`</a> Equivalent to the 931 [`-datacenter` command-line flag](#_datacenter). 932 933 * <a name="data_dir"></a><a href="#data_dir">`data_dir`</a> Equivalent to the 934 [`-data-dir` command-line flag](#_data_dir). 935 936 * <a name="disable_anonymous_signature"></a><a href="#disable_anonymous_signature"> 937 `disable_anonymous_signature`</a> Disables providing an anonymous signature for de-duplication 938 with the update check. See [`disable_update_check`](#disable_update_check). 939 940 * <a name="disable_host_node_id"></a><a href="#disable_host_node_id">`disable_host_node_id`</a> 941 Equivalent to the [`-disable-host-node-id` command-line flag](#_disable_host_node_id). 942 943 * <a name="disable_http_unprintable_char_filter"></a><a href="#disable_http_unprintable_char_filter">`disable_http_unprintable_char_filter`</a> 944 Defaults to false. Consul 1.0.3 fixed a potential security vulnerability where 945 malicious users could craft KV keys with unprintable chars that would confuse 946 operators using the CLI or UI into taking wrong actions. Users who had data 947 written in older versions of Consul that did not have this restriction will be 948 unable to delete those values by default in 1.0.3 or later. This setting 949 enables those users to _temporarily_ disable the filter such that delete 950 operations can work on those keys again to get back to a healthy state. It is 951 strongly recommended that this filter is not disabled permanently as it 952 exposes the original security vulnerability. 953 954 * <a name="disable_remote_exec"></a><a href="#disable_remote_exec">`disable_remote_exec`</a> 955 Disables support for remote execution. When set to true, the agent will ignore any incoming 956 remote exec requests. In versions of Consul prior to 0.8, this defaulted to false. In Consul 957 0.8 the default was changed to true, to make remote exec opt-in instead of opt-out. 958 959 * <a name="disable_update_check"></a><a href="#disable_update_check">`disable_update_check`</a> 960 Disables automatic checking for security bulletins and new version releases. This is disabled in 961 Consul Enterprise. 962 963 * <a name="discard_check_output"></a><a href="#discard_check_output">`discard_check_output`</a> 964 Discards the output of health checks before storing them. This reduces the number of writes 965 to the Consul raft log in environments where health checks have volatile output like 966 timestamps, process ids, ... 967 968 * <a name="discovery_max_stale"></a><a href="#discovery_max_stale">`discovery_max_stale`</a> - Enables 969 stale requests for all service discovery HTTP endpoints. This is equivalent to the 970 [`max_stale`](#max_stale) configuration for DNS requests. If this value is zero (default), all service 971 discovery HTTP endpoints are forwarded to the leader. If this value is greater than zero, any Consul server 972 can handle the service discovery request. If a Consul server is behind the leader by more than `discovery_max_stale`, 973 the query will be re-evaluated on the leader to get more up-to-date results. Consul agents also add a new 974 `X-Consul-Effective-Consistency` response header which indicates if the agent did a stale read. `discover-max-stale` 975 was introduced in Consul 1.0.7 as a way for Consul operators to force stale requests from clients at the agent level, 976 and defaults to zero which matches default consistency behavior in earlier Consul versions. 977 978 * <a name="dns_config"></a><a href="#dns_config">`dns_config`</a> This object allows a number 979 of sub-keys to be set which can tune how DNS queries are serviced. See this guide on 980 [DNS caching](/docs/guides/dns-cache.html) for more detail. 981 982 The following sub-keys are available: 983 984 * <a name="allow_stale"></a><a href="#allow_stale">`allow_stale`</a> - Enables a stale query 985 for DNS information. This allows any Consul server, rather than only the leader, to service 986 the request. The advantage of this is you get linear read scalability with Consul servers. 987 In versions of Consul prior to 0.7, this defaulted to false, meaning all requests are serviced 988 by the leader, providing stronger consistency but less throughput and higher latency. In Consul 989 0.7 and later, this defaults to true for better utilization of available servers. 990 991 * <a name="max_stale"></a><a href="#max_stale">`max_stale`</a> - When [`allow_stale`](#allow_stale) 992 is specified, this is used to limit how stale results are allowed to be. If a Consul server is 993 behind the leader by more than `max_stale`, the query will be re-evaluated on the leader to get 994 more up-to-date results. Prior to Consul 0.7.1 this defaulted to 5 seconds; in Consul 0.7.1 995 and later this defaults to 10 years ("87600h") which effectively allows DNS queries to be answered 996 by any server, no matter how stale. In practice, servers are usually only milliseconds behind the 997 leader, so this lets Consul continue serving requests in long outage scenarios where no leader can 998 be elected. 999 1000 * <a name="node_ttl"></a><a href="#node_ttl">`node_ttl`</a> - By default, this is "0s", so all 1001 node lookups are served with a 0 TTL value. DNS caching for node lookups can be enabled by 1002 setting this value. This should be specified with the "s" suffix for second or "m" for minute. 1003 1004 * <a name="service_ttl"></a><a href="#service_ttl">`service_ttl`</a> - This is a sub-object 1005 which allows for setting a TTL on service lookups with a per-service policy. The "*" wildcard 1006 service can be used when there is no specific policy available for a service. By default, all 1007 services are served with a 0 TTL value. DNS caching for service lookups can be enabled by 1008 setting this value. 1009 1010 * <a name="enable_truncate"></a><a href="#enable_truncate">`enable_truncate`</a> - If set to 1011 true, a UDP DNS query that would return more than 3 records, or more than would fit into a valid 1012 UDP response, will set the truncated flag, indicating to clients that they should re-query 1013 using TCP to get the full set of records. 1014 1015 * <a name="only_passing"></a><a href="#only_passing">`only_passing`</a> - If set to true, any 1016 nodes whose health checks are warning or critical will be excluded from DNS results. If false, 1017 the default, only nodes whose healthchecks are failing as critical will be excluded. For 1018 service lookups, the health checks of the node itself, as well as the service-specific checks 1019 are considered. For example, if a node has a health check that is critical then all services on 1020 that node will be excluded because they are also considered critical. 1021 1022 * <a name="recursor_timeout"></a><a href="#recursor_timeout">`recursor_timeout`</a> - Timeout used 1023 by Consul when recursively querying an upstream DNS server. See <a href="#recursors">`recursors`</a> 1024 for more details. Default is 2s. This is available in Consul 0.7 and later. 1025 1026 * <a name="disable_compression"></a><a href="#disable_compression">`disable_compression`</a> - If 1027 set to true, DNS responses will not be compressed. Compression was added and enabled by default 1028 in Consul 0.7. 1029 1030 * <a name="udp_answer_limit"></a><a href="#udp_answer_limit">`udp_answer_limit`</a> - Limit the number of 1031 resource records contained in the answer section of a UDP-based DNS 1032 response. This parameter applies only to UDP DNS queries that are less than 512 bytes. This setting is deprecated 1033 and replaced in Consul 1.0.7 by <a href="#a_record_limit">`a_record_limit`</a>. 1034 1035 * <a name="a_record_limit"></a><a href="#a_record_limit">`a_record_limit`</a> - Limit the number of 1036 resource records contained in the answer section of a A, AAAA or ANY DNS response (both TCP and UDP). 1037 When answering a question, Consul will use the complete list of 1038 matching hosts, shuffle the list randomly, and then limit the number of 1039 answers to `a_record_limit` (default: no limit). This limit does not apply to SRV records. 1040 1041 In environments where [RFC 3484 Section 6](https://tools.ietf.org/html/rfc3484#section-6) Rule 9 1042 is implemented and enforced (i.e. DNS answers are always sorted and 1043 therefore never random), clients may need to set this value to `1` to 1044 preserve the expected randomized distribution behavior (note: 1045 [RFC 3484](https://tools.ietf.org/html/rfc3484) has been obsoleted by 1046 [RFC 6724](https://tools.ietf.org/html/rfc6724) and as a result it should 1047 be increasingly uncommon to need to change this value with modern 1048 resolvers). 1049 1050 * <a name="enable_additional_node_meta_txt"></a><a href="#enable_additional_node_meta_txt">`enable_additional_node_meta_txt`</a> - 1051 When set to true, Consul will add TXT records for Node metadata into the Additional section of the DNS responses for several 1052 query types such as SRV queries. When set to false those records are not emitted. This does not impact the behavior of those 1053 same TXT records when they would be added to the Answer section of the response like when querying with type TXT or ANY. This 1054 defaults to true. 1055 1056 * <a name="soa"></a><a href="#soa">`soa`</a> Allow to tune the setting set up in SOA. 1057 Non specified values fallback to their default values, all values are integers and 1058 expressed as seconds. 1059 <br/><br/> 1060 The following settings are available: 1061 1062 * <a name="soa_expire"></a><a href="#soa_expire">`expire`</a> - 1063 Configure SOA Expire duration in seconds, default value is 86400, ie: 24 hours. 1064 1065 * <a name="soa_min_ttl"></a><a href="#soa_min_ttl">`min_ttl`</a> - 1066 Configure SOA DNS minimum TTL. 1067 As explained in [RFC-2308](https://tools.ietf.org/html/rfc2308) this also controls 1068 negative cache TTL in most implementations. Default value is 0, ie: no minimum 1069 delay or negative TTL. 1070 1071 * <a name="soa_refresh"></a><a href="#soa_refresh">`refresh`</a> - 1072 Configure SOA Refresh duration in seconds, default value is `3600`, ie: 1 hour. 1073 1074 * <a name="soa_retry"></a><a href="#soa_retry">`retry`</a> - 1075 Configures the Retry duration expressed in seconds, default value is 1076 600, ie: 10 minutes. 1077 1078 * <a name="dns_use_cache"></a><a href="#dns_use_cache">`use_cache`</a> - When set to true, DNS resolution will use the agent cache described 1079 in [agent caching](/api/index.html#agent-caching). This setting affects all service and prepared queries DNS requests. Implies [`allow_stale`](#allow_stale) 1080 1081 * <a name="dns_cache_max_age"></a><a href="#dns_cache_max_age">`cache_max_age`</a> - When [use_cache](#dns_use_cache) is enabled, the agent 1082 will attempt to re-fetch the result from the servers if the cached value is older than this duration. See: [agent caching](/api/index.html#agent-caching). 1083 1084 * <a name="domain"></a><a href="#domain">`domain`</a> Equivalent to the 1085 [`-domain` command-line flag](#_domain). 1086 1087 * <a name="enable_acl_replication"></a><a href="#enable_acl_replication">`enable_acl_replication`</a> When 1088 set on a Consul server, enables [ACL replication](/docs/guides/acl.html#replication) without having to set 1089 the replication token via [`acl_replication_token`](#acl_replication_token). Instead, enable ACL replication 1090 and then introduce the token using the [agent token API](/api/agent.html#update-acl-tokens) on each server. 1091 See [`acl_replication_token`](#acl_replication_token) for more details. 1092 1093 * <a name="enable_agent_tls_for_checks"></a><a href="#enable_agent_tls_for_checks">`enable_agent_tls_for_checks`</a> 1094 When set, uses a subset of the agent's TLS configuration (`key_file`, `cert_file`, `ca_file`, `ca_path`, and 1095 `server_name`) to set up the client for HTTP or gRPC health checks. This allows services requiring 2-way TLS to 1096 be checked using the agent's credentials. This was added in Consul 1.0.1 and defaults to false. 1097 1098 * <a name="enable_debug"></a><a href="#enable_debug">`enable_debug`</a> When set, enables some 1099 additional debugging features. Currently, this is only used to access runtime profiling HTTP endpoints, which 1100 are available with an `operator:read` ACL regardles of the value of `enable_debug`. 1101 1102 * <a name="enable_script_checks"></a><a href="#enable_script_checks">`enable_script_checks`</a> Equivalent to the 1103 [`-enable-script-checks` command-line flag](#_enable_script_checks). 1104 1105 ~> **Security Warning:** Enabling script checks in some configurations may 1106 introduce a remote execution vulnerability which is known to be targeted by 1107 malware. We strongly recommend `enable_local_script_checks` instead. See [this 1108 blog post](https://www.hashicorp.com/blog/protecting-consul-from-rce-risk-in-specific-configurations) 1109 for more details. 1110 1111 * <a name="enable_local_script_checks"></a><a href="#enable_local_script_checks">`enable_local_script_checks`</a> Equivalent to the 1112 [`-enable-local-script-checks` command-line flag](#_enable_local_script_checks). 1113 1114 * <a name="enable_syslog"></a><a href="#enable_syslog">`enable_syslog`</a> Equivalent to 1115 the [`-syslog` command-line flag](#_syslog). 1116 1117 * <a name="encrypt"></a><a href="#encrypt">`encrypt`</a> Equivalent to the 1118 [`-encrypt` command-line flag](#_encrypt). 1119 1120 * <a name="encrypt_verify_incoming"></a><a href="#encrypt_verify_incoming">`encrypt_verify_incoming`</a> - 1121 This is an optional parameter that can be used to disable enforcing encryption for incoming gossip in order 1122 to upshift from unencrypted to encrypted gossip on a running cluster. See [this section] 1123 (/docs/agent/encryption.html#configuring-gossip-encryption-on-an-existing-cluster) for more information. 1124 Defaults to true. 1125 1126 * <a name="encrypt_verify_outgoing"></a><a href="#encrypt_verify_outgoing">`encrypt_verify_outgoing`</a> - 1127 This is an optional parameter that can be used to disable enforcing encryption for outgoing gossip in order 1128 to upshift from unencrypted to encrypted gossip on a running cluster. See [this section] 1129 (/docs/agent/encryption.html#configuring-gossip-encryption-on-an-existing-cluster) for more information. 1130 Defaults to true. 1131 1132 * <a name="disable_keyring_file"></a><a href="#disable_keyring_file">`disable_keyring_file`</a> - Equivalent to the 1133 [`-disable-keyring-file` command-line flag](#_disable_keyring_file). 1134 1135 * <a name="gossip_lan"></a><a href="#gossip_lan">`gossip_lan`</a> - **(Advanced)** This object contains a number of sub-keys 1136 which can be set to tune the LAN gossip communications. These are only provided for users running especially large 1137 clusters that need fine tuning and are prepared to spend significant effort correctly tuning them for their 1138 environment and workload. **Tuning these improperly can cause Consul to fail in unexpected ways**. 1139 The default values are appropriate in almost all deployments. 1140 1141 * <a name="gossip_nodes"></a><a href="#gossip_nodes">`gossip_nodes`</a> - The number of random nodes to send 1142 gossip messages to per gossip_interval. Increasing this number causes the gossip messages to propagate 1143 across the cluster more quickly at the expense of increased bandwidth. The default is 3. 1144 1145 * <a name="gossip_interval"></a><a href="#gossip_interval">`gossip_interval`</a> - The interval between sending 1146 messages that need to be gossiped that haven't been able to piggyback on probing messages. If this is set to 1147 zero, non-piggyback gossip is disabled. By lowering this value (more frequent) gossip messages are propagated 1148 across the cluster more quickly at the expense of increased bandwidth. The default is 200ms. 1149 1150 * <a name="probe_interval"></a><a href="#probe_interval">`probe_interval`</a> - The interval between random node 1151 probes. Setting this lower (more frequent) will cause the cluster to detect failed nodes more quickly 1152 at the expense of increased bandwidth usage. The default is 1s. 1153 1154 * <a name="probe_timeout"></a><a href="#probe_timeout">`probe_timeout`</a> - The timeout to wait for an ack from 1155 a probed node before assuming it is unhealthy. This should be at least the 99-percentile of RTT (round-trip time) on 1156 your network. The default is 500ms and is a conservative value suitable for almost all realistic deployments. 1157 1158 * <a name="retransmit_mult"></a><a href="#retransmit_mult">`retransmit_mult`</a> - The multiplier for the number 1159 of retransmissions that are attempted for messages broadcasted over gossip. The number of retransmits is scaled 1160 using this multiplier and the cluster size. The higher the multiplier, the more likely a failed broadcast is to 1161 converge at the expense of increased bandwidth. The default is 4. 1162 1163 * <a name="suspicion_mult"></a><a href="#suspicion_mult">`suspicion_mult`</a> - The multiplier for determining the 1164 time an inaccessible node is considered suspect before declaring it dead. The timeout is scaled with the cluster 1165 size and the probe_interval. This allows the timeout to scale properly with expected propagation delay with a 1166 larger cluster size. The higher the multiplier, the longer an inaccessible node is considered part of the 1167 cluster before declaring it dead, giving that suspect node more time to refute if it is indeed still alive. The 1168 default is 4. 1169 1170 * <a name="gossip_wan"></a><a href="#gossip_wan">`gossip_wan`</a> - **(Advanced)** This object contains a number of sub-keys 1171 which can be set to tune the WAN gossip communications. These are only provided for users running especially large 1172 clusters that need fine tuning and are prepared to spend significant effort correctly tuning them for their 1173 environment and workload. **Tuning these improperly can cause Consul to fail in unexpected ways**. 1174 The default values are appropriate in almost all deployments. 1175 1176 * <a name="gossip_nodes"></a><a href="#gossip_nodes">`gossip_nodes`</a> - The number of random nodes to send 1177 gossip messages to per gossip_interval. Increasing this number causes the gossip messages to propagate 1178 across the cluster more quickly at the expense of increased bandwidth. The default is 3. 1179 1180 * <a name="gossip_interval"></a><a href="#gossip_interval">`gossip_interval`</a> - The interval between sending 1181 messages that need to be gossiped that haven't been able to piggyback on probing messages. If this is set to 1182 zero, non-piggyback gossip is disabled. By lowering this value (more frequent) gossip messages are propagated 1183 across the cluster more quickly at the expense of increased bandwidth. The default is 200ms. 1184 1185 * <a name="probe_interval"></a><a href="#probe_interval">`probe_interval`</a> - The interval between random node 1186 probes. Setting this lower (more frequent) will cause the cluster to detect failed nodes more quickly 1187 at the expense of increased bandwidth usage. The default is 1s. 1188 1189 * <a name="probe_timeout"></a><a href="#probe_timeout">`probe_timeout`</a> - The timeout to wait for an ack from 1190 a probed node before assuming it is unhealthy. This should be at least the 99-percentile of RTT (round-trip time) on 1191 your network. The default is 500ms and is a conservative value suitable for almost all realistic deployments. 1192 1193 * <a name="retransmit_mult"></a><a href="#retransmit_mult">`retransmit_mult`</a> - The multiplier for the number 1194 of retransmissions that are attempted for messages broadcasted over gossip. The number of retransmits is scaled 1195 using this multiplier and the cluster size. The higher the multiplier, the more likely a failed broadcast is to 1196 converge at the expense of increased bandwidth. The default is 4. 1197 1198 * <a name="suspicion_mult"></a><a href="#suspicion_mult">`suspicion_mult`</a> - The multiplier for determining the 1199 time an inaccessible node is considered suspect before declaring it dead. The timeout is scaled with the cluster 1200 size and the probe_interval. This allows the timeout to scale properly with expected propagation delay with a 1201 larger cluster size. The higher the multiplier, the longer an inaccessible node is considered part of the 1202 cluster before declaring it dead, giving that suspect node more time to refute if it is indeed still alive. The 1203 default is 4. 1204 1205 * <a name="key_file"></a><a href="#key_file">`key_file`</a> This provides a the file path to a 1206 PEM-encoded private key. The key is used with the certificate to verify the agent's authenticity. 1207 This must be provided along with [`cert_file`](#cert_file). 1208 1209 * <a name="http_config"></a><a href="#http_config">`http_config`</a> 1210 This object allows setting options for the HTTP API. 1211 1212 The following sub-keys are available: 1213 1214 * <a name="block_endpoints"></a><a href="#block_endpoints">`block_endpoints`</a> 1215 This object is a list of HTTP API endpoint prefixes to block on the agent, and defaults to 1216 an empty list, meaning all endpoints are enabled. Any endpoint that has a common prefix 1217 with one of the entries on this list will be blocked and will return a 403 response code 1218 when accessed. For example, to block all of the V1 ACL endpoints, set this to 1219 `["/v1/acl"]`, which will block `/v1/acl/create`, `/v1/acl/update`, and the other ACL 1220 endpoints that begin with `/v1/acl`. This only works with API endpoints, not `/ui` or 1221 `/debug`, those must be disabled with their respective configuration options. Any CLI 1222 commands that use disabled endpoints will no longer function as well. For more general 1223 access control, Consul's [ACL system](/docs/guides/acl.html) should be used, but this option 1224 is useful for removing access to HTTP API endpoints completely, or on specific agents. This 1225 is available in Consul 0.9.0 and later. 1226 1227 * <a name="response_headers"></a><a href="#response_headers">`response_headers`</a> 1228 This object allows adding headers to the HTTP API responses. 1229 For example, the following config can be used to enable 1230 [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) on 1231 the HTTP API endpoints: 1232 1233 ```javascript 1234 { 1235 "http_config": { 1236 "response_headers": { 1237 "Access-Control-Allow-Origin": "*" 1238 } 1239 } 1240 } 1241 ``` 1242 * <a name="allow_write_http_from"></a><a href="#allow_write_http_from">`allow_write_http_from`</a> 1243 This object is a list of networks in CIDR notation (eg "127.0.0.0/8") that are allowed 1244 to call the agent write endpoints. It defaults to an empty list, which means all networks 1245 are allowed. 1246 This is used to make the agent read-only, except for select ip ranges. 1247 * To block write calls from anywhere, use `[ "255.255.255.255/32" ]`. 1248 * To only allow write calls from localhost, use `[ "127.0.0.0/8" ]` 1249 * To only allow specific IPs, use `[ "10.0.0.1/32", "10.0.0.2/32" ]` 1250 1251 * <a name="leave_on_terminate"></a><a href="#leave_on_terminate">`leave_on_terminate`</a> If 1252 enabled, when the agent receives a TERM signal, it will send a `Leave` message to the rest 1253 of the cluster and gracefully leave. The default behavior for this feature varies based on 1254 whether or not the agent is running as a client or a server (prior to Consul 0.7 the default 1255 value was unconditionally set to `false`). On agents in client-mode, this defaults to `true` 1256 and for agents in server-mode, this defaults to `false`. 1257 1258 * <a name="limits"></a><a href="#limits">`limits`</a> Available in Consul 0.9.3 and later, this 1259 is a nested object that configures limits that are enforced by the agent. Currently, this only 1260 applies to agents in client mode, not Consul servers. The following parameters are available: 1261 1262 * <a name="rpc_rate"></a><a href="#rpc_rate">`rpc_rate`</a> - Configures the RPC rate 1263 limiter by setting the maximum request rate that this agent is allowed to make for RPC 1264 requests to Consul servers, in requests per second. Defaults to infinite, which disables 1265 rate limiting. 1266 * <a name="rpc_rate"></a><a href="#rpc_max_burst">`rpc_max_burst`</a> - The size of the token 1267 bucket used to recharge the RPC rate limiter. Defaults to 1000 tokens, and each token is 1268 good for a single RPC call to a Consul server. See https://en.wikipedia.org/wiki/Token_bucket 1269 for more details about how token bucket rate limiters operate. 1270 1271 * <a name="log_file"></a><a href="#log_file">`log_file`</a> Equivalent to the 1272 [`-log-file` command-line flag](#_log_file). 1273 1274 * <a name="log_level"></a><a href="#log_level">`log_level`</a> Equivalent to the 1275 [`-log-level` command-line flag](#_log_level). 1276 1277 * <a name="node_id"></a><a href="#node_id">`node_id`</a> Equivalent to the 1278 [`-node-id` command-line flag](#_node_id). 1279 1280 * <a name="node_name"></a><a href="#node_name">`node_name`</a> Equivalent to the 1281 [`-node` command-line flag](#_node). 1282 1283 * <a name="node_meta"></a><a href="#node_meta">`node_meta`</a> Available in Consul 0.7.3 and later, 1284 This object allows associating arbitrary metadata key/value pairs with the local node, which can 1285 then be used for filtering results from certain catalog endpoints. See the 1286 [`-node-meta` command-line flag](#_node_meta) for more information. 1287 1288 ```javascript 1289 { 1290 "node_meta": { 1291 "instance_type": "t2.medium" 1292 } 1293 } 1294 ``` 1295 1296 * <a name="performance"></a><a href="#performance">`performance`</a> Available in Consul 0.7 and 1297 later, this is a nested object that allows tuning the performance of different subsystems in 1298 Consul. See the [Server Performance](/docs/guides/performance.html) guide for more details. The 1299 following parameters are available: 1300 1301 * <a name="leave_drain_time"></a><a href="#leave_drain_time">`leave_drain_time`</a> - A duration 1302 that a server will dwell during a graceful leave in order to allow requests to be retried against 1303 other Consul servers. Under normal circumstances, this can prevent clients from experiencing 1304 "no leader" errors when performing a rolling update of the Consul servers. This was added in 1305 Consul 1.0. Must be a duration value such as 10s. Defaults to 5s. 1306 1307 * <a name="raft_multiplier"></a><a href="#raft_multiplier">`raft_multiplier`</a> - An integer 1308 multiplier used by Consul servers to scale key Raft timing parameters. Omitting this value 1309 or setting it to 0 uses default timing described below. Lower values are used to tighten 1310 timing and increase sensitivity while higher values relax timings and reduce sensitivity. 1311 Tuning this affects the time it takes Consul to detect leader failures and to perform 1312 leader elections, at the expense of requiring more network and CPU resources for better 1313 performance. 1314 1315 By default, Consul will use a lower-performance timing that's suitable 1316 for [minimal Consul servers](/docs/guides/performance.html#minimum), currently equivalent 1317 to setting this to a value of 5 (this default may be changed in future versions of Consul, 1318 depending if the target minimum server profile changes). Setting this to a value of 1 will 1319 configure Raft to its highest-performance mode, equivalent to the default timing of Consul 1320 prior to 0.7, and is recommended for [production Consul servers](/docs/guides/performance.html#production). 1321 See the note on [last contact](/docs/guides/performance.html#last-contact) timing for more 1322 details on tuning this parameter. The maximum allowed value is 10. 1323 1324 * <a name="rpc_hold_timeout"></a><a href="#rpc_hold_timeout">`rpc_hold_timeout`</a> - A duration 1325 that a client or server will retry internal RPC requests during leader elections. Under normal 1326 circumstances, this can prevent clients from experiencing "no leader" errors. This was added in 1327 Consul 1.0. Must be a duration value such as 10s. Defaults to 7s. 1328 1329 * <a name="ports"></a><a href="#ports">`ports`</a> This is a nested object that allows setting 1330 the bind ports for the following keys: 1331 * <a name="dns_port"></a><a href="#dns_port">`dns`</a> - The DNS server, -1 to disable. Default 8600. 1332 * <a name="http_port"></a><a href="#http_port">`http`</a> - The HTTP API, -1 to disable. Default 8500. 1333 * <a name="https_port"></a><a href="#https_port">`https`</a> - The HTTPS 1334 API, -1 to disable. Default -1 (disabled). **We recommend using `8501`** for 1335 `https` by convention as some tooling will work automatically with this. 1336 * <a name="grpc_port"></a><a href="#grpc_port">`grpc`</a> - The gRPC API, -1 1337 to disable. Default -1 (disabled). **We recommend using `8502`** for 1338 `grpc` by convention as some tooling will work automatically with this. 1339 This is set to `8502` by default when the agent runs in `-dev` mode. 1340 Currently gRPC is only used to expose Envoy xDS API to Envoy proxies. 1341 * <a name="serf_lan_port"></a><a href="#serf_lan_port">`serf_lan`</a> - The Serf LAN port. Default 8301. 1342 * <a name="serf_wan_port"></a><a href="#serf_wan_port">`serf_wan`</a> - The Serf WAN port. Default 8302. Set to -1 1343 to disable. **Note**: this will disable WAN federation which is not recommended. Various catalog and WAN related 1344 endpoints will return errors or empty results. 1345 * <a name="server_rpc_port"></a><a href="#server_rpc_port">`server`</a> - Server RPC address. Default 8300. 1346 * <a name="proxy_min_port"></a><a href="#proxy_min_port">`proxy_min_port`</a> [**Deprecated**](/docs/connect/proxies/managed-deprecated.html) - Minimum port number to use for automatically assigned [managed proxies](/docs/connect/proxies/managed-deprecated.html). Default 20000. 1347 * <a name="proxy_max_port"></a><a href="#proxy_max_port">`proxy_max_port`</a> [**Deprecated**](/docs/connect/proxies/managed-deprecated.html) - Maximum port number to use for automatically assigned [managed proxies](/docs/connect/proxies/managed-deprecated.html). Default 20255. 1348 * <a name="sidecar_min_port"></a><a 1349 href="#sidecar_min_port">`sidecar_min_port`</a> - Inclusive minimum port 1350 number to use for automatically assigned [sidecar service 1351 registrations](/docs/connect/proxies/sidecar-service.html). Default 21000. 1352 Set to `0` to disable automatic port assignment. 1353 * <a name="sidecar_max_port"></a><a 1354 href="#sidecar_max_port">`sidecar_max_port`</a> - Inclusive maximum port 1355 number to use for automatically assigned [sidecar service 1356 registrations](/docs/connect/proxies/sidecar-service.html). Default 21255. 1357 Set to `0` to disable automatic port assignment. 1358 1359 * <a name="protocol"></a><a href="#protocol">`protocol`</a> Equivalent to the 1360 [`-protocol` command-line flag](#_protocol). 1361 1362 * <a name="primary_datacenter"></a><a href="#primary_datacenter">`primary_datacenter`</a> - This 1363 designates the datacenter which is authoritative for ACL information, intentions and is the root 1364 Certificate Authority for Connect. It must be provided to enable ACLs. All servers and datacenters 1365 must agree on the primary datacenter. Setting it on the servers is all you need for cluster-level enforcement, but for the APIs to forward properly from the clients, it must be set on them too. In 1366 Consul 0.8 and later, this also enables agent-level enforcement of ACLs. Please see the [ACL Guide](/docs/guides/acl.html) for more details. 1367 1368 * <a name="raft_protocol"></a><a href="#raft_protocol">`raft_protocol`</a> Equivalent to the 1369 [`-raft-protocol` command-line flag](#_raft_protocol). 1370 1371 * <a name="raft_snapshot_threshold"></a><a href="#raft_snapshot_threshold">`raft_snapshot_threshold`</a> Equivalent to the 1372 [`-raft-snapshot-threshold` command-line flag](#_raft_snapshot_threshold). 1373 1374 * <a name="raft_snapshot_interval"></a><a href="#raft_snapshot_interval">`raft_snapshot_interval`</a> Equivalent to the 1375 [`-raft-snapshot-interval` command-line flag](#_raft_snapshot_interval). 1376 1377 * <a name="reap"></a><a href="#reap">`reap`</a> This controls Consul's automatic reaping of child processes, 1378 which is useful if Consul is running as PID 1 in a Docker container. If this isn't specified, then Consul will 1379 automatically reap child processes if it detects it is running as PID 1. If this is set to true or false, then 1380 it controls reaping regardless of Consul's PID (forces reaping on or off, respectively). This option was removed 1381 in Consul 0.7.1. For later versions of Consul, you will need to reap processes using a wrapper, please see the 1382 [Consul Docker image entry point script](https://github.com/hashicorp/docker-consul/blob/master/0.X/docker-entrypoint.sh) 1383 for an example. If you are using Docker 1.13.0 or later, you can use the new `--init` option of the `docker run` command 1384 and docker will enable an init process with PID 1 that reaps child processes for the container. 1385 More info on [Docker docs](https://docs.docker.com/engine/reference/commandline/run/#options). 1386 1387 * <a name="reconnect_timeout"></a><a href="#reconnect_timeout">`reconnect_timeout`</a> This controls 1388 how long it takes for a failed node to be completely removed from the cluster. This defaults to 1389 72 hours and it is recommended that this is set to at least double the maximum expected recoverable 1390 outage time for a node or network partition. WARNING: Setting this time too low could cause Consul 1391 servers to be removed from quorum during an extended node failure or partition, which could complicate 1392 recovery of the cluster. The value is a time with a unit suffix, which can be "s", "m", "h" for seconds, 1393 minutes, or hours. The value must be >= 8 hours. 1394 1395 * <a name="reconnect_timeout_wan"></a><a href="#reconnect_timeout_wan">`reconnect_timeout_wan`</a> This 1396 is the WAN equivalent of the <a href="#reconnect_timeout">`reconnect_timeout`</a> parameter, which 1397 controls how long it takes for a failed server to be completely removed from the WAN pool. This also 1398 defaults to 72 hours, and must be >= 8 hours. 1399 1400 * <a name="recursors"></a><a href="#recursors">`recursors`</a> This flag provides addresses of 1401 upstream DNS servers that are used to recursively resolve queries if they are not inside the service 1402 domain for Consul. For example, a node can use Consul directly as a DNS server, and if the record is 1403 outside of the "consul." domain, the query will be resolved upstream. As of Consul 1.0.1 recursors 1404 can be provided as IP addresses or as go-sockaddr templates. IP addresses are resolved in order, 1405 and duplicates are ignored. 1406 1407 * <a name="rejoin_after_leave"></a><a href="#rejoin_after_leave">`rejoin_after_leave`</a> Equivalent 1408 to the [`-rejoin` command-line flag](#_rejoin). 1409 1410 * `retry_join` - Equivalent to the [`-retry-join`](#retry-join) command-line flag. 1411 1412 * <a name="retry_interval"></a><a href="#retry_interval">`retry_interval`</a> Equivalent to the 1413 [`-retry-interval` command-line flag](#_retry_interval). 1414 1415 * <a name="retry_join_wan"></a><a href="#retry_join_wan">`retry_join_wan`</a> Equivalent to the 1416 [`-retry-join-wan` command-line flag](#_retry_join_wan). Takes a list 1417 of addresses to attempt joining to WAN every [`retry_interval_wan`](#_retry_interval_wan) until at least one 1418 join works. 1419 1420 * <a name="retry_interval_wan"></a><a href="#retry_interval_wan">`retry_interval_wan`</a> Equivalent to the 1421 [`-retry-interval-wan` command-line flag](#_retry_interval_wan). 1422 1423 * <a name="segment"></a><a href="#segment">`segment`</a> (Enterprise-only) Equivalent to the 1424 [`-segment` command-line flag](#_segment). 1425 1426 * <a name="segments"></a><a href="#segments">`segments`</a> (Enterprise-only) This is a list of nested objects that allows setting 1427 the bind/advertise information for network segments. This can only be set on servers. See the 1428 [Network Segments Guide](/docs/guides/segments.html) for more details. 1429 * <a name="segment_name"></a><a href="#segment_name">`name`</a> - The name of the segment. Must be a string between 1430 1 and 64 characters in length. 1431 * <a name="segment_bind"></a><a href="#segment_bind">`bind`</a> - The bind address to use for the segment's gossip layer. 1432 Defaults to the [`-bind`](#_bind) value if not provided. 1433 * <a name="segment_port"></a><a href="#segment_port">`port`</a> - The port to use for the segment's gossip layer (required). 1434 * <a name="segment_advertise"></a><a href="#segment_advertise">`advertise`</a> - The advertise address to use for the 1435 segment's gossip layer. Defaults to the [`-advertise`](#_advertise) value if not provided. 1436 * <a name="segment_rpc_listener"></a><a href="#segment_rpc_listener">`rpc_listener`</a> - If true, a separate RPC listener will 1437 be started on this segment's [`-bind`](#_bind) address on the rpc port. Only valid if the segment's bind address differs from the 1438 [`-bind`](#_bind) address. Defaults to false. 1439 1440 * <a name="server"></a><a href="#server">`server`</a> Equivalent to the 1441 [`-server` command-line flag](#_server). 1442 1443 * <a name="non_voting_server"></a><a href="#non_voting_server">`non_voting_server`</a> - Equivalent to the 1444 [`-non-voting-server` command-line flag](#_non_voting_server). 1445 1446 * <a name="server_name"></a><a href="#server_name">`server_name`</a> When provided, this overrides 1447 the [`node_name`](#_node) for the TLS certificate. It can be used to ensure that the certificate 1448 name matches the hostname we declare. 1449 1450 * <a name="session_ttl_min"></a><a href="#session_ttl_min">`session_ttl_min`</a> 1451 The minimum allowed session TTL. This ensures sessions are not created with 1452 TTL's shorter than the specified limit. It is recommended to keep this limit 1453 at or above the default to encourage clients to send infrequent heartbeats. 1454 Defaults to 10s. 1455 1456 * <a name="skip_leave_on_interrupt"></a><a 1457 href="#skip_leave_on_interrupt">`skip_leave_on_interrupt`</a> This is 1458 similar to [`leave_on_terminate`](#leave_on_terminate) but only affects 1459 interrupt handling. When Consul receives an interrupt signal (such as 1460 hitting Control-C in a terminal), Consul will gracefully leave the cluster. 1461 Setting this to `true` disables that behavior. The default behavior for 1462 this feature varies based on whether or not the agent is running as a 1463 client or a server (prior to Consul 0.7 the default value was 1464 unconditionally set to `false`). On agents in client-mode, this defaults 1465 to `false` and for agents in server-mode, this defaults to `true` 1466 (i.e. Ctrl-C on a server will keep the server in the cluster and therefore 1467 quorum, and Ctrl-C on a client will gracefully leave). 1468 1469 * <a name="start_join"></a><a href="#start_join">`start_join`</a> An array of strings specifying addresses 1470 of nodes to [`-join`](#_join) upon startup. Note that using 1471 <a href="#retry_join">`retry_join`</a> could be more appropriate to help 1472 mitigate node startup race conditions when automating a Consul cluster 1473 deployment. 1474 1475 * <a name="start_join_wan"></a><a href="#start_join_wan">`start_join_wan`</a> An array of strings specifying 1476 addresses of WAN nodes to [`-join-wan`](#_join_wan) upon startup. 1477 1478 * <a name="telemetry"></a><a href="#telemetry">`telemetry`</a> This is a nested object that configures where Consul 1479 sends its runtime telemetry, and contains the following keys: 1480 1481 * <a name="telemetry-circonus_api_token"></a><a href="#telemetry-circonus_api_token">`circonus_api_token`</a> 1482 A valid API Token used to create/manage check. If provided, metric management is enabled. 1483 1484 * <a name="telemetry-circonus_api_app"></a><a href="#telemetry-circonus_api_app">`circonus_api_app`</a> 1485 A valid app name associated with the API token. By default, this is set to "consul". 1486 1487 * <a name="telemetry-circonus_api_url"></a><a href="#telemetry-circonus_api_url">`circonus_api_url`</a> 1488 The base URL to use for contacting the Circonus API. By default, this is set to "https://api.circonus.com/v2". 1489 1490 * <a name="telemetry-circonus_submission_interval"></a><a href="#telemetry-circonus_submission_interval">`circonus_submission_interval`</a> 1491 The interval at which metrics are submitted to Circonus. By default, this is set to "10s" (ten seconds). 1492 1493 * <a name="telemetry-circonus_submission_url"></a><a href="#telemetry-circonus_submission_url">`circonus_submission_url`</a> 1494 The `check.config.submission_url` field, of a Check API object, from a previously created HTTPTRAP check. 1495 1496 * <a name="telemetry-circonus_check_id"></a><a href="#telemetry-circonus_check_id">`circonus_check_id`</a> 1497 The Check ID (not **check bundle**) from a previously created HTTPTRAP check. The numeric portion of the `check._cid` field in the Check API object. 1498 1499 * <a name="telemetry-circonus_check_force_metric_activation"></a><a href="#telemetry-circonus_check_force_metric_activation">`circonus_check_force_metric_activation`</a> 1500 Force activation of metrics which already exist and are not currently active. If check management is enabled, the default behavior is to add new metrics as they are encountered. If the metric already exists in the check, it will **not** be activated. This setting overrides that behavior. By default, this is set to false. 1501 1502 * <a name="telemetry-circonus_check_instance_id"></a><a href="#telemetry-circonus_check_instance_id">`circonus_check_instance_id`</a> 1503 Uniquely identifies the metrics coming from this *instance*. It can be used to maintain metric continuity with transient or ephemeral instances as they move around within an infrastructure. By default, this is set to hostname:application name (e.g. "host123:consul"). 1504 1505 * <a name="telemetry-circonus_check_search_tag"></a><a href="#telemetry-circonus_check_search_tag">`circonus_check_search_tag`</a> 1506 A special tag which, when coupled with the instance id, helps to narrow down the search results when neither a Submission URL or Check ID is provided. By default, this is set to service:application name (e.g. "service:consul"). 1507 1508 * <a name="telemetry-circonus_check_display_name"></a><a href="#telemetry-circonus_check_display_name">`circonus_check_display_name`</a> 1509 Specifies a name to give a check when it is created. This name is displayed in the Circonus UI Checks list. Available in Consul 0.7.2 and later. 1510 1511 * <a name="telemetry-circonus_check_tags"></a><a href="#telemetry-circonus_check_tags">`circonus_check_tags`</a> 1512 Comma separated list of additional tags to add to a check when it is created. Available in Consul 0.7.2 and later. 1513 1514 * <a name="telemetry-circonus_broker_id"></a><a href="#telemetry-circonus_broker_id">`circonus_broker_id`</a> 1515 The ID of a specific Circonus Broker to use when creating a new check. The numeric portion of `broker._cid` field in a Broker API object. If metric management is enabled and neither a Submission URL nor Check ID is provided, an attempt will be made to search for an existing check using Instance ID and Search Tag. If one is not found, a new HTTPTRAP check will be created. By default, this is not used and a random Enterprise Broker is selected, or the default Circonus Public Broker. 1516 1517 * <a name="telemetry-circonus_broker_select_tag"></a><a href="#telemetry-circonus_broker_select_tag">`circonus_broker_select_tag`</a> 1518 A special tag which will be used to select a Circonus Broker when a Broker ID is not provided. The best use of this is to as a hint for which broker should be used based on *where* this particular instance is running (e.g. a specific geo location or datacenter, dc:sfo). By default, this is left blank and not used. 1519 1520 * <a name="telemetry-disable_hostname"></a><a href="#telemetry-disable_hostname">`disable_hostname`</a> 1521 This controls whether or not to prepend runtime telemetry with the machine's hostname, defaults to false. 1522 1523 * <a name="telemetry-dogstatsd_addr"></a><a href="#telemetry-dogstatsd_addr">`dogstatsd_addr`</a> This provides the 1524 address of a DogStatsD instance in the format `host:port`. DogStatsD is a protocol-compatible flavor of 1525 statsd, with the added ability to decorate metrics with tags and event information. If provided, Consul will 1526 send various telemetry information to that instance for aggregation. This can be used to capture runtime 1527 information. 1528 1529 * <a name="telemetry-dogstatsd_tags"></a><a href="#telemetry-dogstatsd_tags">`dogstatsd_tags`</a> This provides a list of global tags 1530 that will be added to all telemetry packets sent to DogStatsD. It is a list of strings, where each string 1531 looks like "my_tag_name:my_tag_value". 1532 1533 * <a name="telemetry-filter_default"></a><a href="#telemetry-filter_default">`filter_default`</a> 1534 This controls whether to allow metrics that have not been specified by the filter. Defaults to `true`, which will 1535 allow all metrics when no filters are provided. When set to `false` with no filters, no metrics will be sent. 1536 1537 * <a name="telemetry-metrics_prefix"></a><a href="#telemetry-metrics_prefix">`metrics_prefix`</a> 1538 The prefix used while writing all telemetry data. By default, this is set to "consul". This was added 1539 in Consul 1.0. For previous versions of Consul, use the config option `statsite_prefix` in this 1540 same structure. This was renamed in Consul 1.0 since this prefix applied to all telemetry providers, 1541 not just statsite. 1542 1543 * <a name="telemetry-prefix_filter"></a><a href="#telemetry-prefix_filter">`prefix_filter`</a> 1544 This is a list of filter rules to apply for allowing/blocking metrics by prefix in the following format: 1545 1546 ```javascript 1547 [ 1548 "+consul.raft.apply", 1549 "-consul.http", 1550 "+consul.http.GET" 1551 ] 1552 ``` 1553 A leading "<b>+</b>" will enable any metrics with the given prefix, and a leading "<b>-</b>" will block them. If there 1554 is overlap between two rules, the more specific rule will take precedence. Blocking will take priority if the same 1555 prefix is listed multiple times. 1556 1557 * <a name="telemetry-prometheus_retention_time"></a><a href="#telemetry-prometheus_retention_time">prometheus_retention_time</a> 1558 If the value is greater than `0s` (the default), this enables [Prometheus](https://prometheus.io/) export of metrics. 1559 The duration can be expressed using the duration semantics and will aggregates all counters for the duration specified 1560 (it might have an impact on Consul's memory usage). A good value for this parameter is at least 2 times the interval of scrape 1561 of Prometheus, but you might also put a very high retention time such as a few days (for instance 744h to enable retention 1562 to 31 days). 1563 Fetching the metrics using prometheus can then be performed using the [`/v1/agent/metrics?format=prometheus`](/api/agent.html#view-metrics) endpoint. 1564 The format is compatible natively with prometheus. When running in this mode, it is recommended to also enable the option 1565 <a href="#telemetry-disable_hostname">`disable_hostname`</a> to avoid having prefixed metrics with hostname. 1566 Consul does not use the default Prometheus path, so Prometheus must be configured as follows. 1567 Note that using ?format=prometheus in the path won't work as ? will be escaped, so it must be specified as a parameter. 1568 1569 ```yaml 1570 metrics_path: "/v1/agent/metrics" 1571 params: 1572 format: ['prometheus'] 1573 ``` 1574 1575 * <a name="telemetry-statsd_address"></a><a href="#telemetry-statsd_address">`statsd_address`</a> This provides the 1576 address of a statsd instance in the format `host:port`. If provided, Consul will send various telemetry information to that instance for 1577 aggregation. This can be used to capture runtime information. This sends UDP packets only and can be used with 1578 statsd or statsite. 1579 1580 * <a name="telemetry-statsite_address"></a><a href="#telemetry-statsite_address">`statsite_address`</a> This provides 1581 the address of a statsite instance in the format `host:port`. If provided, Consul will stream various telemetry information to that instance 1582 for aggregation. This can be used to capture runtime information. This streams via TCP and can only be used with 1583 statsite. 1584 1585 * <a name="syslog_facility"></a><a href="#syslog_facility">`syslog_facility`</a> When 1586 [`enable_syslog`](#enable_syslog) is provided, this controls to which 1587 facility messages are sent. By default, `LOCAL0` will be used. 1588 1589 * <a name="tls_min_version"></a><a href="#tls_min_version">`tls_min_version`</a> Added in Consul 1590 0.7.4, this specifies the minimum supported version of TLS. Accepted values are "tls10", "tls11" 1591 or "tls12". This defaults to "tls12". WARNING: TLS 1.1 and lower are generally considered less 1592 secure; avoid using these if possible. 1593 1594 * <a name="tls_cipher_suites"></a><a href="#tls_cipher_suites">`tls_cipher_suites`</a> Added in Consul 1595 0.8.2, this specifies the list of supported ciphersuites as a comma-separated-list. The list of all 1596 supported ciphersuites is available in the [source code](https://github.com/hashicorp/consul/blob/master/tlsutil/config.go#L363). 1597 1598 * <a name="tls_prefer_server_cipher_suites"></a><a href="#tls_prefer_server_cipher_suites"> 1599 `tls_prefer_server_cipher_suites`</a> Added in Consul 0.8.2, this will cause Consul to prefer the 1600 server's ciphersuite over the client ciphersuites. 1601 1602 * <a name="translate_wan_addrs"></a><a href="#translate_wan_addrs">`translate_wan_addrs`</a> If 1603 set to true, Consul will prefer a node's configured <a href="#_advertise-wan">WAN address</a> 1604 when servicing DNS and HTTP requests for a node in a remote datacenter. This allows the node to 1605 be reached within its own datacenter using its local address, and reached from other datacenters 1606 using its WAN address, which is useful in hybrid setups with mixed networks. This is disabled by 1607 default. 1608 1609 Starting in Consul 0.7 and later, node addresses in responses to HTTP requests will also prefer a 1610 node's configured <a href="#_advertise-wan">WAN address</a> when querying for a node in a remote 1611 datacenter. An [`X-Consul-Translate-Addresses`](/api/index.html#translated-addresses) header 1612 will be present on all responses when translation is enabled to help clients know that the addresses 1613 may be translated. The `TaggedAddresses` field in responses also have a `lan` address for clients that 1614 need knowledge of that address, regardless of translation. 1615 1616 The following endpoints translate addresses: 1617 - [`/v1/catalog/nodes`](/api/catalog.html#catalog_nodes) 1618 - [`/v1/catalog/node/<node>`](/api/catalog.html#catalog_node) 1619 - [`/v1/catalog/service/<service>`](/api/catalog.html#catalog_service) 1620 - [`/v1/health/service/<service>`](/api/health.html#health_service) 1621 - [`/v1/query/<query or name>/execute`](/api/query.html#execute) 1622 1623 * <a name="ui"></a><a href="#ui">`ui`</a> - Equivalent to the [`-ui`](#_ui) 1624 command-line flag. 1625 1626 * <a name="ui_dir"></a><a href="#ui_dir">`ui_dir`</a> - Equivalent to the 1627 [`-ui-dir`](#_ui_dir) command-line flag. This configuration key is not required as of Consul version 0.7.0 and later. Specifying this configuration key will enable the web UI. There is no need to specify both ui-dir and ui. Specifying both will result in an error. 1628 1629 * <a name="unix_sockets"></a><a href="#unix_sockets">`unix_sockets`</a> - This 1630 allows tuning the ownership and permissions of the 1631 Unix domain socket files created by Consul. Domain sockets are only used if 1632 the HTTP address is configured with the `unix://` prefix. 1633 1634 It is important to note that this option may have different effects on 1635 different operating systems. Linux generally observes socket file permissions 1636 while many BSD variants ignore permissions on the socket file itself. It is 1637 important to test this feature on your specific distribution. This feature is 1638 currently not functional on Windows hosts. 1639 1640 The following options are valid within this construct and apply globally to all 1641 sockets created by Consul: 1642 - `user` - The name or ID of the user who will own the socket file. 1643 - `group` - The group ID ownership of the socket file. This option 1644 currently only supports numeric IDs. 1645 - `mode` - The permission bits to set on the file. 1646 1647 * <a name="verify_incoming"></a><a href="#verify_incoming">`verify_incoming`</a> - If 1648 set to true, Consul requires that all incoming 1649 connections make use of TLS and that the client provides a certificate signed 1650 by a Certificate Authority from the [`ca_file`](#ca_file) or [`ca_path`](#ca_path). 1651 This applies to both server RPC and to the HTTPS API. By default, this is false, and 1652 Consul will not enforce the use of TLS or verify a client's authenticity. 1653 1654 * <a name="verify_incoming_rpc"></a><a href="#verify_incoming_rpc">`verify_incoming_rpc`</a> - If 1655 set to true, Consul requires that all incoming RPC 1656 connections make use of TLS and that the client provides a certificate signed 1657 by a Certificate Authority from the [`ca_file`](#ca_file) or [`ca_path`](#ca_path). By default, 1658 this is false, and Consul will not enforce the use of TLS or verify a client's authenticity. 1659 1660 * <a name="verify_incoming_https"></a><a href="#verify_incoming_https">`verify_incoming_https`</a> - If 1661 set to true, Consul requires that all incoming HTTPS 1662 connections make use of TLS and that the client provides a certificate signed 1663 by a Certificate Authority from the [`ca_file`](#ca_file) or [`ca_path`](#ca_path). By default, 1664 this is false, and Consul will not enforce the use of TLS or verify a client's authenticity. To 1665 enable the HTTPS API, you must define an HTTPS port via the [`ports`](#ports) configuration. By 1666 default, HTTPS is disabled. 1667 1668 * <a name="verify_outgoing"></a><a href="#verify_outgoing">`verify_outgoing`</a> - If set to 1669 true, Consul requires that all outgoing connections from this agent 1670 make use of TLS and that the server provides a certificate that is signed by 1671 a Certificate Authority from the [`ca_file`](#ca_file) or [`ca_path`](#ca_path). By default, 1672 this is false, and Consul will not make use of TLS for outgoing connections. This applies to clients 1673 and servers as both will make outgoing connections. 1674 1675 ~> **Security Note:** Note that servers that specify `verify_outgoing = 1676 true` will always talk to other servers over TLS, but they still _accept_ 1677 non-TLS connections to allow for a transition of all clients to TLS. 1678 Currently the only way to enforce that no client can communicate with a 1679 server unencrypted is to also enable `verify_incoming` which requires client 1680 certificates too. 1681 1682 * <a name="verify_server_hostname"></a><a 1683 href="#verify_server_hostname">`verify_server_hostname`</a> - If set to true, 1684 Consul verifies for all outgoing TLS connections that the TLS certificate 1685 presented by the servers matches "server.<datacenter>.<domain>" 1686 hostname. By default, this is false, and Consul does not verify the hostname 1687 of the certificate, only that it is signed by a trusted CA. This setting is 1688 _critical_ to prevent a compromised client from being restarted as a server 1689 and having all cluster state _including all ACL tokens and Connect CA root keys_ 1690 replicated to it. This is new in 0.5.1. 1691 1692 ~> **Security Note:** From versions 0.5.1 to 1.4.0, due to a bug, setting 1693 this flag alone _does not_ imply `verify_outgoing` and leaves client to server 1694 and server to server RPCs unencrypted despite the documentation stating otherwise. See 1695 [CVE-2018-19653](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-19653) 1696 for more details. For those versions you **must also set `verify_outgoing = 1697 true`** to ensure encrypted RPC connections. 1698 1699 * <a name="watches"></a><a href="#watches">`watches`</a> - Watches is a list of watch 1700 specifications which allow an external process to be automatically invoked when a 1701 particular data view is updated. See the 1702 [watch documentation](/docs/agent/watches.html) for more detail. Watches can be 1703 modified when the configuration is reloaded. 1704 1705 ## <a id="ports-used"></a>Ports Used 1706 1707 Consul requires up to 6 different ports to work properly, some on 1708 TCP, UDP, or both protocols. Below we document the requirements for each 1709 port. 1710 1711 * Server RPC (Default 8300). This is used by servers to handle incoming 1712 requests from other agents. TCP only. 1713 1714 * Serf LAN (Default 8301). This is used to handle gossip in the LAN. 1715 Required by all agents. TCP and UDP. 1716 1717 * Serf WAN (Default 8302). This is used by servers to gossip over the WAN, to 1718 other servers. TCP and UDP. As of Consul 0.8 the WAN join flooding feature requires 1719 the Serf WAN port (TCP/UDP) to be listening on both WAN and LAN interfaces. See also: 1720 [Consul 0.8.0 CHANGELOG](https://github.com/hashicorp/consul/blob/master/CHANGELOG.md#080-april-5-2017) and [GH-3058](https://github.com/hashicorp/consul/issues/3058) 1721 1722 * HTTP API (Default 8500). This is used by clients to talk to the HTTP 1723 API. TCP only. 1724 1725 * DNS Interface (Default 8600). Used to resolve DNS queries. TCP and UDP. 1726 1727 ## <a id="reloadable-configuration"></a>Reloadable Configuration 1728 1729 Reloading configuration does not reload all configuration items. The 1730 items which are reloaded include: 1731 1732 * Log level 1733 * Checks 1734 * Services 1735 * Watches 1736 * HTTP Client Address 1737 * TLS Configuration 1738 * Please be aware that this is currently limited to reload a configuration that is already TLS enabled. You cannot enable or disable TLS only with reloading. 1739 * <a href="#node_meta">Node Metadata</a> 1740 * <a href="#telemetry-prefix_filter">Metric Prefix Filter</a> 1741 * <a href="#discard_check_output">Discard Check Output</a> 1742 * <a href="#limits">RPC rate limiting</a>