Refine search
usePageFilter = false; if ("kerberos".equalsIgnoreCase(CONFIG.get("hbase.security.authentication"))) { CONFIG.set("hadoop.security.authentication", "Kerberos"); UserGroupInformation.setConfiguration(CONFIG); synchronized (THREAD_COUNT) { if (hConn == null) { hConn = HConnectionManager.createConnection(CONFIG); HTableInterface ht = hConn.getTable(table); ht.getTableDescriptor(); } catch (IOException e) {
private synchronized void connectToHbase() { Configuration configuration = new Configuration(); configuration.set("hbase.rootdir", config.getRootdir()); configuration.set("zookeeper.znode.parent", config.getParent()); configuration.set("zookeeper.znode.rootserver", config.getRootserver()); configuration.set("hbase.cluster.distributed", "false"); connection = HConnectionManager.createConnection(configuration); } catch (Exception ex) { ex.printStackTrace();
/** * Initialize the Invalid List Debug Tool. * @param conf {@link Configuration} * @throws IOException when not able to create an HBase connection */ @Override @SuppressWarnings("WeakerAccess") public void initialize(final Configuration conf) throws IOException { LOG.debug("InvalidListPruningDebugMain : initialize method called"); connection = HConnectionManager.createConnection(conf); tableName = TableName.valueOf(conf.get(TxConstants.TransactionPruning.PRUNE_STATE_TABLE, TxConstants.TransactionPruning.DEFAULT_PRUNE_STATE_TABLE)); dataJanitorState = new DataJanitorState(new DataJanitorState.TableSupplier() { @Override public HTableInterface get() throws IOException { return connection.getTable(tableName); } }); }
/** * Create a sink for replication * * @param conf conf object * @param stopper boolean to tell this thread to stop * @throws IOException thrown when HDFS goes bad or bad file name */ public ReplicationSink(Configuration conf, Stoppable stopper) throws IOException { this.conf = HBaseConfiguration.create(conf); decorateConf(); this.sharedHtableCon = HConnectionManager.createConnection(this.conf); this.sharedThreadPool = new ThreadPoolExecutor(1, conf.getInt("hbase.htable.threads.max", Integer.MAX_VALUE), conf.getLong("hbase.htable.threads.keepalivetime", 60), TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), Threads.newDaemonThreadFactory("hbase-repl")); ((ThreadPoolExecutor)this.sharedThreadPool).allowCoreThreadTimeOut(true); this.metrics = new ReplicationSinkMetrics(); }
public static void main(String args[]) throws IOException { System.out.println("\n############################The Themis Example###########################\n"); conf = HBaseConfiguration.create(); HConnection connection = HConnectionManager.createConnection(conf); String timeStampOracleCls = conf.get(TransactionConstant.TIMESTAMP_ORACLE_CLASS_KEY, LocalTimestampOracle.class.getName()); System.out.println("use timestamp oracle class : " + timeStampOracleCls); connection.close(); Transaction.destroy(); System.out.println("\n###############################Example End###############################");
this.conf = conf; this.replicationQueueSizeCapacity = this.conf.getLong("replication.source.size.capacity", 1024*1024*64); this.replicationQueueNbCapacity = this.conf.getInt("replication.source.nb.capacity", 25000); this.entriesArray = new HLog.Entry[this.replicationQueueNbCapacity]; for (int i = 0; i < this.replicationQueueNbCapacity; i++) { this.conf.getInt("replication.source.maxretriesmultiplier", 10); this.socketTimeoutMultiplier = maxRetriesMultiplier * maxRetriesMultiplier; this.queue = conf.getInt("hbase.regionserver.maxlogs", 32), new LogsComparator()); this.conn = HConnectionManager.getConnection(conf); this.zkHelper = manager.getRepZkWrapper(); this.ratio = this.conf.getFloat("replication.source.ratio", 0.1f);
String tableHeader = "<h2>Table Regions</h2><table><tr><th>Name</th><th>Region Server</th><th>Start Key</th><th>End Key</th><th>Requests</th></tr>"; ServerName rl = master.getCatalogTracker().getRootLocation(); boolean showFragmentation = conf.getBoolean("hbase.master.ui.fragmentation.enabled", false); boolean readOnly = conf.getBoolean("hbase.master.ui.readonly", false); Map<String, Integer> frags = null; if (showFragmentation) { int infoPort = conf.getInt("hbase.regionserver.info.port", 60030); HConnectionManager.deleteConnection(hbadmin.getConfiguration());
throws MasterNotRunningException, ZooKeeperConnectionException { this.conf = HBaseConfiguration.create(c); this.connection = HConnectionManager.getConnection(this.conf); this.pause = this.conf.getLong("hbase.client.pause", 1000); this.numRetries = this.conf.getInt("hbase.client.retries.number", 10); this.retryLongerMultiplier = this.conf.getInt( "hbase.client.retries.longer.multiplier", 10); try { this.connection.getMaster(); return; HConnectionManager.deleteStaleConnection(this.connection); this.connection = HConnectionManager.getConnection(this.conf); if (tries >= numRetries) { HConnectionManager.deleteStaleConnection(this.connection); throw new MasterNotRunningException("Retried " + numRetries + " times"); Thread.currentThread().interrupt(); HConnectionManager.deleteStaleConnection(this.connection); throw new MasterNotRunningException( "Interrupted after "+tries+" tries");
return; this.connection = HConnectionManager.getConnection(conf); this.configuration = conf; int maxThreads = conf.getInt("hbase.htable.threads.max", Integer.MAX_VALUE); if (maxThreads == 0) { maxThreads = 1; // is there a better default? long keepAliveTime = conf.getLong("hbase.htable.threads.keepalivetime", 60);
public ThemisTableRecordWriterBase(Configuration conf) throws IOException { connection = HConnectionManager.createConnection(conf); this.logPerWriteTransaction = conf.getInt(LOG_PER_WRITE_TRANSACTION_COUNT, 100); this.writeRetryCount = conf.getInt(THEMIS_WRITE_RETRY_COUNT, 1); this.writeRetryPause = conf.getInt(THEMIS_WRITE_RETRY_PAUSE, 1000); }
/** * Constructor that creates a connection to the local ZooKeeper ensemble. * @param conf Configuration to use * @throws IOException if the connection to ZK cannot be made * @throws RuntimeException if replication isn't enabled. */ public ReplicationAdmin(Configuration conf) throws IOException { if (!conf.getBoolean(HConstants.REPLICATION_ENABLE_KEY, false)) { throw new RuntimeException("hbase.replication isn't true, please " + "enable it in order to use replication"); } this.connection = HConnectionManager.getConnection(conf); ZooKeeperWatcher zkw = this.connection.getZooKeeperWatcher(); try { this.replicationZk = new ReplicationZookeeper(this.connection, conf, zkw); } catch (KeeperException e) { throw new IOException("Unable setup the ZooKeeper connection", e); } }
try (HConnection hbaseConnection = HConnectionManager.createConnection(hConf)) { hbaseConnection.listTables(); LOG.info(" HBase availability successfully verified."); } catch (IOException e) { if (hConf.getBoolean("hbase.security.authorization", false)) { if (cConf.getBoolean(TxConstants.TransactionPruning.PRUNE_ENABLE)) { LOG.info("HBase authorization and transaction pruning are enabled. Checking global admin privileges for cdap.");
conf.addResource(new Path("/etc/hbase/conf/hbase-site.xml")); HConnection hbaseConnection = HConnectionManager.createConnection(hbaseConfig); HTableInterface table = hbaseConnection.getTable(tableName);
ServerManager(final Server master, final MasterServices services, final boolean connect) throws ZooKeeperConnectionException { this.master = master; this.services = services; Configuration c = master.getConfiguration(); maxSkew = c.getLong("hbase.master.maxclockskew", 30000); warningSkew = c.getLong("hbase.master.warningclockskew", 10000); this.deadservers = new DeadServer(); this.connection = connect ? HConnectionManager.getConnection(c) : null; }
@Override public ConnectionMask createConnection(Configuration conf) throws IOException { return new HConnection0_94(HConnectionManager.createConnection(conf)); }
public void startClient() { if (this.htable == null) { try { this.hconnection = HConnectionManager.createConnection(conf); this.htable = hconnection.getTable(table); } catch (IOException e) { LOG.warn("Failed to create HBase connection. " + e.getMessage()); } } }
ResultScanner scanner = null; try { conn = HConnectionManager.createConnection(hconf); table = conn.getTable(hbaseTable); scanner = table.getScanner(scan); int count = 0; conn.close();
public synchronized static void waitForConnection(long timeout, TimeUnit timeoutUnit) { long before = System.currentTimeMillis(); long after; long timeoutMS = TimeUnit.MILLISECONDS.convert(timeout, timeoutUnit); do { try { HConnection hc = HConnectionManager.createConnection(HBaseConfiguration.create()); hc.close(); after = System.currentTimeMillis(); log.info("HBase server to started after about {} ms", after - before); return; } catch (IOException e) { log.info("Exception caught while waiting for the HBase server to start", e); } after = System.currentTimeMillis(); } while (timeoutMS > after - before); after = System.currentTimeMillis(); log.warn("HBase server did not start in {} ms", after - before); }
HConnection connection = HConnectionManager.getConnection(conf); boolean connectSucceeded = false; try { } finally { try { connection.close(); } catch (Exception e) { if (connectSucceeded) {
/** * Delete stale connection information for the instance specified by configuration. * This will then close connection to * the zookeeper ensemble and let go of all resources. * * @param connection */ public static void deleteStaleConnection(HConnection connection) { deleteConnection(connection, true); }