github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/api-docs/operator/autopilot.mdx (about) 1 --- 2 layout: api 3 page_title: Autopilot - Operator - HTTP API 4 sidebar_title: Autopilot 5 description: |- 6 The /operator/autopilot endpoints provide tools for managing Autopilot. 7 --- 8 9 # Autopilot Operator HTTP API 10 11 The `/operator/autopilot` endpoints allow for automatic operator-friendly 12 management of Nomad servers including cleanup of dead servers, monitoring the 13 state of the Raft cluster, and stable server introduction. 14 15 ## Read Autopilot Configuration 16 17 This endpoint retrieves its latest Autopilot configuration. 18 19 | Method | Path | Produces | 20 | ------ | -------------------------------------- | ------------------ | 21 | `GET` | `/v1/operator/autopilot/configuration` | `application/json` | 22 23 The table below shows this endpoint's support for 24 [blocking queries](/api-docs#blocking-queries) and 25 [required ACLs](/api-docs#acls). 26 27 | Blocking Queries | ACL Required | 28 | ---------------- | --------------- | 29 | `NO` | `operator:read` | 30 31 ### Sample Request 32 33 ```shell-session 34 $ curl \ 35 https://localhost:4646/v1/operator/autopilot/configuration 36 ``` 37 38 ### Sample Response 39 40 ```json 41 { 42 "CleanupDeadServers": true, 43 "LastContactThreshold": "200ms", 44 "MaxTrailingLogs": 250, 45 "ServerStabilizationTime": "10s", 46 "EnableRedundancyZones": false, 47 "DisableUpgradeMigration": false, 48 "EnableCustomUpgrades": false, 49 "CreateIndex": 4, 50 "ModifyIndex": 4 51 } 52 ``` 53 54 For more information about the Autopilot configuration options, see the 55 [agent configuration section](/docs/configuration/autopilot). 56 57 ## Update Autopilot Configuration 58 59 This endpoint updates the Autopilot configuration of the cluster. 60 61 | Method | Path | Produces | 62 | ------ | -------------------------------------- | ------------------ | 63 | `PUT` | `/v1/operator/autopilot/configuration` | `application/json` | 64 65 The table below shows this endpoint's support for 66 [blocking queries](/api-docs#blocking-queries) and 67 [required ACLs](/api-docs#acls). 68 69 | Blocking Queries | ACL Required | 70 | ---------------- | ---------------- | 71 | `NO` | `operator:write` | 72 73 ### Parameters 74 75 - `cas` `(int: 0)` - Specifies to use a Check-And-Set operation. The update will 76 only happen if the given index matches the `ModifyIndex` of the configuration 77 at the time of writing. 78 79 ### Sample Payload 80 81 ```json 82 { 83 "CleanupDeadServers": true, 84 "LastContactThreshold": "200ms", 85 "MaxTrailingLogs": 250, 86 "ServerStabilizationTime": "10s", 87 "EnableRedundancyZones": false, 88 "DisableUpgradeMigration": false, 89 "EnableCustomUpgrades": false, 90 "CreateIndex": 4, 91 "ModifyIndex": 4 92 } 93 ``` 94 95 - `CleanupDeadServers` `(bool: true)` - Specifies automatic removal of dead 96 server nodes periodically and whenever a new server is added to the cluster. 97 98 - `LastContactThreshold` `(string: "200ms")` - Specifies the maximum amount of 99 time a server can go without contact from the leader before being considered 100 unhealthy. Must be a duration value such as `10s`. 101 102 - `MaxTrailingLogs` `(int: 250)` specifies the maximum number of log entries 103 that a server can trail the leader by before being considered unhealthy. 104 105 - `ServerStabilizationTime` `(string: "10s")` - Specifies the minimum amount of 106 time a server must be stable in the 'healthy' state before being added to the 107 cluster. Only takes effect if all servers are running Raft protocol version 3 108 or higher. Must be a duration value such as `30s`. 109 110 - `EnableRedundancyZones` `(bool: false)` - (Enterprise-only) Specifies whether 111 to enable redundancy zones. 112 113 - `DisableUpgradeMigration` `(bool: false)` - (Enterprise-only) Disables Autopilot's 114 upgrade migration strategy in Nomad Enterprise of waiting until enough 115 newer-versioned servers have been added to the cluster before promoting any of 116 them to voters. 117 118 - `EnableCustomUpgrades` `(bool: false)` - (Enterprise-only) Specifies whether to 119 enable using custom upgrade versions when performing migrations. 120 121 ## Read Health 122 123 This endpoint queries the health of the autopilot status. 124 125 | Method | Path | Produces | 126 | ------ | ------------------------------- | ------------------ | 127 | `GET` | `/v1/operator/autopilot/health` | `application/json` | 128 129 The table below shows this endpoint's support for 130 [blocking queries](/api-docs#blocking-queries) and 131 [required ACLs](/api-docs#acls). 132 133 | Blocking Queries | ACL Required | 134 | ---------------- | --------------- | 135 | `NO` | `operator:read` | 136 137 ### Sample Request 138 139 ```shell-session 140 $ curl \ 141 https://localhost:4646/v1/operator/autopilot/health 142 ``` 143 144 ### Sample response 145 146 ```json 147 { 148 "Healthy": true, 149 "FailureTolerance": 0, 150 "Servers": [ 151 { 152 "ID": "e349749b-3303-3ddf-959c-b5885a0e1f6e", 153 "Name": "node1", 154 "Address": "127.0.0.1:8300", 155 "SerfStatus": "alive", 156 "Version": "0.8.0", 157 "Leader": true, 158 "LastContact": "0s", 159 "LastTerm": 2, 160 "LastIndex": 46, 161 "Healthy": true, 162 "Voter": true, 163 "StableSince": "2017-03-06T22:07:51Z" 164 }, 165 { 166 "ID": "e36ee410-cc3c-0a0c-c724-63817ab30303", 167 "Name": "node2", 168 "Address": "127.0.0.1:8205", 169 "SerfStatus": "alive", 170 "Version": "0.8.0", 171 "Leader": false, 172 "LastContact": "27.291304ms", 173 "LastTerm": 2, 174 "LastIndex": 46, 175 "Healthy": true, 176 "Voter": false, 177 "StableSince": "2017-03-06T22:18:26Z" 178 } 179 ] 180 } 181 ``` 182 183 - `Healthy` is whether all the servers are currently healthy. 184 185 - `FailureTolerance` is the number of redundant healthy servers that could be 186 fail without causing an outage (this would be 2 in a healthy cluster of 5 187 servers). 188 189 - `Servers` holds detailed health information on each server: 190 191 - `ID` is the Raft ID of the server. 192 193 - `Name` is the node name of the server. 194 195 - `Address` is the address of the server. 196 197 - `SerfStatus` is the SerfHealth check status for the server. 198 199 - `Version` is the Nomad version of the server. 200 201 - `Leader` is whether this server is currently the leader. 202 203 - `LastContact` is the time elapsed since this server's last contact with the leader. 204 205 - `LastTerm` is the server's last known Raft leader term. 206 207 - `LastIndex` is the index of the server's last committed Raft log entry. 208 209 - `Healthy` is whether the server is healthy according to the current Autopilot configuration. 210 211 - `Voter` is whether the server is a voting member of the Raft cluster. 212 213 - `StableSince` is the time this server has been in its current `Healthy` state. 214 215 The HTTP status code will indicate the health of the cluster. If `Healthy` is true, then a 216 status of 200 will be returned. If `Healthy` is false, then a status of 429 will be returned.