You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Hotec04 <ha...@dish.com> on 2014/05/18 23:03:37 UTC

How to override the hbase-site.xml

Hi there,

I am trying to use an hbase-site.xml from other directory instead from class
path. But the the configuration.addResource() does not work. For example, I
have an hbase-site.xml sitting at catalina_home/hbase/hbase-site.xml, I used
configuration.addResource("{catalina.base}/hbase/hbase-site.xml"). It looks
like the addResource command does not override the hbase-site.xml while
createing the configuration by HBaseConfiguration.create(). It still looks
for hbase-site.xml from the class path and since there is none, it trys to
connect to localhose as default. 

log:
{2014-05-18 15:00:36,142} INFO  [http-bio-8080-exec-5-SendThread()]
(ClientCnxn.java:1061) - Opening socket connection to server
localhost/127.0.0.1:2181
{2014-05-18 15:00:36,145} INFO  [http-bio-8080-exec-5]
(RecoverableZooKeeper.java:104) - The identifier of this process is
xxxxxxxxxxx
{2014-05-18 15:00:37,151} WARN 
[http-bio-8080-exec-5-SendThread(localhost:2181)] (ClientCnxn.java:1188) -
Session 0x0 for server null, unexpected error, closing socket connection and
attempting reconnect
java.net.ConnectException: Connection refused: no further information
	at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
	at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1146)
{2014-05-18 15:00:37,309} WARN  [http-bio-8080-exec-5]
(RecoverableZooKeeper.java:219) - Possibly transient ZooKeeper exception:
org.apache.zookeeper.KeeperException$ConnectionLossException:
KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
{2014-05-18 15:00:37,309} INFO  [http-bio-8080-exec-5]
(RetryCounter.java:53) - Sleeping 2000ms before retry #1...
{2014-05-18 15:00:37,815} INFO 
[http-bio-8080-exec-5-SendThread(localhost:2181)] (ClientCnxn.java:1061) -
Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
{2014-05-18 15:00:37,815} ERROR
[http-bio-8080-exec-5-SendThread(localhost:2181)] (ClientCnxn.java:1076) -
Unable to open socket to localhost/0:0:0:0:0:0:0:1:2181
{2014-05-18 15:00:37,815} WARN 
[http-bio-8080-exec-5-SendThread(localhost:2181)] (ClientCnxn.java:1188) -
Session 0x0 for server null, unexpected error, closing socket connection and
attempting reconnect
java.net.SocketException: Address family not supported by protocol family:
connect
	at sun.nio.ch.Net.connect(Native Method)
	at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
	at
org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1071)
	at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1104)

Code:
Configuration configuration =  HBaseConfiguration.create();
configuration.addResource("{catalina.base}/hadoop/hbase-site.xml");

Thank you in advance!



--
View this message in context: http://apache-hbase.679495.n3.nabble.com/How-to-override-the-hbase-site-xml-tp4059326.html
Sent from the HBase User mailing list archive at Nabble.com.

Re: How to override the hbase-site.xml

Posted by Hotec04 <ha...@dish.com>.
I think I got it, I am using addResource(InputStream, String) instead of
addResource(String).



--
View this message in context: http://apache-hbase.679495.n3.nabble.com/How-to-override-the-hbase-site-xml-tp4059326p4059329.html
Sent from the HBase User mailing list archive at Nabble.com.

Re: How to override the hbase-site.xml

Posted by Hotec04 <ha...@dish.com>.
Besides, if I add hbase-site.xml, and core-site.xml into resources folder, it
works great.



--
View this message in context: http://apache-hbase.679495.n3.nabble.com/How-to-override-the-hbase-site-xml-tp4059326p4059328.html
Sent from the HBase User mailing list archive at Nabble.com.

Re: How to override the hbase-site.xml

Posted by Hotec04 <ha...@dish.com>.
These are the resources in configuration:

[hbase-default.xml, hbase-site.xml, /tomcat/hadoop/hbase-site.xml,
/tomcat/hadoop/hdfs-site.xml, /tomcat/hadoop/core-site.xml]

Is there a way I can remove resources? Or How can I override hbase-site.xml?

Any helps are appreciated!



--
View this message in context: http://apache-hbase.679495.n3.nabble.com/How-to-override-the-hbase-site-xml-tp4059326p4059327.html
Sent from the HBase User mailing list archive at Nabble.com.