Dear all,
I have a problem in hbase with transactional use
Here's the error message I've got:
10/06/23 04:59:48 INFO zookeeper.ClientCnxn: Server connection successful
org.apache.hadoop.hbase.client.RetriesExhaustedException: Trying to
contact region server 192.168.3.2:60020 for region
popo,,1277049738313, row 'row11', but failed after 10
attempts.Exceptions:
java.lang.ClassCastException: $Proxy0 cannot be cast to
org.apache.hadoop.hbase.ipc.TransactionalRegionInterface
java.lang.ClassCastException: $Proxy0 cannot be cast to
org.apache.hadoop.hbase.ipc.TransactionalRegionInterface
It said that it couldn't find region server , but my regions server works
fine actually.
My hbase shell also works fine with put, scan, list etc.
The following is my modification for transaction use:
I've appended the following lines to the hbase-site.xml
<property> <name>hbase.regionserver.class</name>
<value>org.apache.hadoop.hbase.ipc.TransactionalRegionInterface</value>
</property> <property> <name>hbase.regionserver.impl</name>
<value>org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegionServer</value>
</property> <property> <name>hbase.regionserver.hlog.keyclass</name>
<value>org.apache.hadoop.hbase.regionserver.transactional.THLogKey</value>
</property>
Also, I've copied the hbase-site.xml to the $hadoop/conf/ and modified
hbase-env.sh
export
HBASE_CLASSPATH=$HBASE_CLASSPATH:$HBASE_HOME/contrib/transactional/hbase-0.20.4-transactional.jar
then restart hadoop-all & hbase
Here's the main part of my example java code
HBaseConfiguration config = new HBaseConfiguration();
try
{
TransactionManager tm = new TransactionManager(config);
TransactionState ts = tm.beginTransaction();
TransactionalTable ttt = new TransactionalTable(config,"popo");
//'popo' is my table with column named 'Family111'
ttt.setAutoFlush(false);
Put testput = new Put(Bytes.toBytes("row11"));
testput =
testput.add(Bytes.toBytes("Family111"),Bytes.toBytes("qualifyy"),Bytes.toBytes("valuee"));
ttt.put(ts,testput); */****/**program will stop here for a
while , then print the above error message*
try
{
tm.tryCommit(ts);
}
catch(CommitUnsuccessfulException e)
{
System.out.println("CommitUnsuccessfulException e\n");
}
}catch(Exception e)
{
System.out.println(e);
e.printStackTrace();
}
And how I compile and execute my program :
javac -classpath
/localdisk/simon/hbase-0.20.4/hbase-0.20.4-test.jar:/localdisk/simon/hadoop-0.20.2/hadoop-0.20.2-core.jar:/localdisk/simon/hbase-0.20.4/contrib/transactional/hbase-0.20.4-transactional.jar
ThbaseTest.java
(there's no warnings and errors)
java -classpath
/localdisk/simon/hbase-0.20.4/hbase-0.20.4.jar:$PWD:/localdisk/simon/hadoop-0.20.2/hadoop-0.20.2-core.jar:/localdisk/simon/hbase-0.20.4/lib/commons-logging-1.0.4.jar:/localdisk/simon/hbase-0.20.4/lib/zookeeper-3.2.2.jar:/localdisk/simon/hbase-0.20.4/lib/log4j-1.2.15.jar:/localdisk/simon/hbase-0.20.4/contrib/transactional/hbase-0.20.4-transactional.jar
ThbaseTest
If I use my program to put a row to a table without transactional functions
, it works fine.
Could anyone helps me, thanks a million!!!
Best Regards,
Simon