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

x33g5p2x  于2022-01-15 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(341)

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

Admin.getClusterStatus介绍

暂无

代码示例

代码示例来源:origin: thinkaurelius/titan

@Override
public int getEstimatedRegionServerCount()
{
  int serverCount = -1;
  try {
    serverCount = adm.getClusterStatus().getServers().size();
    log.debug("Read {} servers from HBase ClusterStatus", serverCount);
  } catch (IOException e) {
    log.debug("Unable to retrieve HBase cluster status", e);
  }
  return serverCount;
}

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

@Test
public void testObserver() throws IOException {
 int preCount = MyObserver.PRE_COUNT.get();
 int postCount = MyObserver.POST_COUNT.get();
 Assert.assertTrue(Stream.of(ADMIN.getClusterStatus().getMasterCoprocessors())
   .anyMatch(s -> s.equals(MyObserver.class.getSimpleName())));
 Assert.assertEquals(preCount + 1, MyObserver.PRE_COUNT.get());
 Assert.assertEquals(postCount + 1, MyObserver.POST_COUNT.get());
}

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

@Override
protected boolean doAction() throws Exception {
 Admin admin = null;
 try {
  admin = util.getAdmin();
  ClusterStatus status = admin.getClusterStatus();
  return status != null;
 } finally {
  if (admin != null) {
   admin.close();
  }
 }
}

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

public static void main(final String[] args) throws IOException {
 final boolean deleteAllAtEOJ = true;
 /**
  * ConnectionFactory#createConnection() automatically looks for
  * hbase-site.xml (HBase configuration parameters) on the system's
  * CLASSPATH, to enable creation of Connection to HBase via ZooKeeper.
  */
 try (Connection connection = ConnectionFactory.createConnection();
     Admin admin = connection.getAdmin()) {
  admin.getClusterStatus(); // assure connection successfully established
  System.out.println("\n*** Hello HBase! -- Connection has been "
      + "established via ZooKeeper!!\n");
  createNamespaceAndTable(admin);
  System.out.println("Getting a Table object for [" + MY_TABLE_NAME
      + "] with which to perform CRUD operations in HBase.");
  try (Table table = connection.getTable(MY_TABLE_NAME)) {
   putRowToTable(table);
   getAndPrintRowContents(table);
   if (deleteAllAtEOJ) {
    deleteRow(table);
   }
  }
  if (deleteAllAtEOJ) {
   deleteNamespaceAndTable(admin);
  }
 }
}

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

ClusterStatus clusterStatus = admin.getClusterStatus();
Collection<ServerName> servers = clusterStatus.getServers();
final long megaByte = 1024L * 1024L;

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

public static void main(final String[] args) throws IOException {
 final boolean deleteAllAtEOJ = true;
 /**
  * ConnectionFactory#createConnection() automatically looks for
  * hbase-site.xml (HBase configuration parameters) on the system's
  * CLASSPATH, to enable creation of Connection to HBase via ZooKeeper.
  */
 try (Connection connection = ConnectionFactory.createConnection();
     Admin admin = connection.getAdmin()) {
  admin.getClusterStatus(); // assure connection successfully established
  System.out.println("\n*** Hello HBase! -- Connection has been "
      + "established via ZooKeeper!!\n");
  createNamespaceAndTable(admin);
  System.out.println("Getting a Table object for [" + MY_TABLE_NAME
      + "] with which to perform CRUD operations in HBase.");
  try (Table table = connection.getTable(MY_TABLE_NAME)) {
   putRowToTable(table);
   getAndPrintRowContents(table);
   if (deleteAllAtEOJ) {
    deleteRow(table);
   }
  }
  if (deleteAllAtEOJ) {
   deleteNamespaceAndTable(admin);
  }
 }
}

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

private static void logError(String msg, Context context) throws IOException {
  TableName table = getTableName(context.getConfiguration());
  LOG.error("Failure in chain verification: " + msg);
  try (Connection connection = ConnectionFactory.createConnection(context.getConfiguration());
    Admin admin = connection.getAdmin()) {
   LOG.error("cluster status:\n" + admin.getClusterStatus());
   LOG.error("table regions:\n"
     + Joiner.on("\n").join(admin.getTableRegions(table)));
  }
 }
}

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

clusterStatus = admin.getClusterStatus();
} catch (Exception e) {
 logger.debug(e.getMessage(), e);

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

admin.listTableNames();
final ClusterStatus clusterStatus = admin.getClusterStatus();
if (clusterStatus != null) {
  final ServerName master = clusterStatus.getMaster();

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

admin.listTableNames();
final ClusterStatus clusterStatus = admin.getClusterStatus();
if (clusterStatus != null) {
  final ServerName master = clusterStatus.getMaster();

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

@Test
public void testDefaults() throws Exception {
 ClusterStatus origin = ADMIN.getClusterStatus();
 ClusterStatus defaults
   = new ClusterStatus(ADMIN.getClusterMetrics(EnumSet.allOf(Option.class)));
 checkPbObjectNotNull(origin);
 checkPbObjectNotNull(defaults);
 Assert.assertEquals(origin.getHBaseVersion(), defaults.getHBaseVersion());
 Assert.assertEquals(origin.getClusterId(), defaults.getClusterId());
 Assert.assertTrue(origin.getAverageLoad() == defaults.getAverageLoad());
 Assert.assertTrue(origin.getBackupMastersSize() == defaults.getBackupMastersSize());
 Assert.assertTrue(origin.getDeadServersSize() == defaults.getDeadServersSize());
 Assert.assertTrue(origin.getRegionsCount() == defaults.getRegionsCount());
 Assert.assertTrue(origin.getServersSize() == defaults.getServersSize());
 Assert.assertTrue(origin.getMasterInfoPort() == defaults.getMasterInfoPort());
 Assert.assertTrue(origin.equals(defaults));
}

代码示例来源:origin: larsgeorge/hbase-book

ClusterStatus status = admin.getClusterStatus(); // co ClusterStatusExample-1-GetStatus Get the cluster status.

代码示例来源:origin: org.apache.atlas/atlas-titan

@Override
public int getEstimatedRegionServerCount()
{
  int serverCount = -1;
  try {
    serverCount = adm.getClusterStatus().getServers().size();
    log.debug("Read {} servers from HBase ClusterStatus", serverCount);
  } catch (IOException e) {
    log.debug("Unable to retrieve HBase cluster status", e);
  }
  return serverCount;
}

代码示例来源:origin: apache/incubator-atlas

@Override
public int getEstimatedRegionServerCount()
{
  int serverCount = -1;
  try {
    serverCount = adm.getClusterStatus().getServers().size();
    log.debug("Read {} servers from HBase ClusterStatus", serverCount);
  } catch (IOException e) {
    log.debug("Unable to retrieve HBase cluster status", e);
  }
  return serverCount;
}

代码示例来源:origin: org.apache.atlas/atlas-janusgraph-hbase2

@Override
public int getEstimatedRegionServerCount()
{
  int serverCount = -1;
  try {
    serverCount = adm.getClusterStatus().getServers().size();
    log.debug("Read {} servers from HBase ClusterStatus", serverCount);
  } catch (IOException e) {
    log.debug("Unable to retrieve HBase cluster status", e);
  }
  return serverCount;
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Alternative getCurrentNrHRS which is no longer available.
 * @param connection
 * @return Rough count of regionservers out on cluster.
 * @throws IOException 
 */
private static int getRegionServerCount(final Connection connection) throws IOException {
 try (Admin admin = connection.getAdmin()) {
  ClusterStatus status = admin.getClusterStatus();
  Collection<ServerName> servers = status.getServers();
  return servers == null || servers.isEmpty()? 0: servers.size();
 }
}

代码示例来源:origin: waterguo/antsdb

void connect() throws IOException {
  if ((this.conn == null) || (this.conn.isClosed())) {
    this.conn = this.hbase.createConnection(); 
    this.updaters.clear();
    _log.info("hbase master {} is connected", conn.getAdmin().getClusterStatus().getMaster());
  }
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Test
public void testObserver() throws IOException {
 int preCount = MyObserver.PRE_COUNT.get();
 int postCount = MyObserver.POST_COUNT.get();
 Assert.assertTrue(Stream.of(ADMIN.getClusterStatus().getMasterCoprocessors())
   .anyMatch(s -> s.equals(MyObserver.class.getSimpleName())));
 Assert.assertEquals(preCount + 1, MyObserver.PRE_COUNT.get());
 Assert.assertEquals(postCount + 1, MyObserver.POST_COUNT.get());
}

代码示例来源:origin: org.apache.hbase/hbase-it

@Override
protected boolean doAction() throws Exception {
 Admin admin = null;
 try {
  admin = util.getAdmin();
  ClusterStatus status = admin.getClusterStatus();
  return status != null;
 } finally {
  if (admin != null) {
   admin.close();
  }
 }
}

代码示例来源:origin: org.apache.hbase/hbase-it

private static void logError(String msg, Context context) throws IOException {
  TableName table = getTableName(context.getConfiguration());
  LOG.error("Failure in chain verification: " + msg);
  try (Connection connection = ConnectionFactory.createConnection(context.getConfiguration());
    Admin admin = connection.getAdmin()) {
   LOG.error("cluster status:\n" + admin.getClusterStatus());
   LOG.error("table regions:\n"
     + Joiner.on("\n").join(admin.getTableRegions(table)));
  }
 }
}

相关文章

Admin类方法