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