Troubleshooting Start Failure on AWS

On AWS, when you provision Red Hat or AWS Linux instances, you might get an error such as the following:

2015-02-17T14:43:37.835+0000 SEVERE NuoAgent.reportStartFailed (main) Failed to startup
java.lang.IllegalStateException: Cannot resolve local host. See the "Broker Startup Failure: Cannot Resolve Local Host" 
section of http://doc.nuodb.com/Latest/Default.htm#Broker-Startup-Failure-Cannot-Resolve-Local-Host.htm
at com.nuodb.agent.PeerContainerImpl$LocalPeer.<init>(PeerContainerImpl.java:205)
at com.nuodb.agent.PeerContainerImpl.<init>(PeerContainerImpl.java:79)
at com.nuodb.agent.NuoAgent.init(NuoAgent.java:189)
at com.nuodb.agent.NuoAgent.<init>(NuoAgent.java:172)
at com.nuodb.agent.NuoAgent.main(NuoAgent.java:435)
Failed to startup: Cannot resolve local host. See the "Broker Startup Failure: Cannot Resolve Local Host" 
section of http://doc.nuodb.com/Latest/Default.htm#Broker-Startup-Failure-Cannot-Resolve-Local-Host.htm

A possible reason for this failure is that your /etc/hosts file is not correct. For example, suppose you run this command:

[ec2-user@ip-10-0-2-82 ~]$ hostname
ip-10-0-2-82

As you can see, there is an alias for the current host. However, if you run the following you get an error:

[ec2-user@ip-10-0-2-82 ~]$ hostname --fqdn
hostname: Unknown host

Your /etc/hosts file probably looks like this:

127.0.0.1 localhost localhost.localdomain

This is not correct and you should change it to this:

127.0.0.1 localhost ip-10-0-2-82

Now these commands work properly:

[ec2-user@ip-10-0-2-82 ~]$ hostname --fqdn
localhost
[ec2-user@ip-10-0-2-82 ~]$ hostname -a
ip-10-0-2-82

You should be able to start the NuoDB broker. For another example of this kind of error, see Broker Startup Failure: Cannot Resolve Local Host.