Testing java HBase connection

前端 未结 4 1730
无人共我
无人共我 2021-01-06 04:50

I am trying to use the HBase Java APIs to write data into HBase. I installed Hadoop/HBase through Ambari.

Here is how the configuration is currently set up:

相关标签:
4条回答
  • 2021-01-06 05:25

    You can use HBaseAdmin.checkHBaseAvailable(conf);

    0 讨论(0)
  • 2021-01-06 05:39

    The property below resolved my issue

    For Hortonworks: hconfig.set("zookeeper.znode.parent", "/hbase-unsecure")

    For cloudera: hconfig.set("zookeeper.znode.parent", "/hbase")

    0 讨论(0)
  • 2021-01-06 05:40
       Configuration conf = HBaseConfiguration.create();
       conf.set("hbase.master", "ip_address:60000");
       conf.set("hbase.zookeeper.quorum","ip_address");
       conf.set("hbase.zookeeper.property.clientPort", "2181");
    
        HBaseAdmin admin = new HBaseAdmin(conf);
    
        boolean bool = admin.tableExists("table_name");
        System.out.println( bool);
    

    ip_address : this is the ip_adress of your hbase cluster, change your hbase zookeeper port (2181) if it is not the same on your configuration files.

    0 讨论(0)
  • 2021-01-06 05:48

    In addition to the configuration parameters suggested by Yosr, specifying

    conf.set("zookeeper.znode.parent", "VALUE")
    

    would help resolve the issue.

    0 讨论(0)
提交回复
热议问题