org.apache.hadoop.hbase.client.Connection.getConfiguration()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中org.apache.hadoop.hbase.client.Connection.getConfiguration()方法的一些代码示例,展示了Connection.getConfiguration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connection.getConfiguration()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Connection
类名称:Connection
方法名:getConfiguration

Connection.getConfiguration介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

@Override
public Configuration getConfiguration() {
 return this.conn.getConfiguration();
}

代码示例来源:origin: apache/hbase

/**
 * Contacts a region server and waits up to hbase.hbck.close.timeout ms
 * (default 120s) to close the region.  This bypasses the active hmaster.
 */
@SuppressWarnings("deprecation")
public static void closeRegionSilentlyAndWait(Connection connection,
  ServerName server, RegionInfo region) throws IOException, InterruptedException {
 long timeout = connection.getConfiguration()
  .getLong("hbase.hbck.close.timeout", 120000);
 ServerManager.closeRegionSilentlyAndWait((ClusterConnection)connection, server,
    region, timeout);
}

代码示例来源:origin: apache/hbase

Test(final Connection con, final TestOptions options, final Status status) {
  super(con == null ? HBaseConfiguration.create() : con.getConfiguration(), options, status);
  this.connection = con;
 }
}

代码示例来源:origin: apache/hbase

private static Scan getMetaScan(Connection connection, int rowUpperLimit) {
 Scan scan = new Scan();
 int scannerCaching = connection.getConfiguration()
   .getInt(HConstants.HBASE_META_SCANNER_CACHING,
     HConstants.DEFAULT_HBASE_META_SCANNER_CACHING);
 if (connection.getConfiguration().getBoolean(HConstants.USE_META_REPLICAS,
   HConstants.DEFAULT_USE_META_REPLICAS)) {
  scan.setConsistency(Consistency.TIMELINE);
 }
 if (rowUpperLimit > 0) {
  scan.setLimit(rowUpperLimit);
  scan.setReadType(Scan.ReadType.PREAD);
 }
 scan.setCaching(scannerCaching);
 return scan;
}
/**

代码示例来源:origin: apache/kylin

public HBaseResourceStore(KylinConfig kylinConfig) throws IOException {
  super(kylinConfig);
  metadataUrl = buildMetadataUrl(kylinConfig);
  tableName = metadataUrl.getIdentifier();
  createHTableIfNeeded(tableName);
  kvSizeLimit = Integer
      .parseInt(getConnection().getConfiguration().get("hbase.client.keyvalue.maxsize", "10485760"));
}

代码示例来源:origin: apache/hbase

public static void deleteSnapshot(Connection conn) throws IOException {
 Configuration conf = conn.getConfiguration();
 LOG.debug("Deleting " + BackupSystemTable.getSnapshotName(conf) + " from the system");
 try (Admin admin = conn.getAdmin()) {
  String snapshotName = BackupSystemTable.getSnapshotName(conf);
  if (snapshotExists(admin, snapshotName)) {
   admin.deleteSnapshot(snapshotName);
   LOG.debug("Done deleting backup system table snapshot");
  } else {
   LOG.error("Snapshot " + snapshotName + " does not exists");
  }
 }
}

代码示例来源:origin: apache/hbase

public BackupSystemTable(Connection conn) throws IOException {
 this.connection = conn;
 Configuration conf = this.connection.getConfiguration();
 tableName = BackupSystemTable.getTableName(conf);
 bulkLoadTableName = BackupSystemTable.getTableNameForBulkLoadedData(conf);
 checkSystemTable();
}

代码示例来源:origin: apache/hbase

public static boolean snapshotExists(Connection conn) throws IOException {
 return snapshotExists(conn.getAdmin(), getSnapshotName(conn.getConfiguration()));
}

代码示例来源:origin: apache/hbase

@Test public void testBackupPathIsAccessible() throws Exception {
 Path path = new Path(PERMISSION_TEST_PATH);
 FileSystem fs = FileSystem.get(TEST_UTIL.getConnection().getConfiguration());
 fs.mkdirs(path);
}

代码示例来源:origin: apache/hbase

@Override
public void mergeBackups(String[] backupIds) throws IOException {
 try (final BackupSystemTable sysTable = new BackupSystemTable(conn)) {
  checkIfValidForMerge(backupIds, sysTable);
  //TODO run job on remote cluster
  BackupMergeJob job = BackupRestoreFactory.getBackupMergeJob(conn.getConfiguration());
  job.run(backupIds);
 }
}

代码示例来源:origin: apache/hbase

public static void snapshot(Connection conn) throws IOException {
 try (Admin admin = conn.getAdmin()) {
  Configuration conf = conn.getConfiguration();
  admin.snapshot(BackupSystemTable.getSnapshotName(conf), BackupSystemTable.getTableName(conf));
 }
}

代码示例来源:origin: apache/hbase

@Test(expected = IOException.class) public void testBackupPathIsNotAccessible() throws Exception {
  Path path = new Path(PERMISSION_TEST_PATH);
  FileSystem rootFs = FileSystem.get(TEST_UTIL.getConnection().getConfiguration());
  rootFs.mkdirs(path.getParent());
  rootFs.setPermission(path.getParent(), FsPermission.createImmutable((short) 000));
  FileSystem fs =
    DFSTestUtil.getFileSystemAs(DIANA, TEST_UTIL.getConnection().getConfiguration());
  fs.mkdirs(path);
 }
}

代码示例来源:origin: apache/hbase

public RestoreTablesClient(Connection conn, RestoreRequest request) {
 this.targetRootDir = request.getBackupRootDir();
 this.backupId = request.getBackupId();
 this.sTableArray = request.getFromTables();
 this.tTableArray = request.getToTables();
 if (tTableArray == null || tTableArray.length == 0) {
  this.tTableArray = sTableArray;
 }
 this.isOverwrite = request.isOverwrite();
 this.conn = conn;
 this.conf = conn.getConfiguration();
}

代码示例来源:origin: apache/hbase

@Before
public void before() throws IOException {
 backupManager = new BackupManager(conn, conn.getConfiguration());
}

代码示例来源:origin: apache/hbase

private void addNewRegions() {
 try {
  List<HRegionLocation> locations =
    connection.getRegionLocator(tableName).getAllRegionLocations();
  for (HRegionLocation location : locations) {
   if (location.getRegion().getRegionId() > timestamp) {
    Optional<MajorCompactionRequest> compactionRequest = MajorCompactionRequest
      .newRequest(connection.getConfiguration(), location.getRegion(), storesToCompact,
        timestamp);
    compactionRequest.ifPresent(request -> clusterCompactionQueues
      .addToCompactionQueue(location.getServerName(), request));
   }
  }
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: apache/hbase

/**
 * Trivial test to verify that nobody messes with
 * {@link ConnectionFactory#createConnection(Configuration)}
 */
@Test
public void testCreateConnection() throws Exception {
 Configuration configuration = TEST_UTIL.getConfiguration();
 Connection c1 = ConnectionFactory.createConnection(configuration);
 Connection c2 = ConnectionFactory.createConnection(configuration);
 // created from the same configuration, yet they are different
 assertTrue(c1 != c2);
 assertTrue(c1.getConfiguration() == c2.getConfiguration());
}

代码示例来源:origin: apache/hbase

/**
 * Returns the number of quotas defined in the HBase quota table.
 */
long listNumDefinedQuotas(Connection conn) throws IOException {
 QuotaRetriever scanner = QuotaRetriever.open(conn.getConfiguration());
 try {
  return Iterables.size(scanner);
 } finally {
  if (scanner != null) {
   scanner.close();
  }
 }
}

代码示例来源:origin: apache/hbase

protected void instantiateHTable() throws IOException {
 mutator = connection.getBufferedMutator(
   new BufferedMutatorParams(getTableName(connection.getConfiguration()))
     .writeBufferSize(4 * 1024 * 1024));
}

代码示例来源:origin: apache/hbase

private void checkSystemTable() throws IOException {
 try (Admin admin = connection.getAdmin()) {
  verifyNamespaceExists(admin);
  Configuration conf = connection.getConfiguration();
  if (!admin.tableExists(tableName)) {
   TableDescriptor backupHTD = BackupSystemTable.getSystemTableDescriptor(conf);
   admin.createTable(backupHTD);
  }
  if (!admin.tableExists(bulkLoadTableName)) {
   TableDescriptor blHTD = BackupSystemTable.getSystemTableForBulkLoadedDataDescriptor(conf);
   admin.createTable(blHTD);
  }
  waitForSystemTable(admin, tableName);
  waitForSystemTable(admin, bulkLoadTableName);
 }
}

代码示例来源:origin: apache/hbase

QuotaSettings getTableSpaceQuota(Connection conn, TableName tn) throws IOException {
 try (QuotaRetriever scanner = QuotaRetriever.open(
   conn.getConfiguration(), new QuotaFilter().setTableFilter(tn.getNameAsString()))) {
  for (QuotaSettings setting : scanner) {
   if (setting.getTableName().equals(tn) && setting.getQuotaType() == QuotaType.SPACE) {
    return setting;
   }
  }
  return null;
 }
}

相关文章