Broker Startup Failure: Cannot Peer to Duplicate StableId

Symptom

Broker fails to start with message: Can't peer to duplicate stableId.

Cause

A common practice is to provision an EC2 AMI with your software including NuoDB. The broker start up process creates durable last-known state in the NuoDB installation directory including a UUID that is required to be unique for this broker installation. Consequently, you must never clone an AMI from a machine on which you have already started a broker. Doing so prevents a new broker from starting on the clone:

2015-01-15T13:50:46.223-0500 INFO Environment.logEnv (main) NuoDB CFG 
   directory: /etc/nuodb
...
2015-01-15T13:50:48.651-0500 INFO PeerContainerImpl$LocalPeer.initStableId 
   (main) Initializing local peer as stableId uuid:...
...
2015-01-15T13:50:48.873-0500 WARNING PeerService$EntryListener.messageArrived 
  (serv-socket5-thread-2) entry request failed: Can't peer to duplicate stableId
2015-01-15T13:50:51.442-0500 SEVERE PeerService$EntryListener.messageArrived 
  (serv-socket5-thread-2) Entry to the domain was rejected; this agent will shut down

Solution

Clean management configuration state after broker start up:

  1. Remove the NuoDB CFG directory as shown in the agent.log file as part of the broker start-up logging (see output above).
  2. Remove the Raft directory (which contains the durable domain configuration). The Raft directory exists by default in /var/opt/nuodb on MacOS and Linux and in %ALLUSERSPROFILE%\nuodb\var on Windows.