github.com/quite/nomad@v0.8.6/website/source/docs/agent/configuration/server.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "server Stanza - Agent Configuration"
     4  sidebar_current: "docs-agent-configuration-server"
     5  description: |-
     6    The "server" stanza configures the Nomad agent to operate in server mode to
     7    participate in scheduling decisions, register with service discovery, handle
     8    join failures, and more.
     9  ---
    10  
    11  # `server` Stanza
    12  
    13  <table class="table table-bordered table-striped">
    14    <tr>
    15      <th width="120">Placement</th>
    16      <td>
    17        <code>**server**</code>
    18      </td>
    19    </tr>
    20  </table>
    21  
    22  
    23  The `server` stanza configures the Nomad agent to operate in server mode to
    24  participate in scheduling decisions, register with service discovery, handle
    25  join failures, and more.
    26  
    27  ```hcl
    28  server {
    29    enabled          = true
    30    bootstrap_expect = 3
    31    server_join {
    32      retry_join = [ "1.1.1.1", "2.2.2.2" ]
    33      retry_max = 3
    34      retry_interval = "15s"
    35    }
    36  }
    37  ```
    38  
    39  ## `server` Parameters
    40  
    41  - `authoritative_region` `(string: "")` - Specifies the authoritative region, which
    42    provides a single source of truth for global configurations such as ACL Policies and
    43    global ACL tokens. Non-authoritative regions will replicate from the authoritative
    44    to act as a mirror. By default, the local region is assumed to be authoritative.
    45  
    46  - `bootstrap_expect` `(int: required)` - Specifies the number of server nodes to
    47    wait for before bootstrapping. It is most common to use the odd-numbered
    48    integers `3` or `5` for this value, depending on the cluster size. A value of
    49    `1` does not provide any fault tolerance and is not recommended for production
    50    use cases.
    51  
    52  - `data_dir` `(string: "[data_dir]/server")` - Specifies the directory to use -
    53    for server-specific data, including the replicated log. By default, this is -
    54    the top-level [data_dir](/docs/agent/configuration/index.html#data_dir)
    55    suffixed with "server", like `"/opt/nomad/server"`. This must be an absolute
    56    path.
    57  
    58  - `enabled` `(bool: false)` - Specifies if this agent should run in server mode.
    59    All other server options depend on this value being set.
    60  
    61  - `enabled_schedulers` `(array<string>: [all])` - Specifies which sub-schedulers
    62    this server will handle. This can be used to restrict the evaluations that
    63    worker threads will dequeue for processing.
    64  
    65  - `encrypt` `(string: "")` - Specifies the secret key to use for encryption of
    66    Nomad server's gossip network traffic. This key must be 16 bytes that are
    67    base64-encoded. The provided key is automatically persisted to the data
    68    directory and loaded automatically whenever the agent is restarted. This means
    69    that to encrypt Nomad server's gossip protocol, this option only needs to be
    70    provided once on each agent's initial startup sequence. If it is provided
    71    after Nomad has been initialized with an encryption key, then the provided key
    72    is ignored and a warning will be displayed. See the
    73    [Nomad encryption documentation][encryption] for more details on this option
    74    and its impact on the cluster.
    75  
    76  - `node_gc_threshold` `(string: "24h")` - Specifies how long a node must be in a
    77    terminal state before it is garbage collected and purged from the system. This
    78    is specified using a label suffix like "30s" or "1h".
    79  
    80  - `job_gc_threshold` `(string: "4h")` - Specifies the minimum time a job must be
    81    in the terminal state before it is eligible for garbage collection. This is
    82    specified using a label suffix like "30s" or "1h".
    83  
    84  - `eval_gc_threshold` `(string: "1h")` - Specifies the minimum time an
    85    evaluation must be in the terminal state before it is eligible for garbage
    86    collection. This is specified using a label suffix like "30s" or "1h".
    87  
    88  - `deployment_gc_threshold` `(string: "1h")` - Specifies the minimum time a
    89    deployment must be in the terminal state before it is eligible for garbage
    90    collection. This is specified using a label suffix like "30s" or "1h".
    91  
    92  - `heartbeat_grace` `(string: "10s")` - Specifies the additional time given as a
    93    grace period beyond the heartbeat TTL of nodes to account for network and
    94    processing delays as well as clock skew. This is specified using a label
    95    suffix like "30s" or "1h".
    96  
    97  - `min_heartbeat_ttl` `(string: "10s")` - Specifies the minimum time between
    98    node heartbeats. This is used as a floor to prevent excessive updates. This is
    99    specified using a label suffix like "30s" or "1h". Lowering the minimum TTL is
   100    a tradeoff as it lowers failure detection time of nodes at the tradeoff of
   101    false positives and increased load on the leader.
   102  
   103  - `max_heartbeats_per_second` `(float: 50.0)` - Specifies the maximum target
   104    rate of heartbeats being processed per second. This allows the TTL to be
   105    increased to meet the target rate. Increasing the maximum heartbeats per
   106    second is a tradeoff as it lowers failure detection time of nodes at the
   107    tradeoff of false positives and increased load on the leader.
   108  
   109  - `non_voting_server` `(bool: false)` - (Enterprise-only) Specifies whether
   110    this server will act as a non-voting member of the cluster to help provide
   111    read scalability.
   112  
   113  - `num_schedulers` `(int: [num-cores])` - Specifies the number of parallel
   114    scheduler threads to run. This can be as many as one per core, or `0` to
   115    disallow this server from making any scheduling decisions. This defaults to
   116    the number of CPU cores.
   117  
   118  - `protocol_version` `(int: 1)` - Specifies the Nomad protocol version to use
   119    when communicating with other Nomad servers. This value is typically not
   120    required as the agent internally knows the latest version, but may be useful
   121    in some upgrade scenarios.
   122  
   123  - `raft_protocol` `(int: 2)` - Specifies the Raft protocol version to use when
   124    communicating with other Nomad servers. This affects available Autopilot
   125    features and is typically not required as the agent internally knows the
   126    latest version, but may be useful in some upgrade scenarios.
   127  
   128  - `redundancy_zone` `(string: "")` - (Enterprise-only) Specifies the redundancy
   129    zone that this server will be a part of for Autopilot management. For more
   130    information, see the [Autopilot Guide](/guides/cluster/autopilot.html).
   131  
   132  - `rejoin_after_leave` `(bool: false)` - Specifies if Nomad will ignore a
   133    previous leave and attempt to rejoin the cluster when starting. By default,
   134    Nomad treats leave as a permanent intent and does not attempt to join the
   135    cluster again when starting. This flag allows the previous state to be used to
   136    rejoin the cluster.
   137  
   138  - `server_join` <code>([server_join][server-join]: nil)</code> - Specifies
   139    how the Nomad server will connect to other Nomad servers. The `retry_join`
   140    fields may directly specify the server address or use go-discover syntax for
   141    auto-discovery. See the [server_join documentation][server-join] for more detail.
   142  
   143  - `upgrade_version` `(string: "")` - A custom version of the format X.Y.Z to use
   144    in place of the Nomad version when custom upgrades are enabled in Autopilot.
   145    For more information, see the [Autopilot Guide](/guides/cluster/autopilot.html).
   146  
   147  ### Deprecated Parameters
   148  
   149  - `retry_join` `(array<string>: [])` - Specifies a list of server addresses to
   150    retry joining if the first attempt fails. This is similar to
   151    [`start_join`](#start_join), but only invokes if the initial join attempt
   152    fails. The list of addresses will be tried in the order specified, until one
   153    succeeds. After one succeeds, no further addresses will be contacted. This is
   154    useful for cases where we know the address will become available eventually.
   155    Use `retry_join` with an array as a replacement for `start_join`, **do not use
   156    both options**. See the [server_join][server-join]
   157    section for more information on the format of the string. This field is
   158    deprecated in favor of the [server_join stanza][server-join].
   159  
   160  - `retry_interval` `(string: "30s")` - Specifies the time to wait between retry
   161    join attempts. This field is deprecated in favor of the [server_join
   162    stanza][server-join].
   163  
   164  - `retry_max` `(int: 0)` - Specifies the maximum number of join attempts to be
   165    made before exiting with a return code of 1. By default, this is set to 0
   166    which is interpreted as infinite retries. This field is deprecated in favor of
   167    the [server_join stanza][server-join].
   168  
   169  - `start_join` `(array<string>: [])` - Specifies a list of server addresses to
   170    join on startup. If Nomad is unable to join with any of the specified
   171    addresses, agent startup will fail. See the [server address
   172    format](/docs/agent/configuration/server_join.html#server-address-format)
   173    section for more information on the format of the string. This field is
   174    deprecated in favor of the [server_join stanza][server-join].
   175  
   176  ## `server` Examples
   177  
   178  ### Common Setup
   179  
   180  This example shows a common Nomad agent `server` configuration stanza. The two
   181  IP addresses could also be DNS, and should point to the other Nomad servers in
   182  the cluster
   183  
   184  ```hcl
   185  server {
   186    enabled          = true
   187    bootstrap_expect = 3
   188    retry_join       = ["1.2.3.4", "5.6.7.8"]
   189  }
   190  ```
   191  
   192  ### Configuring Data Directory
   193  
   194  This example shows configuring a custom data directory for the server data.
   195  
   196  ```hcl
   197  server {
   198    data_dir = "/opt/nomad/server"
   199  }
   200  ```
   201  
   202  ### Automatic Bootstrapping
   203  
   204  The Nomad servers can automatically bootstrap if Consul is configured. For a
   205  more detailed explanation, please see the
   206  [automatic Nomad bootstrapping documentation](/guides/cluster/automatic.html).
   207  
   208  ### Restricting Schedulers
   209  
   210  This example shows restricting the schedulers that are enabled as well as the
   211  maximum number of cores to utilize when participating in scheduling decisions:
   212  
   213  ```hcl
   214  server {
   215    enabled            = true
   216    enabled_schedulers = ["batch", "service"]
   217    num_schedulers     = 7
   218  }
   219  ```
   220  
   221  [encryption]: /docs/agent/encryption.html "Nomad Agent Encryption"
   222  [server-join]: /docs/agent/configuration/server_join.html "Server Join"