github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/commands/agent.mdx (about)

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