Testing java HBase connection

前端 未结 4 1764
无人共我
无人共我 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: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.

提交回复
热议问题