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