Home Forums Hortonworks Sandbox HBase Java Client listTables() Issue

This topic contains 6 replies, has 4 voices, and was last updated by  tedr 9 months, 1 week ago.

  • Creator
    Topic
  • #25555

    Jet Wu
    Member

    Hi,

    I am able to connect sandbox’s HBase using java client API from another computer. However, I am unable to list the tables that I created for sandbox account by following the tutorial. I guess that is because of different user account.

    How do I connect to sandbox’s HBase by specify ‘sandbox’ account using java client API.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

  • Author
    Replies
  • #29212

    tedr
    Moderator

    Hi Labret,

    thanks for the info.

    Ted.

    Collapse
    #29208

    Hello,
    I’m just beginner in HBase but maybe try without port number :

    Configuration config = HBaseConfiguration.create();
    config.set(“hbase.zookeeper.quorum”, “192.168.56.101″);
    HBaseAdmin hbadmin = new HBaseAdmin(config);
    HTableDescriptor[] tabdesc = hbadmin.listTables();
    for(int i=0; i<tabdesc.length; i++) {
    System.out.println("Table = " + new String(tabdesc [i].getName()));
    }

    // witout : config.set(“hbase.zookeeper.property.clientPort”, “2181″);
    Maybe this line replace the last data recorded in the "config" property and therefore the Hbase connection becomes impossible.
    In my case, everything works with IP adress (in the config files) without to use the port number.

    Good luck.

    Collapse
    #25892

    Seth Lyubich
    Keymaster

    Hi Jet,

    Thanks for letting us know that you figured out the issue.

    Thanks,
    Seth

    Collapse
    #25824

    Jet Wu
    Member

    Hi Sef,

    I figure out that those tables created in tutorial are not HBase table. They are in HCatalog table.
    Of course I can not find them by calling HBase client. It is my mistake.

    Sorry for that and thanks for your reply anyway.

    Collapse
    #25657

    Jet Wu
    Member

    Hi Sef,

    Actually I did not get error message or exception. I just unable to list those tables I’ve created follow the tutorial, like batting_data or master_data. However, if I create HBase table through my HBase java client first. Then I can find it later by calling HBaseAdmin.listTables(). I wonder that because of account issue. In the tutorial, I created table under sandbox account. But I did not specify ‘sandbox’ in HBase java client. How do I specify a particular account when calling HBase java client? The below is my code. Thank you very much.

    Configuration config = HBaseConfiguration.create();
    config.set(“hbase.zookeeper.quorum”, “192.168.56.101″);
    config.set(“hbase.zookeeper.property.clientPort”, “2181″);

    HBaseAdmin hbadmin = null;

    try {
    System.out.println(“Test HBase availble”);
    HBaseAdmin.checkHBaseAvailable(config);

    hbadmin = new HBaseAdmin(config);
    } catch (Exception e) {
    e.printStackTrace();
    System.exit(1);
    }

    System.out.println(“HBase is available.”);

    try {
    HTableDescriptor[] tabdesc = hbadmin.listTables();

    for (int i=0; i<tabdesc.length; i++) {
    System.out.println("Table = " + tabdesc[i].toString());
    }
    } catch (IOException e) {
    e.printStackTrace();
    }

    Collapse
    #25612

    Seth Lyubich
    Keymaster

    Hi Jet,

    Thanks for trying Sandbox,

    Can you please provide code example and error that you got?

    Thanks,
    Seth

    Collapse
Viewing 6 replies - 1 through 6 (of 6 total)