You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by AnandaVelMurugan Chandra Mohan <an...@gmail.com> on 2012/05/29 15:29:48 UTC
Issues with Java sample for connecting to remote Hbase
I have HBase version 0.92.1 running in standalone mode. I created a table
and added few rows using hbase shell. Now I am developing a standalone java
application to connect to Hbase and retrieve the data from the table.
*
This is the code I am using
*
Configuration config = HBaseConfiguration.create();
config.clear();
config.set("hbase.zookeeper.quorum", "10.78.32.131");
config.set("hbase.zookeeper.property.clientPort","2181");
config.set("hbase.master", "10.78.32.131:60010");
HBaseAdmin.checkHBaseAvailable(config);
// This instantiates an HTable object that connects you to
the "myTable"
// table.
HTable table = new HTable(config, "asset");
Get g = new Get(Bytes.toBytes("APU 331-350"));
Result r = table.get(g);
*This is the content of my /etc/hosts file*
#127.0.0.1 localhost.localdomain localhost
#10.78.32.131 honeywel-4a7632
#127.0.1.1 honeywel-4a7632
::1 honeywel-4a7632 localhost6.localdomain6 localhost6
10.78.32.131 honeywel-4a7632 localhost
*
This is part of my error stack trace*
12/05/29 18:53:33 INFO client.HConnectionManager$HConnectionImplementation:
getMaster attempt 0 of 1 failed; no more retrying.
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
at
org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:489)
at
org.apache.hadoop.hbase.ipc.HBaseClient$Connection.setupConnection(HBaseClient.java:328)
at
org.apache.hadoop.hbase.ipc.HBaseClient$Connection.setupIOstreams(HBaseClient.java:362)
at
org.apache.hadoop.hbase.ipc.HBaseClient.getConnection(HBaseClient.java:1045)
at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:897)
at
org.apache.hadoop.hbase.ipc.WritableRpcEngine$Invoker.invoke(WritableRpcEngine.java:150)
at $Proxy5.getProtocolVersion(Unknown Source)
at
org.apache.hadoop.hbase.ipc.WritableRpcEngine.getProxy(WritableRpcEngine.java:183)
at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:303)
at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:280)
at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:332)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:642)
at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:106)
at
org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.java:1553)
at hbaseMain.main(hbaseMain.java:27)
12/05/29 18:53:33 INFO client.HConnectionManager$HConnectionImplementation:
Closed zookeeper sessionid=0x13798c3ce190003
12/05/29 18:53:33 INFO zookeeper.ZooKeeper: Session: 0x13798c3ce190003
closed
12/05/29 18:53:33 INFO zookeeper.ClientCnxn: EventThread shut down
Can some one help me fix this? Thanks a lot.
--
Regards,
Anand
Re: Issues with Java sample for connecting to remote Hbase
Posted by N Keywal <nk...@gmail.com>.
>From http://hbase.apache.org/book/os.html:
HBase expects the loopback IP address to be 127.0.0.1. Ubuntu and some
other distributions, for example, will default to 127.0.1.1 and this
will cause problems for you.
It worths reading the whole section ;-).
You also don't need to set the master address: it will be read from
zookeeper. I.e. you can remove this line from your client code:
>> > config.set("hbase.master", "10.78.32.131:60010");
N.
On Tue, May 29, 2012 at 3:46 PM, AnandaVelMurugan Chandra Mohan
<an...@gmail.com> wrote:
> Thanks for the response. It still errors out.
>
> On Tue, May 29, 2012 at 7:05 PM, Mohammad Tariq <do...@gmail.com> wrote:
>
>> change the name from "localhost" to something else in the line
>> "10.78.32.131 honeywel-4a7632 localhost" and see if it works
>>
>> Regards,
>> Mohammad Tariq
>>
>>
>> On Tue, May 29, 2012 at 6:59 PM, AnandaVelMurugan Chandra Mohan
>> <an...@gmail.com> wrote:
>> > I have HBase version 0.92.1 running in standalone mode. I created a table
>> > and added few rows using hbase shell. Now I am developing a standalone
>> java
>> > application to connect to Hbase and retrieve the data from the table.
>> > *
>> > This is the code I am using
>> > *
>> > Configuration config = HBaseConfiguration.create();
>> > config.clear();
>> > config.set("hbase.zookeeper.quorum", "10.78.32.131");
>> > config.set("hbase.zookeeper.property.clientPort","2181");
>> > config.set("hbase.master", "10.78.32.131:60010");
>> >
>> > HBaseAdmin.checkHBaseAvailable(config);
>> >
>> >
>> > // This instantiates an HTable object that connects you to
>> > the "myTable"
>> > // table.
>> > HTable table = new HTable(config, "asset");
>> >
>> > Get g = new Get(Bytes.toBytes("APU 331-350"));
>> > Result r = table.get(g);
>> >
>> > *This is the content of my /etc/hosts file*
>> >
>> > #127.0.0.1 localhost.localdomain localhost
>> > #10.78.32.131 honeywel-4a7632
>> > #127.0.1.1 honeywel-4a7632
>> > ::1 honeywel-4a7632 localhost6.localdomain6 localhost6
>> > 10.78.32.131 honeywel-4a7632 localhost
>> > *
>> > This is part of my error stack trace*
>> >
>> > 12/05/29 18:53:33 INFO
>> client.HConnectionManager$HConnectionImplementation:
>> > getMaster attempt 0 of 1 failed; no more retrying.
>> > java.net.ConnectException: Connection refused: no further information
>> > at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
>> > at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
>> > at
>> >
>> org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
>> > at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:489)
>> > at
>> >
>> org.apache.hadoop.hbase.ipc.HBaseClient$Connection.setupConnection(HBaseClient.java:328)
>> > at
>> >
>> org.apache.hadoop.hbase.ipc.HBaseClient$Connection.setupIOstreams(HBaseClient.java:362)
>> > at
>> >
>> org.apache.hadoop.hbase.ipc.HBaseClient.getConnection(HBaseClient.java:1045)
>> > at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:897)
>> > at
>> >
>> org.apache.hadoop.hbase.ipc.WritableRpcEngine$Invoker.invoke(WritableRpcEngine.java:150)
>> > at $Proxy5.getProtocolVersion(Unknown Source)
>> > at
>> >
>> org.apache.hadoop.hbase.ipc.WritableRpcEngine.getProxy(WritableRpcEngine.java:183)
>> > at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:303)
>> > at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:280)
>> > at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:332)
>> > at
>> >
>> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:642)
>> > at
>> org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:106)
>> > at
>> >
>> org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.java:1553)
>> > at hbaseMain.main(hbaseMain.java:27)
>> > 12/05/29 18:53:33 INFO
>> client.HConnectionManager$HConnectionImplementation:
>> > Closed zookeeper sessionid=0x13798c3ce190003
>> > 12/05/29 18:53:33 INFO zookeeper.ZooKeeper: Session: 0x13798c3ce190003
>> > closed
>> > 12/05/29 18:53:33 INFO zookeeper.ClientCnxn: EventThread shut down
>> >
>> > Can some one help me fix this? Thanks a lot.
>> > --
>> > Regards,
>> > Anand
>>
>
>
>
> --
> Regards,
> Anand
Re: Issues with Java sample for connecting to remote Hbase
Posted by AnandaVelMurugan Chandra Mohan <an...@gmail.com>.
Thanks for the response. It still errors out.
On Tue, May 29, 2012 at 7:05 PM, Mohammad Tariq <do...@gmail.com> wrote:
> change the name from "localhost" to something else in the line
> "10.78.32.131 honeywel-4a7632 localhost" and see if it works
>
> Regards,
> Mohammad Tariq
>
>
> On Tue, May 29, 2012 at 6:59 PM, AnandaVelMurugan Chandra Mohan
> <an...@gmail.com> wrote:
> > I have HBase version 0.92.1 running in standalone mode. I created a table
> > and added few rows using hbase shell. Now I am developing a standalone
> java
> > application to connect to Hbase and retrieve the data from the table.
> > *
> > This is the code I am using
> > *
> > Configuration config = HBaseConfiguration.create();
> > config.clear();
> > config.set("hbase.zookeeper.quorum", "10.78.32.131");
> > config.set("hbase.zookeeper.property.clientPort","2181");
> > config.set("hbase.master", "10.78.32.131:60010");
> >
> > HBaseAdmin.checkHBaseAvailable(config);
> >
> >
> > // This instantiates an HTable object that connects you to
> > the "myTable"
> > // table.
> > HTable table = new HTable(config, "asset");
> >
> > Get g = new Get(Bytes.toBytes("APU 331-350"));
> > Result r = table.get(g);
> >
> > *This is the content of my /etc/hosts file*
> >
> > #127.0.0.1 localhost.localdomain localhost
> > #10.78.32.131 honeywel-4a7632
> > #127.0.1.1 honeywel-4a7632
> > ::1 honeywel-4a7632 localhost6.localdomain6 localhost6
> > 10.78.32.131 honeywel-4a7632 localhost
> > *
> > This is part of my error stack trace*
> >
> > 12/05/29 18:53:33 INFO
> client.HConnectionManager$HConnectionImplementation:
> > getMaster attempt 0 of 1 failed; no more retrying.
> > java.net.ConnectException: Connection refused: no further information
> > at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
> > at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
> > at
> >
> org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
> > at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:489)
> > at
> >
> org.apache.hadoop.hbase.ipc.HBaseClient$Connection.setupConnection(HBaseClient.java:328)
> > at
> >
> org.apache.hadoop.hbase.ipc.HBaseClient$Connection.setupIOstreams(HBaseClient.java:362)
> > at
> >
> org.apache.hadoop.hbase.ipc.HBaseClient.getConnection(HBaseClient.java:1045)
> > at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:897)
> > at
> >
> org.apache.hadoop.hbase.ipc.WritableRpcEngine$Invoker.invoke(WritableRpcEngine.java:150)
> > at $Proxy5.getProtocolVersion(Unknown Source)
> > at
> >
> org.apache.hadoop.hbase.ipc.WritableRpcEngine.getProxy(WritableRpcEngine.java:183)
> > at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:303)
> > at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:280)
> > at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:332)
> > at
> >
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:642)
> > at
> org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:106)
> > at
> >
> org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.java:1553)
> > at hbaseMain.main(hbaseMain.java:27)
> > 12/05/29 18:53:33 INFO
> client.HConnectionManager$HConnectionImplementation:
> > Closed zookeeper sessionid=0x13798c3ce190003
> > 12/05/29 18:53:33 INFO zookeeper.ZooKeeper: Session: 0x13798c3ce190003
> > closed
> > 12/05/29 18:53:33 INFO zookeeper.ClientCnxn: EventThread shut down
> >
> > Can some one help me fix this? Thanks a lot.
> > --
> > Regards,
> > Anand
>
--
Regards,
Anand
Re: Issues with Java sample for connecting to remote Hbase
Posted by Mohammad Tariq <do...@gmail.com>.
change the name from "localhost" to something else in the line
"10.78.32.131 honeywel-4a7632 localhost" and see if it works
Regards,
Mohammad Tariq
On Tue, May 29, 2012 at 6:59 PM, AnandaVelMurugan Chandra Mohan
<an...@gmail.com> wrote:
> I have HBase version 0.92.1 running in standalone mode. I created a table
> and added few rows using hbase shell. Now I am developing a standalone java
> application to connect to Hbase and retrieve the data from the table.
> *
> This is the code I am using
> *
> Configuration config = HBaseConfiguration.create();
> config.clear();
> config.set("hbase.zookeeper.quorum", "10.78.32.131");
> config.set("hbase.zookeeper.property.clientPort","2181");
> config.set("hbase.master", "10.78.32.131:60010");
>
> HBaseAdmin.checkHBaseAvailable(config);
>
>
> // This instantiates an HTable object that connects you to
> the "myTable"
> // table.
> HTable table = new HTable(config, "asset");
>
> Get g = new Get(Bytes.toBytes("APU 331-350"));
> Result r = table.get(g);
>
> *This is the content of my /etc/hosts file*
>
> #127.0.0.1 localhost.localdomain localhost
> #10.78.32.131 honeywel-4a7632
> #127.0.1.1 honeywel-4a7632
> ::1 honeywel-4a7632 localhost6.localdomain6 localhost6
> 10.78.32.131 honeywel-4a7632 localhost
> *
> This is part of my error stack trace*
>
> 12/05/29 18:53:33 INFO client.HConnectionManager$HConnectionImplementation:
> getMaster attempt 0 of 1 failed; no more retrying.
> java.net.ConnectException: Connection refused: no further information
> at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
> at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
> at
> org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
> at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:489)
> at
> org.apache.hadoop.hbase.ipc.HBaseClient$Connection.setupConnection(HBaseClient.java:328)
> at
> org.apache.hadoop.hbase.ipc.HBaseClient$Connection.setupIOstreams(HBaseClient.java:362)
> at
> org.apache.hadoop.hbase.ipc.HBaseClient.getConnection(HBaseClient.java:1045)
> at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:897)
> at
> org.apache.hadoop.hbase.ipc.WritableRpcEngine$Invoker.invoke(WritableRpcEngine.java:150)
> at $Proxy5.getProtocolVersion(Unknown Source)
> at
> org.apache.hadoop.hbase.ipc.WritableRpcEngine.getProxy(WritableRpcEngine.java:183)
> at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:303)
> at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:280)
> at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:332)
> at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:642)
> at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:106)
> at
> org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.java:1553)
> at hbaseMain.main(hbaseMain.java:27)
> 12/05/29 18:53:33 INFO client.HConnectionManager$HConnectionImplementation:
> Closed zookeeper sessionid=0x13798c3ce190003
> 12/05/29 18:53:33 INFO zookeeper.ZooKeeper: Session: 0x13798c3ce190003
> closed
> 12/05/29 18:53:33 INFO zookeeper.ClientCnxn: EventThread shut down
>
> Can some one help me fix this? Thanks a lot.
> --
> Regards,
> Anand