@Test public void getHexSplitsTest() { byte[][] splits = HBaseUtils.getHexSplits("0", "f", 16); _log.debug("Splits size: {}", splits.length); for (byte[] split : splits) { _log.debug("Hex Splits: {}", JSON.toJSONString(Arrays.asList(split))); } }
public static byte[][] getHexSplits(String startKey, String endKey, int numRegions) { byte[][] splits = new byte[numRegions - 1][]; BigInteger lowestKey = new BigInteger(startKey, 16); BigInteger highestKey = new BigInteger(endKey, 16); BigInteger regionIncrement = highestKey.subtract(lowestKey).divide(BigInteger.valueOf(numRegions)); lowestKey = lowestKey.add(regionIncrement); for (int i = 0; i < numRegions - 1; i++) splits[i] = String.format("%016x", lowestKey.add( regionIncrement.multiply(BigInteger.valueOf(i)))).getBytes(); return splits; }
HBaseUtils { public static byte[][] getHexSplits(String startKey, String endKey, int numRegions) { byte[][] splits = new byte[numRegions - 1][]; BigInteger lowestKey = new BigInteger(startKey, 16); BigInteger highestKey = new BigInteger(endKey, 16); BigInteger regionIncrement = highestKey.subtract(lowestKey).divide(BigInteger.valueOf(numRegions)); lowestKey = lowestKey.add(regionIncrement); for (int i = 0; i < numRegions - 1; i++) splits[i] = String.format("%016x", lowestKey.add( regionIncrement.multiply(BigInteger.valueOf(i)))).getBytes(); return splits; } }
HBaseUtils { public static byte[][] getHexSplits(String startKey, String endKey, int numRegions) { byte[][] splits = new byte[numRegions - 1][]; BigInteger lowestKey = new BigInteger(startKey, 16); BigInteger highestKey = new BigInteger(endKey, 16); BigInteger regionIncrement = highestKey.subtract(lowestKey).divide(BigInteger.valueOf(numRegions)); lowestKey = lowestKey.add(regionIncrement); for (int i = 0; i < numRegions - 1; i++) splits[i] = String.format("%016x", lowestKey.add( regionIncrement.multiply(BigInteger.valueOf(i)))).getBytes(); return splits; } private  HBaseUtils(); }
HBaseUtils { public static byte[][] getHexSplits(String startKey, String endKey, int numRegions) { byte[][] splits = new byte[numRegions - 1][]; BigInteger lowestKey = new BigInteger(startKey, 16); BigInteger highestKey = new BigInteger(endKey, 16); BigInteger regionIncrement = highestKey.subtract(lowestKey).divide(BigInteger.valueOf(numRegions)); lowestKey = lowestKey.add(regionIncrement); for (int i = 0; i < numRegions - 1; i++) splits[i] = String.format("%016x", lowestKey.add( regionIncrement.multiply(BigInteger.valueOf(i)))).getBytes(); return splits; } private  HBaseUtils(); static HBaseUtils getInstance(); static void setUpEnv(); static boolean createTable(Admin admin, HTableDescriptor table, byte[][] splits); static String getNameSpace(RegionLoad region); static String getSingleTableName(RegionLoad region); static String getTableName(RegionLoad region); static String extractTableName(String regionName); static LinkedList<String> splitJmxRegion(String aim); static String removeEndKey(String regionName); static String extractTimestamp4Region(String regionName); static String extractHostName(String regionServerName); static String removeTimestamp(String regionServerName); static String extractTimestamp4RS(String regionServerName); static String generateSplitKeys(int startKey, int endKey, int stepSize, int fill); static byte[][] getHexSplits(String startKey, String endKey, int numRegions); Date getClusterStartTime(); String getClusterStartTimeStr(); }
HBaseUtils { public static byte[][] getHexSplits(String startKey, String endKey, int numRegions) { byte[][] splits = new byte[numRegions - 1][]; BigInteger lowestKey = new BigInteger(startKey, 16); BigInteger highestKey = new BigInteger(endKey, 16); BigInteger regionIncrement = highestKey.subtract(lowestKey).divide(BigInteger.valueOf(numRegions)); lowestKey = lowestKey.add(regionIncrement); for (int i = 0; i < numRegions - 1; i++) splits[i] = String.format("%016x", lowestKey.add( regionIncrement.multiply(BigInteger.valueOf(i)))).getBytes(); return splits; } private  HBaseUtils(); static HBaseUtils getInstance(); static void setUpEnv(); static boolean createTable(Admin admin, HTableDescriptor table, byte[][] splits); static String getNameSpace(RegionLoad region); static String getSingleTableName(RegionLoad region); static String getTableName(RegionLoad region); static String extractTableName(String regionName); static LinkedList<String> splitJmxRegion(String aim); static String removeEndKey(String regionName); static String extractTimestamp4Region(String regionName); static String extractHostName(String regionServerName); static String removeTimestamp(String regionServerName); static String extractTimestamp4RS(String regionServerName); static String generateSplitKeys(int startKey, int endKey, int stepSize, int fill); static byte[][] getHexSplits(String startKey, String endKey, int numRegions); Date getClusterStartTime(); String getClusterStartTimeStr();  }