当前位置: 首页>>代码示例>>Java>>正文


Java HRegionInterface.getOnlineRegions方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.ipc.HRegionInterface.getOnlineRegions方法的典型用法代码示例。如果您正苦于以下问题:Java HRegionInterface.getOnlineRegions方法的具体用法?Java HRegionInterface.getOnlineRegions怎么用?Java HRegionInterface.getOnlineRegions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.ipc.HRegionInterface的用法示例。


在下文中一共展示了HRegionInterface.getOnlineRegions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDeployedHRIs

import org.apache.hadoop.hbase.ipc.HRegionInterface; //导入方法依赖的package包/类
/**
 * Get region info from local cluster.
 */
Map<ServerName, List<String>> getDeployedHRIs(HBaseAdmin admin)
  throws IOException {
  ClusterStatus status = admin.getMaster().getClusterStatus();
  Collection<ServerName> regionServers = status.getServers();
  Map<ServerName, List<String>> mm =
      new HashMap<ServerName, List<String>>();
  HConnection connection = admin.getConnection();
  for (ServerName hsi : regionServers) {
    HRegionInterface server =
      connection.getHRegionConnection(hsi.getHostname(), hsi.getPort());

    // list all online regions from this region server
    List<HRegionInfo> regions = server.getOnlineRegions();
    List<String> regionNames = new ArrayList<String>();
    for (HRegionInfo hri : regions) {
      regionNames.add(hri.getRegionNameAsString());
    }
    mm.put(hsi, regionNames);
  }
  return mm;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:25,代码来源:TestHBaseFsck.java

示例2: call

import org.apache.hadoop.hbase.ipc.HRegionInterface; //导入方法依赖的package包/类
@Override
public synchronized Void call() throws IOException {
  errors.progress();
  try {
    HRegionInterface server =
        connection.getHRegionConnection(rsinfo.getHostname(), rsinfo.getPort());

    // list all online regions from this region server
    List<HRegionInfo> regions = server.getOnlineRegions();
    regions = filterRegions(regions);
    if (details) {
      errors.detail("RegionServer: " + rsinfo.getServerName() +
                       " number of regions: " + regions.size());
      for (HRegionInfo rinfo: regions) {
        errors.detail("  " + rinfo.getRegionNameAsString() +
                         " id: " + rinfo.getRegionId() +
                         " encoded_name: " + rinfo.getEncodedName() +
                         " start: " + Bytes.toStringBinary(rinfo.getStartKey()) +
                         " end: " + Bytes.toStringBinary(rinfo.getEndKey()));
      }
    }

    // check to see if the existence of this region matches the region in META
    for (HRegionInfo r:regions) {
      HbckInfo hbi = hbck.getOrCreateInfo(r.getEncodedName());
      hbi.addServer(r, rsinfo);
    }
  } catch (IOException e) {          // unable to connect to the region server. 
    errors.reportError(ERROR_CODE.RS_CONNECT_FAILURE, "RegionServer: " + rsinfo.getServerName() +
      " Unable to fetch region information. " + e);
    throw e;
  }
  return null;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:35,代码来源:HBaseFsck.java

示例3: run

import org.apache.hadoop.hbase.ipc.HRegionInterface; //导入方法依赖的package包/类
@Override
public synchronized void run() {
  errors.progress();
  try {
    HRegionInterface server = connection.getHRegionConnection(new HServerAddress(rsinfo.getHostname(), rsinfo.getPort()));

    // list all online regions from this region server
    List<HRegionInfo> regions = server.getOnlineRegions();
    if (hbck.checkMetaOnly) {
      regions = filterOnlyMetaRegions(regions);
    }
    if (details) {
      errors.detail("RegionServer: " + rsinfo.getServerName() +
                       " number of regions: " + regions.size());
      for (HRegionInfo rinfo: regions) {
        errors.detail("  " + rinfo.getRegionNameAsString() +
                         " id: " + rinfo.getRegionId() +
                         " encoded_name: " + rinfo.getEncodedName() +
                         " start: " + Bytes.toStringBinary(rinfo.getStartKey()) +
                         " end: " + Bytes.toStringBinary(rinfo.getEndKey()));
      }
    }

    // check to see if the existence of this region matches the region in META
    for (HRegionInfo r:regions) {
      HbckInfo hbi = hbck.getOrCreateInfo(r.getEncodedName());
      hbi.addServer(rsinfo);
    }
  } catch (IOException e) {          // unable to connect to the region server. 
    errors.reportError(ERROR_CODE.RS_CONNECT_FAILURE, "RegionServer: " + rsinfo.getServerName() +
      " Unable to fetch region information. " + e);
  } finally {
    done = true;
    notifyAll(); // wakeup anybody waiting for this item to be done
  }
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:37,代码来源:HBaseFsck.java


注:本文中的org.apache.hadoop.hbase.ipc.HRegionInterface.getOnlineRegions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。