title: Connection Refused - Why does zookeeper tries to connect to localhost instead of a server ip
body: <p>My Reduce Tasks fail because all the namenode fails trying to connect to localhost instead of 10.10.187.170 ..</p>
  
  <p>My application even tries to connect manually in the code..</p>
  
  <pre><code>Configuration conf = HBaseConfiguration.create();
  conf.set("hbase.zookeeper.quorum", "10.10.187.170");
  conf.set("hbase.zookeeper.property.clientPort","2181");
  conf.set("hbase.master","10.10.187.170");
  </code></pre>
  
  <p>My hbase-site.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;!--Autogenerated by Cloudera CM on 2013-08-14T06:27:30.291Z--&gt;
  &lt;configuration&gt;
  &lt;property&gt;
  &lt;name&gt;hbase.rootdir&lt;/name&gt;
  &lt;value&gt;hdfs://ip-10-10-187-170.eu-west-1.compute.internal:8020/hbase&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;hbase.client.write.buffer&lt;/name&gt;
  &lt;value&gt;2097152&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;hbase.client.pause&lt;/name&gt;
  &lt;value&gt;1000&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;hbase.client.retries.number&lt;/name&gt;
  &lt;value&gt;10&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;hbase.client.scanner.caching&lt;/name&gt;
  &lt;value&gt;1&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;hbase.client.keyvalue.maxsize&lt;/name&gt;
  &lt;value&gt;10485760&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;hbase.rpc.timeout&lt;/name&gt;
  &lt;value&gt;60000&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;hbase.security.authentication&lt;/name&gt;
  &lt;value&gt;simple&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;zookeeper.session.timeout&lt;/name&gt;
  &lt;value&gt;60000&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;zookeeper.znode.parent&lt;/name&gt;
  &lt;value&gt;/hbase&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;zookeeper.znode.rootserver&lt;/name&gt;
  &lt;value&gt;root-region-server&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;hbase.zookeeper.quorum&lt;/name&gt;
  &lt;value&gt;ip-10-10-187-170.eu-west-1.compute.internal&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;hbase.zookeeper.property.clientPort&lt;/name&gt;
  &lt;value&gt;2181&lt;/value&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>Error:</p>
  
  <pre><code>2013-08-24 20:05:36,213 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (Unable to locate a login configuration)
  2013-08-24 20:05:36,213 WARN org.apache.zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
  java.net.ConnectException: Connection refused
  at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
  at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
  at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
  at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
  </code></pre>