github.com/quite/nomad@v0.8.6/website/source/api/nodes.html.md (about) 1 --- 2 layout: api 3 page_title: Nodes - HTTP API 4 sidebar_current: api-nodes 5 description: |- 6 The /node endpoints are used to query for and interact with client nodes. 7 --- 8 9 # Nodes HTTP API 10 11 The `/node` endpoints are used to query for and interact with client nodes. 12 13 ### List Nodes 14 15 This endpoint lists all nodes registered with Nomad. 16 17 | Method | Path | Produces | 18 | ------ | ------------------------- | -------------------------- | 19 | `GET` | `/v1/nodes` | `application/json` | 20 21 The table below shows this endpoint's support for 22 [blocking queries](/api/index.html#blocking-queries) and 23 [required ACLs](/api/index.html#acls). 24 25 | Blocking Queries | ACL Required | 26 | ---------------- | ------------ | 27 | `YES` | `node:read` | 28 29 ### Parameters 30 31 - `prefix` `(string: "")`- Specifies a string to filter nodes on based on an 32 index prefix. This is specified as a querystring parameter. 33 34 ### Sample Request 35 36 ```text 37 $ curl \ 38 http://localhost:4646/v1/nodes 39 ``` 40 41 ```text 42 $ curl \ 43 http://localhost:4646/v1/nodes?prefix=prod 44 ``` 45 46 ### Sample Response 47 48 ```json 49 [ 50 { 51 "Address": "10.138.0.5", 52 "CreateIndex": 6, 53 "Datacenter": "dc1", 54 "Drain": false, 55 "Drivers": { 56 "java": { 57 "Attributes": { 58 "driver.java.runtime": "OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-1~deb9u1-b12)", 59 "driver.java.vm": "OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)", 60 "driver.java.version": "openjdk version \"1.8.0_162" 61 }, 62 "Detected": true, 63 "HealthDescription": "", 64 "Healthy": true, 65 "UpdateTime": "2018-04-11T23:33:48.781948669Z" 66 }, 67 "qemu": { 68 "Attributes": null, 69 "Detected": false, 70 "HealthDescription": "", 71 "Healthy": false, 72 "UpdateTime": "2018-04-11T23:33:48.7819898Z" 73 }, 74 "rkt": { 75 "Attributes": { 76 "driver.rkt.appc.version": "0.8.11", 77 "driver.rkt.volumes.enabled": "1", 78 "driver.rkt.version": "1.29.0" 79 }, 80 "Detected": true, 81 "HealthDescription": "Driver rkt is detected: true", 82 "Healthy": true, 83 "UpdateTime": "2018-04-11T23:34:48.81079772Z" 84 }, 85 "docker": { 86 "Attributes": { 87 "driver.docker.bridge_ip": "172.17.0.1", 88 "driver.docker.version": "18.03.0-ce", 89 "driver.docker.volumes.enabled": "1" 90 }, 91 "Detected": true, 92 "HealthDescription": "Driver is available and responsive", 93 "Healthy": true, 94 "UpdateTime": "2018-04-11T23:34:48.713720323Z" 95 }, 96 "exec": { 97 "Attributes": {}, 98 "Detected": true, 99 "HealthDescription": "Driver exec is detected: true", 100 "Healthy": true, 101 "UpdateTime": "2018-04-11T23:34:48.711026521Z" 102 }, 103 "raw_exec": { 104 "Attributes": {}, 105 "Detected": true, 106 "HealthDescription": "", 107 "Healthy": true, 108 "UpdateTime": "2018-04-11T23:33:48.710448534Z" 109 } 110 }, 111 "ID": "f7476465-4d6e-c0de-26d0-e383c49be941", 112 "ModifyIndex": 2526, 113 "Name": "nomad-4", 114 "NodeClass": "", 115 "SchedulingEligibility": "eligible", 116 "Status": "ready", 117 "StatusDescription": "", 118 "Version": "0.8.0-rc1" 119 } 120 ] 121 ``` 122 123 ## Read Node 124 125 This endpoint queries the status of a client node. 126 127 | Method | Path | Produces | 128 | ------ | ------------------------- | -------------------------- | 129 | `GET` | `/v1/node/:node_id` | `application/json` | 130 131 The table below shows this endpoint's support for 132 [blocking queries](/api/index.html#blocking-queries) and 133 [required ACLs](/api/index.html#acls). 134 135 | Blocking Queries | ACL Required | 136 | ---------------- | ----------------- | 137 | `YES` | `node:read` | 138 139 ### Parameters 140 141 - `:node_id` `(string: <required>)`- Specifies the ID of the node. This must be 142 the full UUID, not the short 8-character one. This is specified as part of the 143 path. 144 145 ### Sample Request 146 147 ```text 148 $ curl \ 149 http://localhost:4646/v1/node/f7476465-4d6e-c0de-26d0-e383c49be941 150 ``` 151 152 ### Sample Response 153 154 ```json 155 { 156 "Attributes": { 157 "driver.rkt": "1", 158 "driver.docker.bridge_ip": "172.17.0.1", 159 "unique.storage.volume": "/dev/sda1", 160 "driver.exec": "1", 161 "driver.rkt.volumes.enabled": "1", 162 "os.signals": "SIGSTOP,SIGTTIN,SIGWINCH,SIGXCPU,SIGXFSZ,SIGIO,SIGKILL,SIGTTOU,SIGINT,SIGHUP,SIGTRAP,SIGALRM,SIGPIPE,SIGURG,SIGABRT,SIGSEGV,SIGIOT,SIGTERM,SIGBUS,SIGPROF,SIGQUIT,SIGTSTP,SIGUSR2,SIGFPE,SIGCONT,SIGILL,SIGSYS,SIGUSR1,SIGCHLD", 163 "cpu.totalcompute": "2200", 164 "driver.raw_exec": "1", 165 "driver.java.version": "openjdk version \"1.8.0_162", 166 "kernel.name": "linux", 167 "unique.cgroup.mountpoint": "/sys/fs/cgroup", 168 "driver.docker.volumes.enabled": "1", 169 "cpu.frequency": "2200", 170 "consul.datacenter": "dc1", 171 "unique.storage.bytestotal": "31637520384", 172 "unique.network.ip-address": "10.138.0.5", 173 "os.version": "9.4", 174 "unique.hostname": "nomad-4", 175 "driver.rkt.version": "1.29.0", 176 "driver.java.vm": "OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)", 177 "consul.server": "false", 178 "kernel.version": "4.9.0-6-amd64", 179 "cpu.numcores": "1", 180 "driver.docker.version": "18.03.0-ce", 181 "unique.consul.name": "nomad-4", 182 "driver.java": "1", 183 "consul.revision": "9a494b5f+CHANGES", 184 "os.name": "debian", 185 "consul.version": "1.0.6", 186 "driver.java.runtime": "OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-1~deb9u1-b12)", 187 "nomad.version": "0.8.0-rc1", 188 "memory.totalbytes": "3883982848", 189 "unique.storage.bytesfree": "26626150400", 190 "driver.docker": "1", 191 "cpu.modelname": "Intel(R) Xeon(R) CPU @ 2.20GHz", 192 "cpu.arch": "amd64", 193 "driver.rkt.appc.version": "0.8.11" 194 }, 195 "ComputedClass": "v1:1652208824869124256", 196 "CreateIndex": 6, 197 "Datacenter": "dc1", 198 "Drain": false, 199 "DrainStrategy": null, 200 "Drivers": { 201 "java": { 202 "Attributes": { 203 "driver.java.runtime": "OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-1~deb9u1-b12)", 204 "driver.java.vm": "OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)", 205 "driver.java.version": "openjdk version \"1.8.0_162" 206 }, 207 "Detected": true, 208 "HealthDescription": "", 209 "Healthy": true, 210 "UpdateTime": "2018-04-11T23:33:48.781948669Z" 211 }, 212 "qemu": { 213 "Attributes": null, 214 "Detected": false, 215 "HealthDescription": "", 216 "Healthy": false, 217 "UpdateTime": "2018-04-11T23:33:48.7819898Z" 218 }, 219 "rkt": { 220 "Attributes": { 221 "driver.rkt.appc.version": "0.8.11", 222 "driver.rkt.volumes.enabled": "1", 223 "driver.rkt.version": "1.29.0" 224 }, 225 "Detected": true, 226 "HealthDescription": "Driver rkt is detected: true", 227 "Healthy": true, 228 "UpdateTime": "2018-04-11T23:34:48.81079772Z" 229 }, 230 "docker": { 231 "Attributes": { 232 "driver.docker.bridge_ip": "172.17.0.1", 233 "driver.docker.version": "18.03.0-ce", 234 "driver.docker.volumes.enabled": "1" 235 }, 236 "Detected": true, 237 "HealthDescription": "Driver is available and responsive", 238 "Healthy": true, 239 "UpdateTime": "2018-04-11T23:34:48.713720323Z" 240 }, 241 "exec": { 242 "Attributes": {}, 243 "Detected": true, 244 "HealthDescription": "Driver exec is detected: true", 245 "Healthy": true, 246 "UpdateTime": "2018-04-11T23:34:48.711026521Z" 247 }, 248 "raw_exec": { 249 "Attributes": {}, 250 "Detected": true, 251 "HealthDescription": "", 252 "Healthy": true, 253 "UpdateTime": "2018-04-11T23:33:48.710448534Z" 254 } 255 }, 256 "Events": [ 257 { 258 "CreateIndex": 0, 259 "Details": null, 260 "Message": "Node registered", 261 "Subsystem": "Cluster", 262 "Timestamp": "2018-04-10T23:43:17Z" 263 } 264 ], 265 "HTTPAddr": "10.138.0.5:4646", 266 "ID": "f7476465-4d6e-c0de-26d0-e383c49be941", 267 "Links": { 268 "consul": "dc1.nomad-4" 269 }, 270 "Meta": null, 271 "ModifyIndex": 2526, 272 "Name": "nomad-4", 273 "NodeClass": "", 274 "Reserved": { 275 "CPU": 0, 276 "DiskMB": 0, 277 "IOPS": 0, 278 "MemoryMB": 0, 279 "Networks": null 280 }, 281 "Resources": { 282 "CPU": 2200, 283 "DiskMB": 25392, 284 "IOPS": 0, 285 "MemoryMB": 3704, 286 "Networks": [ 287 { 288 "CIDR": "10.138.0.5/32", 289 "Device": "eth0", 290 "DynamicPorts": null, 291 "IP": "10.138.0.5", 292 "MBits": 1000, 293 "ReservedPorts": null 294 } 295 ] 296 }, 297 "SchedulingEligibility": "eligible", 298 "SecretID": "", 299 "Status": "ready", 300 "StatusDescription": "", 301 "StatusUpdatedAt": 1523552938, 302 "TLSEnabled": false 303 } 304 ``` 305 306 ## List Node Allocations 307 308 This endpoint lists all of the allocations for the given node. This can be used to 309 determine what allocations have been scheduled on the node, their current status, 310 and the values of dynamically assigned resources, like ports. 311 312 | Method | Path | Produces | 313 | ------- | ------------------------------- | -------------------------- | 314 | `GET` | `/v1/node/:node_id/allocations` | `application/json` | 315 316 The table below shows this endpoint's support for 317 [blocking queries](/api/index.html#blocking-queries) and 318 [required ACLs](/api/index.html#acls). 319 320 | Blocking Queries | ACL Required | 321 | ---------------- | ------------------------------ | 322 | `YES` | `node:read,namespace:read-job` | 323 324 ### Parameters 325 326 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 327 be the full UUID, not the short 8-character one. This is specified as part of 328 the path. 329 330 ### Sample Request 331 332 ```text 333 $ curl \ 334 http://localhost:4646/v1/node/e02b6169-83bd-9df6-69bd-832765f333eb/allocations 335 ``` 336 337 ### Sample Response 338 339 ```json 340 [ 341 { 342 "AllocModifyIndex": 2555, 343 "ClientDescription": "", 344 "ClientStatus": "running", 345 "CreateIndex": 2555, 346 "CreateTime": 1523490066575461000, 347 "DeploymentID": "", 348 "DeploymentStatus": { 349 "Healthy": true, 350 "ModifyIndex": 0 351 }, 352 "DesiredDescription": "", 353 "DesiredStatus": "run", 354 "DesiredTransition": { 355 "Migrate": null 356 }, 357 "EvalID": "5129bc74-9785-c39a-08da-bddc8aa778b1", 358 "FollowupEvalID": "", 359 "ID": "fefe81d0-08b2-4eca-fae6-6560cde46d31", 360 "Job": { 361 "AllAtOnce": false, 362 "Constraints": null, 363 "CreateIndex": 2553, 364 "Datacenters": [ 365 "dc1" 366 ], 367 "ID": "webapp", 368 "JobModifyIndex": 2553, 369 "Meta": null, 370 "ModifyIndex": 2554, 371 "Name": "webapp", 372 "Namespace": "default", 373 "ParameterizedJob": null, 374 "ParentID": "", 375 "Payload": null, 376 "Periodic": null, 377 "Priority": 50, 378 "Region": "global", 379 "Stable": false, 380 "Status": "pending", 381 "StatusDescription": "", 382 "Stop": false, 383 "SubmitTime": 1523490066563405000, 384 "TaskGroups": [ 385 { 386 "Constraints": null, 387 "Count": 9, 388 "EphemeralDisk": { 389 "Migrate": false, 390 "SizeMB": 300, 391 "Sticky": false 392 }, 393 "Meta": null, 394 "Migrate": { 395 "HealthCheck": "checks", 396 "HealthyDeadline": 300000000000, 397 "MaxParallel": 2, 398 "MinHealthyTime": 15000000000 399 }, 400 "Name": "webapp", 401 "ReschedulePolicy": { 402 "Attempts": 0, 403 "Delay": 30000000000, 404 "DelayFunction": "exponential", 405 "Interval": 0, 406 "MaxDelay": 3600000000000, 407 "Unlimited": true 408 }, 409 "RestartPolicy": { 410 "Attempts": 2, 411 "Delay": 15000000000, 412 "Interval": 1800000000000, 413 "Mode": "fail" 414 }, 415 "Tasks": [ 416 { 417 "Artifacts": null, 418 "Config": { 419 "args": [ 420 "-text", 421 "ok4" 422 ], 423 "image": "hashicorp/http-echo:0.2.3", 424 "port_map": [ 425 { 426 "http": 5678 427 } 428 ] 429 }, 430 "Constraints": null, 431 "DispatchPayload": null, 432 "Driver": "docker", 433 "Env": null, 434 "KillSignal": "", 435 "KillTimeout": 5000000000, 436 "Leader": false, 437 "LogConfig": { 438 "MaxFileSizeMB": 10, 439 "MaxFiles": 10 440 }, 441 "Meta": null, 442 "Name": "webapp", 443 "Resources": { 444 "CPU": 100, 445 "DiskMB": 0, 446 "IOPS": 0, 447 "MemoryMB": 300, 448 "Networks": [ 449 { 450 "CIDR": "", 451 "Device": "", 452 "DynamicPorts": [ 453 { 454 "Label": "http", 455 "Value": 0 456 } 457 ], 458 "IP": "", 459 "MBits": 10, 460 "ReservedPorts": null 461 } 462 ] 463 }, 464 "Services": [ 465 { 466 "AddressMode": "auto", 467 "Checks": [ 468 { 469 "AddressMode": "", 470 "Args": null, 471 "CheckRestart": null, 472 "Command": "", 473 "Header": null, 474 "InitialStatus": "", 475 "Interval": 10000000000, 476 "Method": "", 477 "Name": "http-ok", 478 "Path": "/", 479 "PortLabel": "", 480 "Protocol": "", 481 "TLSSkipVerify": false, 482 "Timeout": 2000000000, 483 "Type": "http" 484 } 485 ], 486 "Name": "webapp", 487 "PortLabel": "http", 488 "Tags": null 489 } 490 ], 491 "ShutdownDelay": 0, 492 "Templates": null, 493 "User": "", 494 "Vault": null 495 } 496 ], 497 "Update": null 498 } 499 ], 500 "Type": "service", 501 "Update": { 502 "AutoRevert": false, 503 "Canary": 0, 504 "HealthCheck": "", 505 "HealthyDeadline": 0, 506 "MaxParallel": 0, 507 "MinHealthyTime": 0, 508 "Stagger": 0 509 }, 510 "VaultToken": "", 511 "Version": 0 512 }, 513 "JobID": "webapp", 514 "Metrics": { 515 "AllocationTime": 63337, 516 "ClassExhausted": null, 517 "ClassFiltered": null, 518 "CoalescedFailures": 0, 519 "ConstraintFiltered": null, 520 "DimensionExhausted": null, 521 "NodesAvailable": { 522 "dc1": 2 523 }, 524 "NodesEvaluated": 2, 525 "NodesExhausted": 0, 526 "NodesFiltered": 0, 527 "QuotaExhausted": null, 528 "Scores": { 529 "46f1c6c4-a0e5-21f6-fd5c-d76c3d84e806.binpack": 2.6950883117541586, 530 "f7476465-4d6e-c0de-26d0-e383c49be941.binpack": 2.6950883117541586 531 } 532 }, 533 "ModifyIndex": 2567, 534 "ModifyTime": 1523490089807324000, 535 "Name": "webapp.webapp[0]", 536 "Namespace": "default", 537 "NextAllocation": "", 538 "NodeID": "f7476465-4d6e-c0de-26d0-e383c49be941", 539 "PreviousAllocation": "", 540 "RescheduleTracker": null, 541 "Resources": { 542 "CPU": 100, 543 "DiskMB": 300, 544 "IOPS": 0, 545 "MemoryMB": 300, 546 "Networks": [ 547 { 548 "CIDR": "", 549 "Device": "eth0", 550 "DynamicPorts": [ 551 { 552 "Label": "http", 553 "Value": 25920 554 } 555 ], 556 "IP": "10.138.0.5", 557 "MBits": 10, 558 "ReservedPorts": null 559 } 560 ] 561 }, 562 "SharedResources": { 563 "CPU": 0, 564 "DiskMB": 300, 565 "IOPS": 0, 566 "MemoryMB": 0, 567 "Networks": null 568 }, 569 "TaskGroup": "webapp", 570 "TaskResources": { 571 "webapp": { 572 "CPU": 100, 573 "DiskMB": 0, 574 "IOPS": 0, 575 "MemoryMB": 300, 576 "Networks": [ 577 { 578 "CIDR": "", 579 "Device": "eth0", 580 "DynamicPorts": [ 581 { 582 "Label": "http", 583 "Value": 25920 584 } 585 ], 586 "IP": "10.138.0.5", 587 "MBits": 10, 588 "ReservedPorts": null 589 } 590 ] 591 } 592 }, 593 "TaskStates": { 594 "webapp": { 595 "Events": [ 596 { 597 "Details": {}, 598 "DiskLimit": 0, 599 "DisplayMessage": "Task received by client", 600 "DownloadError": "", 601 "DriverError": "", 602 "DriverMessage": "", 603 "ExitCode": 0, 604 "FailedSibling": "", 605 "FailsTask": false, 606 "GenericSource": "", 607 "KillError": "", 608 "KillReason": "", 609 "KillTimeout": 0, 610 "Message": "", 611 "RestartReason": "", 612 "SetupError": "", 613 "Signal": 0, 614 "StartDelay": 0, 615 "TaskSignal": "", 616 "TaskSignalReason": "", 617 "Time": 1523490066712543500, 618 "Type": "Received", 619 "ValidationError": "", 620 "VaultError": "" 621 }, 622 { 623 "Details": { 624 "message": "Building Task Directory" 625 }, 626 "DiskLimit": 0, 627 "DisplayMessage": "Building Task Directory", 628 "DownloadError": "", 629 "DriverError": "", 630 "DriverMessage": "", 631 "ExitCode": 0, 632 "FailedSibling": "", 633 "FailsTask": false, 634 "GenericSource": "", 635 "KillError": "", 636 "KillReason": "", 637 "KillTimeout": 0, 638 "Message": "Building Task Directory", 639 "RestartReason": "", 640 "SetupError": "", 641 "Signal": 0, 642 "StartDelay": 0, 643 "TaskSignal": "", 644 "TaskSignalReason": "", 645 "Time": 1523490066715208000, 646 "Type": "Task Setup", 647 "ValidationError": "", 648 "VaultError": "" 649 }, 650 { 651 "Details": {}, 652 "DiskLimit": 0, 653 "DisplayMessage": "Task started by client", 654 "DownloadError": "", 655 "DriverError": "", 656 "DriverMessage": "", 657 "ExitCode": 0, 658 "FailedSibling": "", 659 "FailsTask": false, 660 "GenericSource": "", 661 "KillError": "", 662 "KillReason": "", 663 "KillTimeout": 0, 664 "Message": "", 665 "RestartReason": "", 666 "SetupError": "", 667 "Signal": 0, 668 "StartDelay": 0, 669 "TaskSignal": "", 670 "TaskSignalReason": "", 671 "Time": 1523490068433051100, 672 "Type": "Started", 673 "ValidationError": "", 674 "VaultError": "" 675 } 676 ], 677 "Failed": false, 678 "FinishedAt": "0001-01-01T00:00:00Z", 679 "LastRestart": "0001-01-01T00:00:00Z", 680 "Restarts": 0, 681 "StartedAt": "2018-04-11T23:41:08.445128764Z", 682 "State": "running" 683 } 684 } 685 } 686 ] 687 ``` 688 689 ## Create Node Evaluation 690 691 This endpoint creates a new evaluation for the given node. This can be used to 692 force a run of the scheduling logic. 693 694 | Method | Path | Produces | 695 | ------- | ---------------------------- | -------------------------- | 696 | `POST` | `/v1/node/:node_id/evaluate` | `application/json` | 697 698 The table below shows this endpoint's support for 699 [blocking queries](/api/index.html#blocking-queries) and 700 [required ACLs](/api/index.html#acls). 701 702 | Blocking Queries | ACL Required | 703 | ---------------- | ------------------ | 704 | `NO` | `node:write` | 705 706 ### Parameters 707 708 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 709 be the full UUID, not the short 8-character one. This is specified as part of 710 the path. 711 712 ### Sample Request 713 714 ```text 715 $ curl \ 716 http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/evaluate 717 ``` 718 719 ### Sample Response 720 721 ```json 722 { 723 "EvalCreateIndex": 3671, 724 "EvalIDs": [ 725 "4dfc2db7-b481-c53b-3072-14479aa44be3" 726 ], 727 "HeartbeatTTL": 0, 728 "Index": 3671, 729 "KnownLeader": false, 730 "LastContact": 0, 731 "LeaderRPCAddr": "10.138.0.2:4647", 732 "NodeModifyIndex": 0, 733 "NumNodes": 3, 734 "Servers": [ 735 { 736 "Datacenter": "dc1", 737 "RPCAdvertiseAddr": "10.138.0.2:4647", 738 "RPCMajorVersion": 1, 739 "RPCMinorVersion": 1 740 }, 741 { 742 "Datacenter": "dc1", 743 "RPCAdvertiseAddr": "10.138.0.3:4647", 744 "RPCMajorVersion": 1, 745 "RPCMinorVersion": 1 746 }, 747 { 748 "Datacenter": "dc1", 749 "RPCAdvertiseAddr": "10.138.0.4:4647", 750 "RPCMajorVersion": 1, 751 "RPCMinorVersion": 1 752 } 753 ] 754 } 755 756 ``` 757 758 ## Drain Node 759 760 This endpoint toggles the drain mode of the node. When draining is enabled, no 761 further allocations will be assigned to this node, and existing allocations will 762 be migrated to new nodes. See the [Decommissioning Nodes 763 guide](/guides/node-draining.html) for suggested usage. 764 765 | Method | Path | Produces | 766 | ------- | ------------------------- | -------------------------- | 767 | `POST` | `/v1/node/:node_id/drain` | `application/json` | 768 769 The table below shows this endpoint's support for 770 [blocking queries](/api/index.html#blocking-queries) and 771 [required ACLs](/api/index.html#acls). 772 773 | Blocking Queries | ACL Required | 774 | ---------------- | ------------------ | 775 | `NO` | `node:write` | 776 777 ### Parameters 778 779 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 780 be the full UUID, not the short 8-character one. This is specified as part of 781 the path. 782 783 - `DrainSpec` `(object: <optional>)` - Specifies if drain mode should be 784 enabled. A missing or null value disables an existing drain. 785 786 - `Deadline` `(int: <required>)` - Specifies how long to wait in nanoseconds 787 for allocations to finish migrating before they are force stopped. This is 788 also how long batch jobs are given to complete before being migrated. 789 790 - `IgnoreSystemJobs` `(bool: false)` - Specifies whether or not to stop system 791 jobs as part of a drain. By default system jobs will be stopped after all 792 other allocations have migrated or the deadline is reached. Setting this to 793 `true` means system jobs are always left running. 794 795 - `MarkEligible` `(bool: false)` - Specifies whether to mark a node as eligible 796 for scheduling again when _disabling_ a drain. 797 798 ### Sample Payload 799 800 ```json 801 { 802 "DrainSpec": { 803 "Deadline": "3600000000000", 804 "IgnoreSystemJobs": true 805 } 806 } 807 ``` 808 809 ### Sample Request 810 811 ```text 812 $ curl \ 813 -XPOST \ 814 --data @drain.json \ 815 http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/drain 816 ``` 817 818 ### Sample Response 819 820 ```json 821 { 822 "EvalCreateIndex": 0, 823 "EvalIDs": null, 824 "Index": 3742, 825 "NodeModifyIndex": 3742 826 } 827 ``` 828 829 ## Purge Node 830 831 This endpoint purges a node from the system. Nodes can still join the cluster if 832 they are alive. 833 834 | Method | Path | Produces | 835 | ------- | ------------------------- | -------------------------- | 836 | `POST` | `/v1/node/:node_id/purge` | `application/json` | 837 838 The table below shows this endpoint's support for 839 [blocking queries](/api/index.html#blocking-queries) and 840 [required ACLs](/api/index.html#acls). 841 842 | Blocking Queries | ACL Required | 843 | ---------------- | ------------------ | 844 | `NO` | `node:write` | 845 846 ### Parameters 847 848 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 849 be the full UUID, not the short 8-character one. This is specified as part of 850 the path. 851 852 ### Sample Request 853 854 ```text 855 $ curl \ 856 -XPOST http://localhost:4646/v1/node/f7476465-4d6e-c0de-26d0-e383c49be941/purge 857 ``` 858 859 ### Sample Response 860 861 ```json 862 { 863 "EvalCreateIndex": 3817, 864 "EvalIDs": [ 865 "71bad787-5ab1-9939-be02-4809441583cd" 866 ], 867 "HeartbeatTTL": 0, 868 "Index": 3816, 869 "KnownLeader": false, 870 "LastContact": 0, 871 "LeaderRPCAddr": "", 872 "NodeModifyIndex": 3816, 873 "NumNodes": 0, 874 "Servers": null 875 } 876 ``` 877 878 #### Field Reference 879 880 - Events - A list of the last 10 node events for this node. A node event is a 881 high level concept of noteworthy events for a node. 882 883 Each node event has the following fields: 884 885 - `Message` - The specific message for the event, detailing what occurred. 886 887 - `Subsystem` - The subsystem where the node event took place. Subsysystems 888 include: 889 890 - `Drain` - The Nomad server draining subsystem. 891 892 - `Driver` - The Nomad client driver subsystem. 893 894 - `Heartbeat` - Either Nomad client or server heartbeating subsystem. 895 896 - `Cluster` - Nomad server cluster management subsystem. 897 898 - `Details` - Any further details about the event, formatted as a key/value 899 pair. 900 901 - `Timestamp` - Each node event has an ISO 8601 timestamp. 902 903 - `CreateIndex` - The Raft index at which the event was committed.