Search in sources :

Example 6 with HConnection

use of org.apache.hadoop.hbase.client.HConnection in project metron by apache.

the class CIFHbaseAdapter method initializeAdapter.

@Override
public boolean initializeAdapter(Map<String, Object> config) {
    // Initialize HBase Table
    Configuration conf = null;
    conf = HBaseConfiguration.create();
    conf.set("hbase.zookeeper.quorum", _quorum);
    conf.set("hbase.zookeeper.property.clientPort", _port);
    try {
        LOGGER.debug("=======Connecting to HBASE===========");
        LOGGER.debug("=======ZOOKEEPER = {}", conf.get("hbase.zookeeper.quorum"));
        HConnection connection = HConnectionManager.createConnection(conf);
        table = connection.getTable(_tableName);
        return true;
    } catch (IOException e) {
        LOGGER.debug("=======Unable to Connect to HBASE===========");
        e.printStackTrace();
    }
    return false;
}
Also used : HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Configuration(org.apache.hadoop.conf.Configuration) IOException(java.io.IOException) HConnection(org.apache.hadoop.hbase.client.HConnection)

Aggregations

HConnection (org.apache.hadoop.hbase.client.HConnection)6 IOException (java.io.IOException)4 Configuration (org.apache.hadoop.conf.Configuration)2 Path (org.apache.hadoop.fs.Path)2 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)2 HRegionLocation (org.apache.hadoop.hbase.HRegionLocation)2 HBaseTableUtil (co.cask.cdap.data2.util.hbase.HBaseTableUtil)1 HBaseTableUtilFactory (co.cask.cdap.data2.util.hbase.HBaseTableUtilFactory)1 ProvisionException (com.google.inject.ProvisionException)1 ServiceException (com.google.protobuf.ServiceException)1 CommandLine (org.apache.commons.cli.CommandLine)1 CommandLineParser (org.apache.commons.cli.CommandLineParser)1 GnuParser (org.apache.commons.cli.GnuParser)1 HelpFormatter (org.apache.commons.cli.HelpFormatter)1 Options (org.apache.commons.cli.Options)1 ParseException (org.apache.commons.cli.ParseException)1 ServerName (org.apache.hadoop.hbase.ServerName)1 Get (org.apache.hadoop.hbase.client.Get)1 HTableInterface (org.apache.hadoop.hbase.client.HTableInterface)1 RegionLocator (org.apache.hadoop.hbase.client.RegionLocator)1