HBase 클러스터에서 regionservers의 시작 코드를 얻는 방법은 무엇입니까? (How to get regionservers' startcode in a HBase cluster?)


문제 설명

HBase 클러스터에서 regionservers의 시작 코드를 얻는 방법은 무엇입니까? (How to get regionservers' startcode in a HBase cluster?)

어떻게 하면 될까요? 자세히 :)</p>


참조 솔루션

방법 1:

okay, finally i worked it out.

/*
 * Copyright: Copyright (c) 2012 Kaliumn
 * 
 * @Description: get regionservers' startcode in a hbase cluster
 * 
 */

package test.hbase;

import java.util.Collection;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HServerInfo;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.ipc.HMasterInterface;
import org.gfg.kalium.server.hbaseutil.HConfUtils;

/**
 * class <code> GetStartcode </code> is used to get regionservers' startcode
 * 
 * @author <a href="mailto:ml.huang@kaliumn.com">Meilong Huang</a>
 * @version v1.0.0
 * @date 2012‑6‑26 05:24:10
 * 
 */

public class GetStartcode {

    /**
     * get regionservers' startcode
     * 
     * @param args
     * @throws ZooKeeperConnectionException
     * @throws MasterNotRunningException
     */
    public static void main(String[] args) throws MasterNotRunningException,
            ZooKeeperConnectionException {
        Configuration conf = HConfUtils
                .setHbaseConf("k2.ccntgrid.org,k3.ccntgrid.org,k4.ccntgrid.org");
        HBaseAdmin admin = new HBaseAdmin(conf);
        HMasterInterface master = admin.getMaster();
        Collection<ServerName> rs = master.getClusterStatus().getServerInfo();
        for (ServerName r : rs) {
            System.out.println(r.getHostname());
            System.out.println(r.getServerName());
            System.out.println(r.getStartcode());
            System.out.println("+++++++++++++++++");
        }
    }
}

actually, startcode is the last part of the 'servername'.

these commands will finish moving regions from one regionserver to other:

> ka@k1 bin % pwd
> /opt/kalium/hbase/bin


> ka@k1 bin % echo "move '3504a80cd4047f78834bcf58bf169e62', 'k4.ccntgrid.org,60020,1340682441023'" | ./hbase shell 
> HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.92.1, r1298924, Fri Mar  9 16:58:34 UTC 2012

> move '3504a80cd4047f78834bcf58bf169e62', 'k4.ccntgrid.org,60020,1340682441023'
0 row(s) in 0.5380 seconds

u need the the region code to finish this. the region code is the last part of the region name(behind a dot(.)). region code

방법 2:

You can use the command status in the hbase shell:

hbase(main):001:0> status 'simple'

It will print the list of region servers with their server names, ports and startcodes.

(by imsrchimsrchJcs)

참조 문서

  1. How to get regionservers' startcode in a HBase cluster? (CC BY‑SA 2.5/3.0/4.0)

#regions #hbase






관련 질문

Resharper를 피하여 선언에 따라 영역을 추가하세요. (Avoid Resharper to add a region per Declaration)

모바일용 HTML 5의 특정 영역에 링크가 있는 이미지 (Image with links in certain areas in HTML 5 for mobile)

새로운 영역 생성 - Drupal 7에서 기쁨이 없음 (Creating New Region - No Joy in Drupal 7)

코드 영역을 접도록 Atom을 구성하는 방법 예: Sublime Text와 같은 ## region_name (How to configure Atom to fold code regions e.g. ## region_name like Sublime Text does)

선택 목록 apex 4.2를 기반으로 필드를 동적으로 추가 (Dynamically add fields based on select list apex 4.2)

HBase 클러스터에서 regionservers의 시작 코드를 얻는 방법은 무엇입니까? (How to get regionservers' startcode in a HBase cluster?)

코드에 자동으로 지역 추가 (Automatically add Regions to code)

Objective-C에서 startMonitoringForRegion을 사용하여 여러 지역을 스캔하는 방법 (How to scan multiple regions using startMonitoringForRegion in Objective-C)

HBase 테이블이 비어 있지만 영역이 증가합니다. (HBase table is empty, but regions are increased)







코멘트