[java]代码库
public void split(String tableName,int number,int timeout) throws Exception {
 
    Configuration HBASE_CONFIG = new Configuration();
 
    HBASE_CONFIG.set(“hbase.zookeeper.quorum”, GlobalConf.ZOOKEEPER_QUORUM);
 
    HBASE_CONFIG.set(“hbase.zookeeper.property.clientPort”, GlobalConf.ZOOKEEPER_PORT);
 
    HBaseConfiguration cfg = new HBaseConfiguration(HBASE_CONFIG);
 
    HBaseAdmin hAdmin = new HBaseAdmin(cfg);
 
    HTable hTable = new HTable(cfg,tableName);
 
    int oldsize = 0;
 
    t =  System.currentTimeMillis();
 
    while(true){
 
       int size = hTable.getRegionsInfo().size();
 
       logger.info(“the region number=”+size);
 
       if(size>=number ) break;
 
       if(size!=oldsize){
 
           hAdmin.split(hTable.getTableName());
 
           oldsize = size;
 
       }
 
       else if(System.currentTimeMillis()-t>timeout){
 
           break;
 
       }
 
       Thread.sleep(1000*10);
 
    }
 
}