Skip to content

Check Nomad Cluster Formation

Check Nomad Cluster Formation in Nomad Issues.

5 min read Updated SS RS

Check Nomad Cluster Formation#

1. To check whether the Nomad cluster has formed correctly, run the following on the HEAL server:

nomad server members

Expected output:

Name              Address       Port  Status  Leader  Protocol  Build  Datacenter  Region
server01.example  192.0.2.112   4648  alive   false   2         1.2.6  dc1         India
server02.example  192.0.2.113   4648  alive   true    2         1.2.6  dc1         India
server03.example  192.0.2.114   4648  alive   false   2         1.2.6  dc1         India
  • Status should be alive.
  • Exactly one member should show Leader = true.
  • All HEAL server IPs should be listed. If any IP is missing, the cluster is not formed.

Note: If no leader is detected, or a member is not alive (for example leaving/left status with Leader = false), troubleshoot further and raise a ticket to the concerned team.

2. Check the Nomad service status on each HEAL server:

systemctl status nomad

Successful output (trimmed — the load-bearing line is Active: active (running)):

● nomad.service - Nomad
   Loaded: loaded (/usr/lib/systemd/system/nomad.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2023-09-22 15:04:41 IST; 2 days ago
     Docs: https://nomadproject.io/docs/
 Main PID: 10739 (nomad)
    Tasks: 140
   Memory: 122.3M

Unsuccessful output (trimmed — the load-bearing lines are Loaded: not-found and Active: failed):

● nomad.service
   Loaded: not-found (Reason: Unit nomad.service not found.)
   Active: failed (Result: exit-code) since Wed 2023-09-20 11:53:20 IST; 4 days ago
 Main PID: 2193369 (code=exited, status=1/FAILURE)
Sep 20 11:53:20 server01.example systemd[1]: Stopping Nomad...
Sep 20 11:53:20 server01.example systemd[1]: nomad.service: Main process exited, code=exited
Sep 20 11:53:20 server01.example systemd[1]: nomad.service: Failed with result 'exit-code'.
Sep 20 11:53:20 server01.example systemd[1]: Stopped Nomad.

If the service is failed or inactive, troubleshoot further using the steps below.

3. Check the system messages log — it lists all module messages:

cat /var/log/messages

Scan for ERROR lines from nomad. (Note: the periodic update-check timeout below is benign and can be ignored — it is not the cause of a start failure.)

Sep 25 10:24:45 server01 nomad: ==> Failed to check for updates:
    context deadline exceeded (Client.Timeout exceeded while awaiting headers)

4. Also check for errors in the Nomad journal:

journalctl -fu nomad

Successful output:

-- Logs begin at Sat 2023-06-17 08:22:23 IST. --
Jun 17 13:51:13 support01.example systemd[1]: Started nomad service manager.
Jun 17 13:51:13 support01.example nomad[1266]: Starting nomad: [ OK ]

Unsuccessful output (trimmed — the load-bearing line repeats for each peer):

-- Logs begin at Sat 2023-06-17 14:29:20 IST. --
Sep 25 15:00:06 server01.example nomad[30165]: [ERROR] nomad: memberlist:
    failed to receive: Encryption is configured but remote state is not
    encrypted from=127.0.0.1:44934
Sep 25 15:24:06 server01.example nomad[30165]: [ERROR] nomad: memberlist:
    failed to receive: Encryption is configured but remote state is not
    encrypted from=127.0.0.1:36066

Based on the error message, rectify the issue. If it cannot be resolved, contact the concerned team.

Trigger Nomad Garbage Collection#

When a service has been stopped but an allocation ID is still assigned to it, an allocation error is observed. To rectify this, follow the steps below.

1. Check the status of the services:

nomad status

Expected output (trimmed — all jobs are running; SUPERVISOR_CTRL is the one we will stop):

ID                                  Type     Priority  Status   Submit Date
192.0.2.7_ACTIONDETECTOR_1          service  50        running  2023-09-07T17:12:13+05:30
192.0.2.7_CONTROLCENTER_1           service  50        running  2023-09-12T16:29:00+05:30
192.0.2.7_DATAEMITTER_1             service  50        running  2023-09-07T18:25:07+05:30
192.0.2.7_DATARECEIVER_1            service  50        running  2023-09-07T18:24:25+05:30
192.0.2.7_SUPERVISOR_CTRL_1         service  50        running  2023-09-07T10:15:26+05:30
192.0.2.7_UISERVICE_1               service  50        running  2023-09-15T15:53:23+05:30
opensearch-master-node1             service  50        running  2023-09-09T14:51:50+05:30
percona                             service  50        running  2023-09-07T18:23:21+05:30
rabbitmq                            service  50        running  2023-09-08T20:06:12+05:30
redis                               service  50        running  2023-09-19T15:31:04+05:30
# (grafana, haproxy, keycloak, opensearch-{cordinator,jim,kpi,txn}-node1 also running)

2. Stop the respective service:

nomad stop 192.0.2.7_SUPERVISOR_CTRL_1

Expected output (trimmed — the deployment completes successfully):

==> Monitoring evaluation "6268c89b"
    Evaluation triggered by job "192.0.2.7_SUPERVISOR_CTRL_1"
    Evaluation status changed: "pending" -> "complete"
==> Evaluation "6268c89b" finished with status "complete"
==> Monitoring deployment "e93c4c87"
  ✓ Deployment "e93c4c87" successful

3. Re-check the service status:

nomad status

Expected output (trimmed — the load-bearing change is SUPERVISOR_CTRL_1 now dead (stopped)):

ID                                  Type     Priority  Status          Submit Date
192.0.2.7_SUPERVISOR_CTRL_1         service  50        dead (stopped)  2023-09-07T10:15:26+05:30
# (all other jobs remain running)

4. Check whether the allocation ID is still present for the stopped service:

nomad status 192.0.2.7_SUPERVISOR_CTRL_1

Expected output (trimmed — the load-bearing line is the allocation still listed under Allocations):

ID          = 192.0.2.7_SUPERVISOR_CTRL_1
Status      = dead (stopped)

Allocations
ID        Node ID   Task Group                   Version  Desired  Status    Created    Modified
b48ea4da  fd798122  192.0.2.7_SUPERVISOR_CTRL_1  0        stop     complete  12d6h ago  5s ago

If the allocation ID is still present after stopping the service, that allocation is still consuming disk space.

5. Check the disk usage:

df -h

Expected output (trimmed — the load-bearing lines are the root filesystem and the per-allocation mounts). The root / is at 84%; every live allocation keeps an overlay mount plus a /opt/Heal/nomad/alloc/<id>/…/secrets tmpfs, so orphaned allocations keep occupying disk until they are garbage-collected:

Filesystem             Size   Used  Avail  Use%  Mounted on
devtmpfs               16G    0     16G    0%    /dev
tmpfs                  16G    1.1G  15G    7%    /run
/dev/mapper/rhel-root  144G   120G  25G    84%   /
/dev/sda2              1014M  145M  870M   15%   /boot
/dev/sda1              200M   9.9M  190M   5%    /boot/efi
overlay                144G   120G  25G    84%   /opt/Heal/docker/overlay2/1e7f1730.../merged
tmpfs                  1.0M   0     1.0M   0%     /opt/Heal/nomad/alloc/b8ac796b-.../198.51.100.7_ACTIONDETECTOR_1/secrets
overlay                144G   120G  25G    84%   /opt/Heal/docker/overlay2/e2a12993.../merged
tmpfs                  1.0M   0     1.0M   0%     /opt/Heal/nomad/alloc/e2a12993-.../198.51.100.7_DATARECEIVER_1/secrets
# (one overlay + one alloc//.../secrets tmpfs per allocation; ~20 more follow)

If a discontinued service is still consuming disk space, it can starve the other running services. To avoid this, remove the allocation ID assigned to the stopped service.

6. To force Nomad to garbage-collect the orphaned allocation, run:

curl -X PUT https://localhost:4646/v1/system/gc -k

Expected output: there is no visible output; confirm the result by re-checking the status.

7. Check the status again:

nomad status

Expected output (trimmed — the load-bearing result is that SUPERVISOR_CTRL_1 is no longer listed):

ID                                   Type     Priority  Status   Submit Date
198.51.100.7_ACTIONDETECTOR_1        service  50        running  2023-09-07T17:12:13+05:30
198.51.100.7_CONTROLCENTER_1         service  50        running  2023-09-12T16:29:00+05:30
198.51.100.7_DATAEMITTER_1           service  50        running  2023-09-07T18:25:07+05:30
198.51.100.7_DATARECEIVER_1          service  50        running  2023-09-07T18:24:25+05:30
198.51.100.7_UISERVICE_1             service  50        running  2023-09-15T15:53:23+05:30
# (grafana, haproxy, keycloak, opensearch-*, percona, rabbitmq, redis still running)
# 198.51.100.7_SUPERVISOR_CTRL_1 no longer appears — its allocation was removed

The supervisor controller allocation has been removed successfully.