github.com/ferranbt/nomad@v0.9.3-0.20190607002617-85c449b7667c/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 query string 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 "MemoryMB": 0, 278 "Networks": null 279 }, 280 "Resources": { 281 "CPU": 2200, 282 "DiskMB": 25392, 283 "MemoryMB": 3704, 284 "Networks": [ 285 { 286 "CIDR": "10.138.0.5/32", 287 "Device": "eth0", 288 "DynamicPorts": null, 289 "IP": "10.138.0.5", 290 "MBits": 1000, 291 "ReservedPorts": null 292 } 293 ] 294 }, 295 "SchedulingEligibility": "eligible", 296 "SecretID": "", 297 "Status": "ready", 298 "StatusDescription": "", 299 "StatusUpdatedAt": 1523552938, 300 "TLSEnabled": false 301 } 302 ``` 303 304 ## List Node Allocations 305 306 This endpoint lists all of the allocations for the given node. This can be used to 307 determine what allocations have been scheduled on the node, their current status, 308 and the values of dynamically assigned resources, like ports. 309 310 | Method | Path | Produces | 311 | ------- | ------------------------------- | -------------------------- | 312 | `GET` | `/v1/node/:node_id/allocations` | `application/json` | 313 314 The table below shows this endpoint's support for 315 [blocking queries](/api/index.html#blocking-queries) and 316 [required ACLs](/api/index.html#acls). 317 318 | Blocking Queries | ACL Required | 319 | ---------------- | ------------------------------ | 320 | `YES` | `node:read,namespace:read-job` | 321 322 ### Parameters 323 324 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 325 be the full UUID, not the short 8-character one. This is specified as part of 326 the path. 327 328 ### Sample Request 329 330 ```text 331 $ curl \ 332 http://localhost:4646/v1/node/e02b6169-83bd-9df6-69bd-832765f333eb/allocations 333 ``` 334 335 ### Sample Response 336 337 ```json 338 [ 339 { 340 "AllocModifyIndex": 2555, 341 "ClientDescription": "", 342 "ClientStatus": "running", 343 "CreateIndex": 2555, 344 "CreateTime": 1523490066575461000, 345 "DeploymentID": "", 346 "DeploymentStatus": { 347 "Healthy": true, 348 "ModifyIndex": 0 349 }, 350 "DesiredDescription": "", 351 "DesiredStatus": "run", 352 "DesiredTransition": { 353 "Migrate": null 354 }, 355 "EvalID": "5129bc74-9785-c39a-08da-bddc8aa778b1", 356 "FollowupEvalID": "", 357 "ID": "fefe81d0-08b2-4eca-fae6-6560cde46d31", 358 "Job": { 359 "AllAtOnce": false, 360 "Constraints": null, 361 "CreateIndex": 2553, 362 "Datacenters": [ 363 "dc1" 364 ], 365 "ID": "webapp", 366 "JobModifyIndex": 2553, 367 "Meta": null, 368 "ModifyIndex": 2554, 369 "Name": "webapp", 370 "Namespace": "default", 371 "ParameterizedJob": null, 372 "ParentID": "", 373 "Payload": null, 374 "Periodic": null, 375 "Priority": 50, 376 "Region": "global", 377 "Stable": false, 378 "Status": "pending", 379 "StatusDescription": "", 380 "Stop": false, 381 "SubmitTime": 1523490066563405000, 382 "TaskGroups": [ 383 { 384 "Constraints": null, 385 "Count": 9, 386 "EphemeralDisk": { 387 "Migrate": false, 388 "SizeMB": 300, 389 "Sticky": false 390 }, 391 "Meta": null, 392 "Migrate": { 393 "HealthCheck": "checks", 394 "HealthyDeadline": 300000000000, 395 "MaxParallel": 2, 396 "MinHealthyTime": 15000000000 397 }, 398 "Name": "webapp", 399 "ReschedulePolicy": { 400 "Attempts": 0, 401 "Delay": 30000000000, 402 "DelayFunction": "exponential", 403 "Interval": 0, 404 "MaxDelay": 3600000000000, 405 "Unlimited": true 406 }, 407 "RestartPolicy": { 408 "Attempts": 2, 409 "Delay": 15000000000, 410 "Interval": 1800000000000, 411 "Mode": "fail" 412 }, 413 "Tasks": [ 414 { 415 "Artifacts": null, 416 "Config": { 417 "args": [ 418 "-text", 419 "ok4" 420 ], 421 "image": "hashicorp/http-echo:0.2.3", 422 "port_map": [ 423 { 424 "http": 5678 425 } 426 ] 427 }, 428 "Constraints": null, 429 "DispatchPayload": null, 430 "Driver": "docker", 431 "Env": null, 432 "KillSignal": "", 433 "KillTimeout": 5000000000, 434 "Leader": false, 435 "LogConfig": { 436 "MaxFileSizeMB": 10, 437 "MaxFiles": 10 438 }, 439 "Meta": null, 440 "Name": "webapp", 441 "Resources": { 442 "CPU": 100, 443 "DiskMB": 0, 444 "MemoryMB": 300, 445 "Networks": [ 446 { 447 "CIDR": "", 448 "Device": "", 449 "DynamicPorts": [ 450 { 451 "Label": "http", 452 "Value": 0 453 } 454 ], 455 "IP": "", 456 "MBits": 10, 457 "ReservedPorts": null 458 } 459 ] 460 }, 461 "Services": [ 462 { 463 "AddressMode": "auto", 464 "Checks": [ 465 { 466 "AddressMode": "", 467 "Args": null, 468 "CheckRestart": null, 469 "Command": "", 470 "Header": null, 471 "InitialStatus": "", 472 "Interval": 10000000000, 473 "Method": "", 474 "Name": "http-ok", 475 "Path": "/", 476 "PortLabel": "", 477 "Protocol": "", 478 "TLSSkipVerify": false, 479 "Timeout": 2000000000, 480 "Type": "http" 481 } 482 ], 483 "Name": "webapp", 484 "PortLabel": "http", 485 "Tags": null 486 } 487 ], 488 "ShutdownDelay": 0, 489 "Templates": null, 490 "User": "", 491 "Vault": null 492 } 493 ], 494 "Update": null 495 } 496 ], 497 "Type": "service", 498 "Update": { 499 "AutoRevert": false, 500 "Canary": 0, 501 "HealthCheck": "", 502 "HealthyDeadline": 0, 503 "MaxParallel": 0, 504 "MinHealthyTime": 0, 505 "Stagger": 0 506 }, 507 "VaultToken": "", 508 "Version": 0 509 }, 510 "JobID": "webapp", 511 "Metrics": { 512 "AllocationTime": 63337, 513 "ClassExhausted": null, 514 "ClassFiltered": null, 515 "CoalescedFailures": 0, 516 "ConstraintFiltered": null, 517 "DimensionExhausted": null, 518 "NodesAvailable": { 519 "dc1": 2 520 }, 521 "NodesEvaluated": 2, 522 "NodesExhausted": 0, 523 "NodesFiltered": 0, 524 "QuotaExhausted": null, 525 "Scores": { 526 "46f1c6c4-a0e5-21f6-fd5c-d76c3d84e806.binpack": 2.6950883117541586, 527 "f7476465-4d6e-c0de-26d0-e383c49be941.binpack": 2.6950883117541586 528 } 529 }, 530 "ModifyIndex": 2567, 531 "ModifyTime": 1523490089807324000, 532 "Name": "webapp.webapp[0]", 533 "Namespace": "default", 534 "NextAllocation": "", 535 "NodeID": "f7476465-4d6e-c0de-26d0-e383c49be941", 536 "PreviousAllocation": "", 537 "RescheduleTracker": null, 538 "Resources": { 539 "CPU": 100, 540 "DiskMB": 300, 541 "MemoryMB": 300, 542 "Networks": [ 543 { 544 "CIDR": "", 545 "Device": "eth0", 546 "DynamicPorts": [ 547 { 548 "Label": "http", 549 "Value": 25920 550 } 551 ], 552 "IP": "10.138.0.5", 553 "MBits": 10, 554 "ReservedPorts": null 555 } 556 ] 557 }, 558 "SharedResources": { 559 "CPU": 0, 560 "DiskMB": 300, 561 "MemoryMB": 0, 562 "Networks": null 563 }, 564 "TaskGroup": "webapp", 565 "TaskResources": { 566 "webapp": { 567 "CPU": 100, 568 "DiskMB": 0, 569 "MemoryMB": 300, 570 "Networks": [ 571 { 572 "CIDR": "", 573 "Device": "eth0", 574 "DynamicPorts": [ 575 { 576 "Label": "http", 577 "Value": 25920 578 } 579 ], 580 "IP": "10.138.0.5", 581 "MBits": 10, 582 "ReservedPorts": null 583 } 584 ] 585 } 586 }, 587 "TaskStates": { 588 "webapp": { 589 "Events": [ 590 { 591 "Details": {}, 592 "DiskLimit": 0, 593 "DisplayMessage": "Task received by client", 594 "DownloadError": "", 595 "DriverError": "", 596 "DriverMessage": "", 597 "ExitCode": 0, 598 "FailedSibling": "", 599 "FailsTask": false, 600 "GenericSource": "", 601 "KillError": "", 602 "KillReason": "", 603 "KillTimeout": 0, 604 "Message": "", 605 "RestartReason": "", 606 "SetupError": "", 607 "Signal": 0, 608 "StartDelay": 0, 609 "TaskSignal": "", 610 "TaskSignalReason": "", 611 "Time": 1523490066712543500, 612 "Type": "Received", 613 "ValidationError": "", 614 "VaultError": "" 615 }, 616 { 617 "Details": { 618 "message": "Building Task Directory" 619 }, 620 "DiskLimit": 0, 621 "DisplayMessage": "Building Task Directory", 622 "DownloadError": "", 623 "DriverError": "", 624 "DriverMessage": "", 625 "ExitCode": 0, 626 "FailedSibling": "", 627 "FailsTask": false, 628 "GenericSource": "", 629 "KillError": "", 630 "KillReason": "", 631 "KillTimeout": 0, 632 "Message": "Building Task Directory", 633 "RestartReason": "", 634 "SetupError": "", 635 "Signal": 0, 636 "StartDelay": 0, 637 "TaskSignal": "", 638 "TaskSignalReason": "", 639 "Time": 1523490066715208000, 640 "Type": "Task Setup", 641 "ValidationError": "", 642 "VaultError": "" 643 }, 644 { 645 "Details": {}, 646 "DiskLimit": 0, 647 "DisplayMessage": "Task started by client", 648 "DownloadError": "", 649 "DriverError": "", 650 "DriverMessage": "", 651 "ExitCode": 0, 652 "FailedSibling": "", 653 "FailsTask": false, 654 "GenericSource": "", 655 "KillError": "", 656 "KillReason": "", 657 "KillTimeout": 0, 658 "Message": "", 659 "RestartReason": "", 660 "SetupError": "", 661 "Signal": 0, 662 "StartDelay": 0, 663 "TaskSignal": "", 664 "TaskSignalReason": "", 665 "Time": 1523490068433051100, 666 "Type": "Started", 667 "ValidationError": "", 668 "VaultError": "" 669 } 670 ], 671 "Failed": false, 672 "FinishedAt": "0001-01-01T00:00:00Z", 673 "LastRestart": "0001-01-01T00:00:00Z", 674 "Restarts": 0, 675 "StartedAt": "2018-04-11T23:41:08.445128764Z", 676 "State": "running" 677 } 678 } 679 } 680 ] 681 ``` 682 683 ## Create Node Evaluation 684 685 This endpoint creates a new evaluation for the given node. This can be used to 686 force a run of the scheduling logic. 687 688 | Method | Path | Produces | 689 | ------- | ---------------------------- | -------------------------- | 690 | `POST` | `/v1/node/:node_id/evaluate` | `application/json` | 691 692 The table below shows this endpoint's support for 693 [blocking queries](/api/index.html#blocking-queries) and 694 [required ACLs](/api/index.html#acls). 695 696 | Blocking Queries | ACL Required | 697 | ---------------- | ------------------ | 698 | `NO` | `node:write` | 699 700 ### Parameters 701 702 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 703 be the full UUID, not the short 8-character one. This is specified as part of 704 the path. 705 706 ### Sample Request 707 708 ```text 709 $ curl \ 710 http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/evaluate 711 ``` 712 713 ### Sample Response 714 715 ```json 716 { 717 "EvalCreateIndex": 3671, 718 "EvalIDs": [ 719 "4dfc2db7-b481-c53b-3072-14479aa44be3" 720 ], 721 "HeartbeatTTL": 0, 722 "Index": 3671, 723 "KnownLeader": false, 724 "LastContact": 0, 725 "LeaderRPCAddr": "10.138.0.2:4647", 726 "NodeModifyIndex": 0, 727 "NumNodes": 3, 728 "Servers": [ 729 { 730 "Datacenter": "dc1", 731 "RPCAdvertiseAddr": "10.138.0.2:4647", 732 "RPCMajorVersion": 1, 733 "RPCMinorVersion": 1 734 }, 735 { 736 "Datacenter": "dc1", 737 "RPCAdvertiseAddr": "10.138.0.3:4647", 738 "RPCMajorVersion": 1, 739 "RPCMinorVersion": 1 740 }, 741 { 742 "Datacenter": "dc1", 743 "RPCAdvertiseAddr": "10.138.0.4:4647", 744 "RPCMajorVersion": 1, 745 "RPCMinorVersion": 1 746 } 747 ] 748 } 749 750 ``` 751 752 ## Drain Node 753 754 This endpoint toggles the drain mode of the node. When draining is enabled, no 755 further allocations will be assigned to this node, and existing allocations will 756 be migrated to new nodes. See the [Workload Migration 757 Guide](/guides/operations/node-draining.html) for suggested usage. 758 759 | Method | Path | Produces | 760 | ------- | ------------------------- | -------------------------- | 761 | `POST` | `/v1/node/:node_id/drain` | `application/json` | 762 763 The table below shows this endpoint's support for 764 [blocking queries](/api/index.html#blocking-queries) and 765 [required ACLs](/api/index.html#acls). 766 767 | Blocking Queries | ACL Required | 768 | ---------------- | ------------------ | 769 | `NO` | `node:write` | 770 771 ### Parameters 772 773 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 774 be the full UUID, not the short 8-character one. This is specified as part of 775 the path. 776 777 - `DrainSpec` `(object: <optional>)` - Specifies if drain mode should be 778 enabled. A missing or null value disables an existing drain. 779 780 - `Deadline` `(int: <required>)` - Specifies how long to wait in nanoseconds 781 for allocations to finish migrating before they are force stopped. This is 782 also how long batch jobs are given to complete before being migrated. 783 784 - `IgnoreSystemJobs` `(bool: false)` - Specifies whether or not to stop system 785 jobs as part of a drain. By default system jobs will be stopped after all 786 other allocations have migrated or the deadline is reached. Setting this to 787 `true` means system jobs are always left running. 788 789 - `MarkEligible` `(bool: false)` - Specifies whether to mark a node as eligible 790 for scheduling again when _disabling_ a drain. 791 792 ### Sample Payload 793 794 ```json 795 { 796 "DrainSpec": { 797 "Deadline": 3600000000000, 798 "IgnoreSystemJobs": true 799 } 800 } 801 ``` 802 803 ### Sample Request 804 805 ```text 806 $ curl \ 807 -XPOST \ 808 --data @drain.json \ 809 http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/drain 810 ``` 811 812 ### Sample Response 813 814 ```json 815 { 816 "EvalCreateIndex": 0, 817 "EvalIDs": null, 818 "Index": 3742, 819 "NodeModifyIndex": 3742 820 } 821 ``` 822 823 ## Purge Node 824 825 This endpoint purges a node from the system. Nodes can still join the cluster if 826 they are alive. 827 828 | Method | Path | Produces | 829 | ------- | ------------------------- | -------------------------- | 830 | `POST` | `/v1/node/:node_id/purge` | `application/json` | 831 832 The table below shows this endpoint's support for 833 [blocking queries](/api/index.html#blocking-queries) and 834 [required ACLs](/api/index.html#acls). 835 836 | Blocking Queries | ACL Required | 837 | ---------------- | ------------------ | 838 | `NO` | `node:write` | 839 840 ### Parameters 841 842 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 843 be the full UUID, not the short 8-character one. This is specified as part of 844 the path. 845 846 ### Sample Request 847 848 ```text 849 $ curl \ 850 -XPOST http://localhost:4646/v1/node/f7476465-4d6e-c0de-26d0-e383c49be941/purge 851 ``` 852 853 ### Sample Response 854 855 ```json 856 { 857 "EvalCreateIndex": 3817, 858 "EvalIDs": [ 859 "71bad787-5ab1-9939-be02-4809441583cd" 860 ], 861 "HeartbeatTTL": 0, 862 "Index": 3816, 863 "KnownLeader": false, 864 "LastContact": 0, 865 "LeaderRPCAddr": "", 866 "NodeModifyIndex": 3816, 867 "NumNodes": 0, 868 "Servers": null 869 } 870 ``` 871 872 ## Toggle Node Eligibility 873 874 This endpoint toggles the scheduling eligibility of the node. 875 876 | Method | Path | Produces | 877 | ------- | ------------------------------- | -------------------------- | 878 | `POST` | `/v1/node/:node_id/eligibility` | `application/json` | 879 880 The table below shows this endpoint's support for 881 [blocking queries](/api/index.html#blocking-queries) and 882 [required ACLs](/api/index.html#acls). 883 884 | Blocking Queries | ACL Required | 885 | ---------------- | ------------------ | 886 | `NO` | `node:write` | 887 888 ### Parameters 889 890 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 891 be the full UUID, not the short 8-character one. This is specified as part of 892 the path. 893 894 - `Eligibility` `(string: <required>)` - Either `eligible` or `ineligible`. 895 896 ### Sample Payload 897 898 ```json 899 { 900 "Eligibility": "ineligible" 901 } 902 ``` 903 904 ### Sample Request 905 906 ```text 907 $ curl \ 908 -XPOST \ 909 --data @eligibility.json \ 910 http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/eligibility 911 ``` 912 913 ### Sample Response 914 915 ```json 916 { 917 "EvalCreateIndex": 0, 918 "EvalIDs": null, 919 "Index": 3742, 920 "NodeModifyIndex": 3742 921 } 922 ``` 923 924 #### Field Reference 925 926 - Events - A list of the last 10 node events for this node. A node event is a 927 high level concept of noteworthy events for a node. 928 929 Each node event has the following fields: 930 931 - `Message` - The specific message for the event, detailing what occurred. 932 933 - `Subsystem` - The subsystem where the node event took place. Subsystems 934 include: 935 936 - `Drain` - The Nomad server draining subsystem. 937 938 - `Driver` - The Nomad client driver subsystem. 939 940 - `Heartbeat` - Either Nomad client or server heartbeating subsystem. 941 942 - `Cluster` - Nomad server cluster management subsystem. 943 944 - `Details` - Any further details about the event, formatted as a key/value 945 pair. 946 947 - `Timestamp` - Each node event has an ISO 8601 timestamp. 948 949 - `CreateIndex` - The Raft index at which the event was committed.