How to Fix Conflicting Node ID in Consul

Why Does This Occur?

This issue typically happens when:

  1. Restoring a VPS from snapshot or backup
  2. The restored instance retains the same node ID as the original VPS

Resolution Steps

  1. Remove the existing node ID to generate a new one:

    sudo rm /opt/consul/node-id
    

    Note: On Ubuntu 24.04, the node-id is typically located at /opt/consul/node-id

  2. If the file location is unknown, use this command to find and remove it:

    sudo find / -name "node-id" -exec rm -f {} \;
    
  3. Restart Consul to apply the changes sudo service consul restart