The error occured when hbase client batch data. At first it's ok. Some time later it's wrong! The detailed error is:
当hbase客户端批处理数据时出现错误。起初,没关系。过了一段时间,它就错了!详细的错误是:
: 1 time, org.apache.hadoop.hbase.exceptions.FailedSanityCheckException: Requested row out of range for doMiniBatchMutation on HRegion idcard,bfef6945ac273d83\x00\x00\x00\x00\x00\x17\xCC$,1461584032622.dadb8843fe441dac4a3d4d7669597ef5., startKey='bfef6945ac273d83\x00\x00\x00\x00\x00\x17\xCC$', getEndKey()='', row='9a6ec957205e1d74\x00\x00\x00\x00\x01\x90\x1F\xF5' at org.apache.hadoop.hbase.regionserver.RSRpcServices.doBatchOp(RSRpcServices.java:712) at org.apache.hadoop.hbase.regionserver.RSRpcServices.doNonAtomicRegionMutation(RSRpcServices.java:662) at org.apache.hadoop.hbase.regionserver.RSRpcServices.multi(RSRpcServices.java:2046) at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:32393) at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2117) at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:104) at org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:133) at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:108) at java.lang.Thread.run(Thread.java:745)
:1,org.apache.hadoop.hbase.exceptions。在HRegion idcard,bfef6945ac273d83\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x00\x \x \x \x \x \x \x00\x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \ \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \x \ \ \x \ \x \ \x \ \x \ \ \x \x \ \ \x \ \ \x \startKey = ' bfef6945ac273d83 \ x00 \ x00 \ x00 \ x00 \ x00 \ x17 \ xCC美元”,getEndKey()= ",在hadoop. apache.org .hadoop.hbase.region . rbase . rcp . server. rpcservices . dobatchop (RSRpcServices.java js . \x01\x90\x1F\ x1F\ x1F\xF5' at hadoop. apache.org .apache. hbase运行(call) (RpcServer.java:2117)。
The environment is :
环境问题是:
- hbase hbase-1.1.3
- hbase hbase-1.1.3
- hadoop2.6
- hadoop2.6
- hbase-client 1.2.0
- hbase-client 1.2.0
The hbase client's code is :
hbase客户端代码为:
public static void batchPutData(Connection connection, long startNum, long count) throws IOException, ParseException{
//table
Table table = connection.getTable(TableName.valueOf(TABLE_NAME));
//index table
Table index_table = connection.getTable(TableName.valueOf(INDEX_TABLE_NAME));
//random name
RandomChineseName randomChineseName = new RandomChineseName();
//random car
RandomCar randomCar = new RandomCar();
List<Put> puts = new ArrayList<Put>();
List<Put> indexPlateputs = new ArrayList<Put>();
for(long i = 0; i < count; i++){
long index = startNum+i;
Date birthdate = RandomUtils.randomDate();
String birthdateStr = DateUtil.dateToStr(birthdate, "yyyy-MM-dd");
boolean isBoy = i%2==0?true:false;
String name = isBoy?randomChineseName.randomBoyName():randomChineseName.randomGirlName();
String nation = RandomUtils.randomNation();
String plate = randomCar.randomPlate();
byte[] idbuff = Bytes.toBytes(index);
String hashPrefix = MD5Hash.getMD5AsHex(idbuff).substring(0, 16);
//create a put for table
Put put = new Put(Bytes.add(Bytes.toBytes(hashPrefix), idbuff));
put.addColumn(Bytes.toBytes("idcard"), Bytes.toBytes("name"), Bytes.toBytes(name));
put.addColumn(Bytes.toBytes("idcard"), Bytes.toBytes("sex"), Bytes.toBytes(isBoy?1:0));
put.addColumn(Bytes.toBytes("idcard"), Bytes.toBytes("birthdate"), Bytes.toBytes(birthdateStr));
put.addColumn(Bytes.toBytes("idcard"), Bytes.toBytes("nation"), Bytes.toBytes(nation));
put.addColumn(Bytes.toBytes("idcard"), Bytes.toBytes("plate"), Bytes.toBytes(plate));
puts.add(put);
//create a put for index table
String namehashPrefix = MD5Hash.getMD5AsHex(Bytes.toBytes(name)).substring(0, 16);
byte[] bprf = Bytes.add(Bytes.toBytes(namehashPrefix), Bytes.toBytes(name));
bprf = Bytes.add(bprf, Bytes.toBytes(SPLIT), Bytes.toBytes(birthdateStr));
Put namePut = new Put(Bytes.add(bprf, Bytes.toBytes(SPLIT), Bytes.toBytes(index)));
namePut.addColumn(Bytes.toBytes("index"), Bytes.toBytes("idcard"), Bytes.toBytes(0));
indexPlateputs.add(namePut);
//insert for every ten thousands
if(i%10000 == 0){
table.put(puts);
index_table.put(indexPlateputs);
puts.clear();
indexPlateputs.clear();
}
}
}
1 个解决方案
#1
2
It seems like conflicts with HBase version . Change HBase version to 1.1.4 or 1.0.0 or other stable version to have a try.
它似乎与HBase版本冲突。将HBase版本更改为1.1.4或1.0.0或其他稳定版本进行尝试。
#1
2
It seems like conflicts with HBase version . Change HBase version to 1.1.4 or 1.0.0 or other stable version to have a try.
它似乎与HBase版本冲突。将HBase版本更改为1.1.4或1.0.0或其他稳定版本进行尝试。