github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/commands/agent.mdx (about) 1 --- 2 layout: docs 3 page_title: 'Commands: agent' 4 description: | 5 The agent command is the main entrypoint to running a Nomad client or server. 6 --- 7 8 # Command: agent 9 10 The agent command is the heart of Nomad: it runs the agent that handles client 11 or server functionality, including exposing interfaces for client consumption 12 and running jobs. 13 14 Due to the power and flexibility of this command, the Nomad agent is documented 15 in its own section. See the [Nomad Agent] guide and the [Configuration] 16 documentation section for more information on how to use this command and the 17 options it has. 18 19 ## Command-line Options 20 21 A subset of the available Nomad agent configuration can optionally be passed in 22 via CLI arguments. The `agent` command accepts the following arguments: 23 24 - `-alloc-dir=<path>`: Equivalent to the Client [alloc_dir] config 25 option. 26 27 - `-acl-enabled`: Equivalent to the ACL [enabled] config option. 28 29 - `-acl-replication-token`: Equivalent to the ACL [replication_token] config 30 option. 31 32 - `-bind=<address>`: Equivalent to the [bind_addr] config option. 33 34 - `-bootstrap-expect=<num>`: Equivalent to the 35 [bootstrap_expect] config option. 36 37 - `-client`: Enable client mode on the local agent. 38 39 - `-config=<path>`: Specifies the path to a configuration file or a directory of 40 configuration files to load. Can be specified multiple times. 41 42 - `-consul-address=<addr>`: Equivalent to the [address] config option. 43 44 - `-consul-auth=<auth>`: Equivalent to the [auth] config option. 45 46 - `-consul-auto-advertise`: Equivalent to the [auto_advertise] config option. 47 48 - `-consul-ca-file=<path>`: Equivalent to the [ca_file] config option. 49 50 - `-consul-cert-file=<path>`: Equivalent to the [cert_file] config option. 51 52 - `-consul-checks-use-advertise`: Equivalent to the [checks_use_advertise] 53 config option. 54 55 - `-consul-client-auto-join`: Equivalent to the [client_auto_join] config 56 option. 57 58 - `-consul-client-service-name=<name>`: Equivalent to the [client_service_name] 59 config option. 60 61 - `-consul-client-http-check-name=<name>`: Equivalent to the 62 [client_http_check_name] config option. 63 64 - `-consul-key-file=<path>`: Equivalent to the [key_file] config option. 65 66 - `-consul-server-service-name=<name>`: Equivalent to the [server_service_name] 67 config option. 68 69 - `-consul-server-http-check-name=<name>`: Equivalent to the 70 [server_http_check_name] config option. 71 72 - `-consul-server-serf-check-name=<name>`: Equivalent to the 73 [server_serf_check_name] config option. 74 75 - `-consul-server-rpc-check-name=<name>`: Equivalent to the 76 [server_rpc_check_name] config option. 77 78 - `-consul-server-auto-join`: Equivalent to the [server_auto_join] config 79 option. 80 81 - `-consul-ssl`: Equivalent to the [ssl] config option. 82 83 - `-consul-token=<token>`: Equivalent to the [token] config option. 84 85 - `-consul-verify-ssl`: Equivalent to the [verify_ssl] config option. 86 87 - `-data-dir=<path>`: Equivalent to the [data_dir] config option. 88 89 - `-dc=<datacenter>`: Equivalent to the [datacenter] config option. 90 91 - `-dev`: Start the agent in development mode. This enables a pre-configured 92 dual-role agent (client + server) which is useful for developing or testing 93 Nomad. No other configuration is required to start the agent in this mode, 94 but you may pass an optional comma-separated list of mode configurations: 95 96 - `-dev-connect`: Start the agent in development mode, but bind to a public 97 network interface rather than localhost for using Consul Connect. This mode 98 is supported only on Linux as root. 99 100 - `-encrypt`: Set the Serf encryption key. See the [Encryption Overview] for 101 more details. 102 103 - `-join=<address>`: Address of another agent to join upon starting up. This can 104 be specified multiple times to specify multiple agents to join. 105 106 - `-log-level=<level>`: Equivalent to the [log_level] config option. 107 108 - `-log-json`: Equivalent to the [log_json] config option. 109 110 - `-meta=<key=value>`: Equivalent to the Client [meta] config option. 111 112 - `-network-interface=<interface>`: Equivalent to the Client 113 [network_interface] config option. 114 115 - `-node=<name>`: Equivalent to the [name] config option. 116 117 - `-node-class=<class>`: Equivalent to the Client [node_class] 118 config option. 119 120 - `-plugin-dir=<path>`: Equivalent to the [plugin_dir] config option. 121 122 - `-region=<region>`: Equivalent to the [region] config option. 123 124 - `-rejoin`: Equivalent to the [rejoin_after_leave] config option. 125 126 - `-retry-interval`: Equivalent to the [retry_interval] config option. 127 128 - `-retry-join`: Similar to `-join` but allows retrying a join if the first 129 attempt fails. 130 131 ```shell-session 132 $ nomad agent -retry-join "127.0.0.1:4648" 133 ``` 134 135 `retry-join` can be defined as a command line flag only for servers. Clients 136 can configure `retry-join` only in configuration files. 137 138 - `-retry-max`: Similar to the [retry_max] config option. 139 140 - `-server`: Enable server mode on the local agent. 141 142 - `-servers=<host:port>`: Equivalent to the Client [servers] config 143 option. 144 145 - `-state-dir=<path>`: Equivalent to the Client [state_dir] config 146 option. 147 148 - `-vault-enabled`: Whether to enable or disabled Vault integration. 149 150 - `-vault-address=<addr>`: The address to communicate with Vault. 151 152 - `-vault-token=<token>`: The Vault token used to derive tokens. Only needs to 153 be set on Servers. Overrides the Vault token read from the VAULT_TOKEN 154 environment variable. 155 156 - `-vault-create-from-role=<role>`: The role name to create tokens for tasks 157 from. 158 159 - `-vault-ca-file=<path>`: Path to a PEM-encoded CA cert file used to verify the 160 Vault server SSL certificate. 161 162 - `-vault-ca-path=<path>`: Path to a directory of PEM-encoded CA cert files used 163 to verify the Vault server SSL certificate.Whether to enable or disabled Vault 164 integration. 165 166 - `vault-cert-file=<path>`: The path to the certificate for Vault communication. 167 168 - `vault-key-file=<path>`: The path to the private key for Vault communication. 169 170 - `vault-namespace=<namespace>`: The Vault namespace used for the integration. 171 Required for servers and clients. Overrides the Vault namespace read from the 172 VAULT_NAMESPACE environment variable. 173 174 - `vault-tls-skip-verify`: A boolean that determines whether to skip SSL 175 certificate verification. 176 177 - `vault-tls-server-name=<name>`: Used to set the SNI host when connecting to 178 Vault over TLS. 179 180 [address]: /docs/configuration/consul#address 181 [alloc_dir]: /docs/configuration/client#alloc_dir 182 [auth]: /docs/configuration/consul#auth 183 [auto_advertise]: /docs/configuration/consul#auto_advertise 184 [bind_addr]: /docs/configuration#bind_addr 185 [bootstrap_expect]: /docs/configuration/server#bootstrap_expect 186 [ca_file]: /docs/configuration/consul#ca_file 187 [cert_file]: /docs/configuration/consul#cert_file 188 [checks_use_advertise]: /docs/configuration/consul#checks_use_advertise 189 [client_auto_join]: /docs/configuration/consul#client_auto_join 190 [client_http_check_name]: /docs/configuration/consul#client_http_check_name 191 [client_service_name]: /docs/configuration/consul#client_service_name 192 [configuration]: /docs/configuration 193 [data_dir]: /docs/configuration#data_dir 194 [datacenter]: /docs/configuration#datacenter 195 [enabled]: /docs/configuration/acl#enabled 196 [encryption overview]: https://learn.hashicorp.com/tutorials/nomad/security-gossip-encryption 197 [key_file]: /docs/configuration/consul#key_file 198 [log_json]: /docs/configuration#log_json 199 [log_level]: /docs/configuration#log_level 200 [meta]: /docs/configuration/client#meta 201 [name]: /docs/configuration#name 202 [network_interface]: /docs/configuration/client#network_interface 203 [node_class]: /docs/configuration/client#node_class 204 [nomad agent]: /docs/operations/nomad-agent 205 [plugin_dir]: /docs/configuration#plugin_dir 206 [region]: /docs/configuration#region 207 [rejoin_after_leave]: /docs/configuration/server#rejoin_after_leave 208 [replication_token]: /docs/configuration/acl#replication_token 209 [retry_interval]: /docs/configuration/server#retry_interval 210 [retry_max]: /docs/configuration/server#retry_max 211 [server_auto_join]: /docs/configuration/consul#server_auto_join 212 [server_http_check_name]: /docs/configuration/consul#server_http_check_name 213 [server_rpc_check_name]: /docs/configuration/consul#server_rpc_check_name 214 [server_serf_check_name]: /docs/configuration/consul#server_serf_check_name 215 [server_service_name]: /docs/configuration/consul#server_service_name 216 [servers]: /docs/configuration/client#servers 217 [ssl]: /docs/configuration/consul#ssl 218 [state_dir]: /docs/configuration/client#state_dir 219 [token]: /docs/configuration/consul#token 220 [verify_ssl]: /docs/configuration/consul#verify_ssl