github.com/clly/consul@v1.4.5/website/source/api/operator/area.html.md (about)

     1  ---
     2  layout: api
     3  page_title: Network Areas - Operator - HTTP API
     4  sidebar_current: api-operator-area
     5  description: |-
     6    The /operator/area endpoints expose the network tomography information via
     7    Consul's HTTP API.
     8  ---
     9  
    10  # Network Areas - Operator HTTP API
    11  
    12  The `/operator/area` endpoints provide tools to manage network areas via
    13  Consul's HTTP API.
    14  
    15  ~> **Enterprise Only!** This API endpoint and functionality only exists in
    16  Consul Enterprise. This is not present in the open source version of Consul.
    17  
    18  The network area functionality described here is available only in
    19  [Consul Enterprise](https://www.hashicorp.com/products/consul/) version 0.8.0 and
    20  later. Network areas are operator-defined relationships between servers in two
    21  different Consul datacenters.
    22  
    23  Unlike Consul's WAN feature, network areas use just the server RPC port for
    24  communication, and relationships can be made between independent pairs of
    25  datacenters, so not all servers need to be fully connected. This allows for
    26  complex topologies among Consul datacenters like hub/spoke and more general
    27  trees.
    28  
    29  Please see the [Network Areas Guide](/docs/guides/areas.html) for more details.
    30  
    31  ## Create Network Area
    32  
    33  This endpoint creates a new network area and returns its ID if it is created
    34  successfully.
    35  
    36  | Method | Path                         | Produces                   |
    37  | ------ | ---------------------------- | -------------------------- |
    38  | `POST` | `/operator/area`             | `application/json`         |
    39  
    40  The table below shows this endpoint's support for
    41  [blocking queries](/api/index.html#blocking-queries),
    42  [consistency modes](/api/index.html#consistency-modes),
    43  [agent caching](/api/index.html#agent-caching), and
    44  [required ACLs](/api/index.html#acls).
    45  
    46  | Blocking Queries | Consistency Modes | Agent Caching | ACL Required     |
    47  | ---------------- | ----------------- | ------------- | ---------------- |
    48  | `NO`             | `none`            | `none`        | `operator:write` |
    49  
    50  ### Parameters
    51  
    52  - `dc` `(string: "")` - Specifies the datacenter to query. This will default to
    53    the datacenter of the agent being queried. This is specified as a URL query
    54    parameter.
    55  
    56  - `PeerDatacenter` `(string: <required>)` - Specifies the name of the Consul
    57    datacenter that will be joined the Consul servers in the current datacenter to
    58    form the area. Only one area is allowed for each possible `PeerDatacenter`,
    59    and a datacenter cannot form an area with itself.
    60  
    61  - `RetryJoin` `(array<string>: nil)`- Specifies a list of Consul servers to
    62    attempt to join. Servers can be given as `IP`, `IP:port`, `hostname`, or
    63    `hostname:port`. Consul will spawn a background task that tries to
    64    periodically join the servers in this list and will run until a join succeeds.
    65    If this list is not supplied, joining can be done with a call to the
    66    [join endpoint](#area-join) once the network area is created.
    67  
    68  - `UseTLS` `(bool: <optional>)` - Specifies whether gossip over this area should be
    69    encrypted with TLS if possible.
    70  
    71  ### Sample Payload
    72  
    73  ```json
    74  {
    75    "PeerDatacenter": "dc2",
    76    "RetryJoin": [ "10.1.2.3", "10.1.2.4", "10.1.2.5" ],
    77    "UseTLS": false
    78  }
    79  ```
    80  
    81  ### Sample Request
    82  
    83  ```text
    84  $ curl \
    85      --request POST \
    86      --data @payload.json \
    87      http://127.0.0.1:8500/v1/operator/area
    88  ```
    89  
    90  ### Sample Response
    91  
    92  ```json
    93  {
    94    "ID": "8f246b77-f3e1-ff88-5b48-8ec93abf3e05"
    95  }
    96  ```
    97  
    98  ## List Network Areas
    99  
   100  This endpoint lists all network areas.
   101  
   102  | Method | Path                         | Produces                   |
   103  | ------ | ---------------------------- | -------------------------- |
   104  | `GET`  | `/operator/area`             | `application/json`         |
   105  
   106  The table below shows this endpoint's support for
   107  [blocking queries](/api/index.html#blocking-queries),
   108  [consistency modes](/api/index.html#consistency-modes),
   109  [agent caching](/api/index.html#agent-caching), and
   110  [required ACLs](/api/index.html#acls).
   111  
   112  | Blocking Queries | Consistency Modes | Agent Caching | ACL Required    |
   113  | ---------------- | ----------------- | ------------- | --------------- |
   114  | `YES`            | `all`             | `none`        | `operator:read` |
   115  
   116  ### Parameters
   117  
   118  - `dc` `(string: "")` - Specifies the datacenter to query. This will default to
   119    the datacenter of the agent being queried. This is specified as a URL query
   120    parameter.
   121  
   122  ### Sample Request
   123  
   124  ```text
   125  $ curl \
   126      http://127.0.0.1:8500/v1/operator/area
   127  ```
   128  
   129  ### Sample Response
   130  
   131  ```json
   132  [
   133    {
   134      "ID": "8f246b77-f3e1-ff88-5b48-8ec93abf3e05",
   135      "PeerDatacenter": "dc2",
   136      "RetryJoin": ["10.1.2.3", "10.1.2.4", "10.1.2.5"]
   137    }
   138  ]
   139  ```
   140  
   141  ## Update Network Area
   142  
   143  This endpoint updates a network area to the given configuration.
   144  
   145  | Method | Path                         | Produces                   |
   146  | ------ | ---------------------------- | -------------------------- |
   147  | `PUT`  | `/operator/area/:uuid`       | `application/json`         |
   148  
   149  The table below shows this endpoint's support for
   150  [blocking queries](/api/index.html#blocking-queries),
   151  [consistency modes](/api/index.html#consistency-modes),
   152  [agent caching](/api/index.html#agent-caching), and
   153  [required ACLs](/api/index.html#acls).
   154  
   155  | Blocking Queries | Consistency Modes | Agent Caching | ACL Required     |
   156  | ---------------- | ----------------- | ------------- | ---------------- |
   157  | `NO`             | `none`            | `none`        | `operator:write` |
   158  
   159  ### Parameters
   160  
   161  - `dc` `(string: "")` - Specifies the datacenter to query. This will default to
   162    the datacenter of the agent being queried. This is specified as a URL query
   163    parameter.
   164  
   165  - `UseTLS` `(bool: <optional>)` - Specifies whether gossip over this area should be
   166    encrypted with TLS if possible.
   167  
   168  ### Sample Payload
   169  
   170  ```json
   171  {
   172    "UseTLS": true
   173  }
   174  ```
   175  
   176  ### Sample Request
   177  
   178  ```text
   179  $ curl \
   180      --request PUT \
   181      --data @payload.json \
   182      http://127.0.0.1:8500/v1/operator/area/8f246b77-f3e1-ff88-5b48-8ec93abf3e05
   183  ```
   184  
   185  ## List Specific Network Area
   186  
   187  This endpoint lists a specific network area.
   188  
   189  | Method | Path                         | Produces                   |
   190  | ------ | ---------------------------- | -------------------------- |
   191  | `GET`  | `/operator/area/:uuid`       | `application/json`         |
   192  
   193  The table below shows this endpoint's support for
   194  [blocking queries](/api/index.html#blocking-queries),
   195  [consistency modes](/api/index.html#consistency-modes),
   196  [agent caching](/api/index.html#agent-caching), and
   197  [required ACLs](/api/index.html#acls).
   198  
   199  | Blocking Queries | Consistency Modes | Agent Caching | ACL Required    |
   200  | ---------------- | ----------------- | ------------- | --------------- |
   201  | `YES`            | `all`             | `none`        | `operator:read` |
   202  
   203  ### Parameters
   204  
   205  - `uuid` `(string: <required>)` - Specifies the UUID of the area to list. This
   206    is specified as part of the URL.
   207  
   208  - `dc` `(string: "")` - Specifies the datacenter to query. This will default to
   209    the datacenter of the agent being queried. This is specified as a URL query
   210    parameter.
   211  
   212  ### Sample Request
   213  
   214  ```text
   215  $ curl \
   216      http://127.0.0.1:8500/v1/operator/area/8f246b77-f3e1-ff88-5b48-8ec93abf3e05
   217  ```
   218  
   219  ### Sample Response
   220  
   221  ```json
   222  [
   223    {
   224      "ID": "8f246b77-f3e1-ff88-5b48-8ec93abf3e05",
   225      "PeerDatacenter": "dc2",
   226      "RetryJoin": ["10.1.2.3", "10.1.2.4", "10.1.2.5"]
   227    }
   228  ]
   229  ```
   230  
   231  ## Delete Network Area
   232  
   233  This endpoint deletes a specific network area.
   234  
   235  | Method   | Path                         | Produces                   |
   236  | -------- | ---------------------------- | -------------------------- |
   237  | `DELETE` | `/operator/area/:uuid`       | `application/json`         |
   238  
   239  The table below shows this endpoint's support for
   240  [blocking queries](/api/index.html#blocking-queries),
   241  [consistency modes](/api/index.html#consistency-modes),
   242  [agent caching](/api/index.html#agent-caching), and
   243  [required ACLs](/api/index.html#acls).
   244  
   245  | Blocking Queries | Consistency Modes | Agent Caching | ACL Required     |
   246  | ---------------- | ----------------- | ------------- | ---------------- |
   247  | `NO`             | `none`            | `none`        | `operator:write` |
   248  
   249  ### Parameters
   250  
   251  - `uuid` `(string: <required>)` - Specifies the UUID of the area to delete. This
   252    is specified as part of the URL.
   253  
   254  - `dc` `(string: "")` - Specifies the datacenter to query. This will default to
   255    the datacenter of the agent being queried. This is specified as a URL query
   256    parameter.
   257  
   258  ### Sample Request
   259  
   260  ```text
   261  $ curl \
   262      --request DELETE \
   263      http://127.0.0.1:8500/v1/operator/area/8f246b77-f3e1-ff88-5b48-8ec93abf3e05
   264  ```
   265  
   266  ## Join Network Area
   267  
   268  This endpoint attempts to join the given Consul servers into a specific network
   269  area.
   270  
   271  | Method | Path                         | Produces                   |
   272  | ------ | ---------------------------- | -------------------------- |
   273  | `PUT`  | `/operator/area/:uuid/join`  | `application/json`         |
   274  
   275  The table below shows this endpoint's support for
   276  [blocking queries](/api/index.html#blocking-queries),
   277  [consistency modes](/api/index.html#consistency-modes),
   278  [agent caching](/api/index.html#agent-caching), and
   279  [required ACLs](/api/index.html#acls).
   280  
   281  | Blocking Queries | Consistency Modes | Agent Caching | ACL Required     |
   282  | ---------------- | ----------------- | ------------- | ---------------- |
   283  | `NO`             | `none`            | `none`        | `operator:write` |
   284  
   285  ### Parameters
   286  
   287  - `uuid` `(string: <required>)` - Specifies the UUID of the area to join. This
   288    is specified as part of the URL.
   289  
   290  - `dc` `(string: "")` - Specifies the datacenter to query. This will default to
   291    the datacenter of the agent being queried. This is specified as a URL query
   292    parameter.
   293  
   294  ### Sample Payload
   295  
   296  ```json
   297  ["10.1.2.3", "10.1.2.4", "10.1.2.5"]
   298  ```
   299  
   300  This can be provided as `IP`, `IP:port`, `hostname`, or `hostname:port`.
   301  
   302  ### Sample Request
   303  
   304  ```text
   305  $ curl \
   306      --request PUT \
   307      --data @payload.json \
   308      http://127.0.0.1:8500/v1/operator/area/8f246b77-f3e1-ff88-5b48-8ec93abf3e05/join
   309  ```
   310  
   311  ### Sample Response
   312  
   313  ```json
   314  [
   315    {
   316      "Address": "10.1.2.3",
   317      "Joined": true,
   318      "Error": ""
   319    },
   320    {
   321      "Address": "10.1.2.4",
   322      "Joined": true,
   323      "Error": ""
   324    },
   325    {
   326      "Address": "10.1.2.5",
   327      "Joined": true,
   328      "Error": ""
   329    }
   330  ]
   331  ```
   332  
   333  - `Address` has the address requested to join.
   334  
   335  - `Joined` will be `true` if the Consul server at the given address was
   336    successfully joined into the network area. Otherwise, this will be `false` and
   337    `Error` will have a human-readable message about why the join didn't succeed.
   338  
   339  ## List Network Area Members
   340  
   341  This endpoint provides a listing of the Consul servers present in a specific
   342  network area.
   343  
   344  | Method | Path                           | Produces                   |
   345  | ------ | ------------------------------ | -------------------------- |
   346  | `GET`  | `/operator/area/:uuid/members` | `application/json`         |
   347  
   348  The table below shows this endpoint's support for
   349  [blocking queries](/api/index.html#blocking-queries),
   350  [consistency modes](/api/index.html#consistency-modes),
   351  [agent caching](/api/index.html#agent-caching), and
   352  [required ACLs](/api/index.html#acls).
   353  
   354  | Blocking Queries | Consistency Modes | Agent Caching | ACL Required    |
   355  | ---------------- | ----------------- | ------------- | --------------- |
   356  | `NO`             | `none`            | `none`        | `operator:read` |
   357  
   358  ### Parameters
   359  
   360  - `uuid` `(string: <required>)` - Specifies the UUID of the area to list. This
   361    is specified as part of the URL.
   362  
   363  - `dc` `(string: "")` - Specifies the datacenter to query. This will default to
   364    the datacenter of the agent being queried. This is specified as a URL query
   365    parameter.
   366  
   367  ### Sample Request
   368  
   369  ```text
   370  $ curl \
   371      http://127.0.0.1:8500/v1/operator/area/8f246b77-f3e1-ff88-5b48-8ec93abf3e05/members
   372  ```
   373  
   374  ### Sample Response
   375  
   376  ```json
   377  [
   378    {
   379      "ID": "afc5d95c-1eee-4b46-b85b-0efe4c76dd48",
   380      "Name": "node-2.dc1",
   381      "Addr": "127.0.0.2",
   382      "Port": 8300,
   383      "Datacenter": "dc1",
   384      "Role": "server",
   385      "Build": "0.8.0",
   386      "Protocol": 2,
   387      "Status": "alive",
   388      "RTT": 256478
   389    },
   390  ]
   391  ```
   392  
   393  - `ID` is the node ID of the server.
   394  
   395  - `Name` is the node name of the server, with its datacenter appended.
   396  
   397  - `Addr` is the IP address of the node.
   398  
   399  - `Port` is the server RPC port of the node.
   400  
   401  - `Datacenter` is the node's Consul datacenter.
   402  
   403  - `Role` is always "server" since only Consul servers can participate in network
   404    areas.
   405  
   406  - `Build` has the Consul version running on the node.
   407  
   408  - `Protocol` is the [protocol version](/docs/upgrading.html#protocol-versions)
   409    being spoken by the node.
   410  
   411  - `Status` is the current health status of the node, as determined by the
   412    network area distributed failure detector. This will be "alive", "leaving",
   413    "left", or "failed". A "failed" status means that other servers are not able
   414    to probe this server over its server RPC interface.
   415  
   416  - `RTT` is an estimated network round trip time from the server answering the
   417    query to the given server, in nanoseconds. This is computed using [network
   418    coordinates](/docs/internals/coordinates.html).