github.com/ncodes/nomad@v0.5.7-0.20170403112158-97adf4a74fb3/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    retry_join       = ["1.2.3.4", "5.6.7.8"]
    32  }
    33  ```
    34  
    35  ## `server` Parameters
    36  
    37  - `bootstrap_expect` `(int: required)` - Specifies the number of server nodes to
    38    wait for before bootstrapping. It is most common to use the odd-numbered
    39    integers `3` or `5` for this value, depending on the cluster size. A value of
    40    `1` does not provide any fault tolerance and is not recommended for production
    41    use cases.
    42  
    43  - `data_dir` `(string: "[data_dir]/server")` - Specifies the directory to use -
    44    for server-specific data, including the replicated log. By default, this is -
    45    the top-level [data_dir](/docs/agent/configuration/index.html#data_dir)
    46    suffixed with "server", like `"/opt/nomad/server"`. This must be an absolute
    47    path.
    48  
    49  - `enabled` `(bool: false)` - Specifies if this agent should run in server mode.
    50    All other server options depend on this value being set.
    51  
    52  - `enabled_schedulers` `(array<string>: [all])` - Specifies which sub-schedulers
    53    this server will handle. This can be used to restrict the evaluations that
    54    worker threads will dequeue for processing.
    55  
    56  - `encrypt` `(string: "")` - Specifies the secret key to use for encryption of
    57    Nomad server's gossip network traffic. This key must be 16-bytes that are
    58    base64-encoded. The provided key is automatically persisted to the data
    59    directory and loaded automatically whenever the agent is restarted. This means
    60    that to encrypt Nomad server's gossip protocol, this option only needs to be
    61    provided once on each agent's initial startup sequence. If it is provided
    62    after Nomad has been initialized with an encryption key, then the provided key
    63    is ignored and a warning will be displayed. See the
    64    [Nomad encryption documentation][encryption] for more details on this option
    65    and its impact on the cluster.
    66  
    67  - `node_gc_threshold` `(string: "24h")` - Specifies how long a node must be in a
    68    terminal state before it is garbage collected and purged from the system. This
    69    is specified using a label suffix like "30s" or "1h".
    70  
    71  - `job_gc_threshold` `(string: "4h")` - Specifies the minimum time a job must be
    72    in the terminal state before it is eligible for garbage collection. This is
    73    specified using a label suffix like "30s" or "1h".
    74  
    75  - `eval_gc_threshold` `(string: "1h")` - Specifies the minimum time an
    76    evaluation must be in the terminal state before it is eligible for garbage
    77    collection. This is specified using a label suffix like "30s" or "1h".
    78  
    79  - `num_schedulers` `(int: [num-cores])` - Specifies the number of parallel
    80    scheduler threads to run. This can be as many as one per core, or `0` to
    81    disallow this server from making any scheduling decisions. This defaults to
    82    the number of CPU cores.
    83  
    84  - `protocol_version` `(int: 1)` - Specifies the Nomad protocol version to use
    85    when communicating with other Nomad servers. This value is typically not
    86    required as the agent internally knows the latest version, but may be useful
    87    in some upgrade scenarios.
    88  
    89  - `rejoin_after_leave` `(bool: false)` - Specifies if Nomad will ignore a
    90    previous leave and attempt to rejoin the cluster when starting. By default,
    91    Nomad treats leave as a permanent intent and does not attempt to join the
    92    cluster again when starting. This flag allows the previous state to be used to
    93    rejoin the cluster.
    94  
    95  - `retry_join` `(array<string>: [])` - Specifies a list of server addresses to
    96    retry joining if the first attempt fails. This is similar to
    97    [`start_join`](#start_join), but only invokes if the initial join attempt
    98    fails. The list of addresses will be tried in the order specified, until one
    99    succeeds. After one succeeds, no further addresses will be contacted. This is
   100    useful for cases where we know the address will become available eventually.
   101    Use `retry_join` with an array as a replacement for `start_join`, **do not use
   102    both options**. See the [server address format](#server-address-format)
   103    section for more information on the format of the string.
   104  
   105  - `retry_interval` `(string: "30s")` - Specifies the time to wait between retry
   106    join attempts.
   107  
   108  - `retry_max` `(int: 0)` - Specifies the maximum number of join attempts to be
   109    made before exiting with a return code of 1. By default, this is set to 0
   110    which is interpreted as infinite retries.
   111  
   112  - `start_join` `(array<string>: [])` - Specifies a list of server addresses to
   113    join on startup. If Nomad is unable to join with any of the specified
   114    addresses, agent startup will fail. See the
   115    [server address format](#server-address-format) section for more information
   116    on the format of the string.
   117  
   118  ### Server Address Format
   119  
   120  This section describes the acceptable syntax and format for describing the
   121  location of a Nomad server. There are many ways to reference a Nomad server,
   122  including directly by IP address and resolving through DNS.
   123  
   124  #### Directly via IP Address
   125  
   126  It is possible to address another Nomad server using its IP address. This is
   127  done in the `ip:port` format, such as:
   128  
   129  ```
   130  1.2.3.4:5678
   131  ```
   132  
   133  If the port option is omitted, it defaults to the Serf port, which is 4648
   134  unless configured otherwise:
   135  
   136  ```
   137  1.2.3.4 => 1.2.3.4:4648
   138  ```
   139  
   140  #### Via Domains or DNS
   141  
   142  It is possible to address another Nomad server using its DNS address. This is
   143  done in the `address:port` format, such as:
   144  
   145  ```
   146  nomad-01.company.local:5678
   147  ```
   148  
   149  If the port option is omitted, it defaults to the Serf port, which is 4648
   150  unless configured otherwise:
   151  
   152  ```
   153  nomad-01.company.local => nomad-01.company.local:4648
   154  ```
   155  
   156  ## `server` Examples
   157  
   158  ### Common Setup
   159  
   160  This example shows a common Nomad agent `server` configuration stanza. The two
   161  IP addresses could also be DNS, and should point to the other Nomad servers in
   162  the cluster
   163  
   164  ```hcl
   165  server {
   166    enabled          = true
   167    bootstrap_expect = 3
   168    retry_join       = ["1.2.3.4", "5.6.7.8"]
   169  }
   170  ```
   171  
   172  ### Configuring Data Directory
   173  
   174  This example shows configuring a custom data directory for the server data.
   175  
   176  ```hcl
   177  server {
   178    data_dir = "/opt/nomad/server"
   179  }
   180  ```
   181  
   182  ### Automatic Bootstrapping
   183  
   184  The Nomad servers can automatically bootstrap if Consul is configured. For a
   185  more detailed explanation, please see the
   186  [automatic Nomad bootstrapping documentation](/guides/cluster/automatic.html).
   187  
   188  ### Restricting Schedulers
   189  
   190  This example shows restricting the schedulers that are enabled as well as the
   191  maximum number of cores to utilize when participating in scheduling decisions:
   192  
   193  ```hcl
   194  server {
   195    enabled            = true
   196    enabled_schedulers = ["batch", "service"]
   197    num_schedulers     = 7
   198  }
   199  ```
   200  
   201  [encryption]: /docs/agent/encryption.html "Nomad Agent Encryption"