hbase eclipse调试源代码
1、引入源代码
下载hbase的源码,用mvn eclipse:eclipse来使工程可导入eclipse,其中需要安装protoc(需要gcc环境)。
导入hbase源码后,hbase-common中的util包中的Bytes类中的importsun.misc.Unsafe;会报错,在eclipse里不能直接编译,要到项目的属性,Java Compiler,Errors/Warnings(点击co)中Forbidden reference(access rules)中设置为warning。如下图所示:
2、安装hbase
3、在hbase的脚本中添加Debug参数
elif [ "$COMMAND" = "master" ] ; then CLASS='org.apache.hadoop.hbase.master.HMaster' if [ "$1" != "stop" ] ; then HBASE_OPTS="$HBASE_OPTS $HBASE_MASTER_OPTS" fi elif [ "$COMMAND" = "regionserver" ] ; then CLASS='org.apache.hadoop.hbase.regionserver.HRegionServer' if [ "$1" != "stop" ] ; then HBASE_OPTS="$HBASE_OPTS $HBASE_REGIONSERVER_OPTS" fi
改成:
elif [ "$COMMAND" = "master" ] ; then CLASS='org.apache.hadoop.hbase.master.HMaster' if [ "$1" != "stop" ] ; then HBASE_OPTS="$HBASE_OPTS $HBASE_MASTER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=10444" fi elif [ "$COMMAND" = "regionserver" ] ; then CLASS='org.apache.hadoop.hbase.regionserver.HRegionServer' if [ "$1" != "stop" ] ; then HBASE_OPTS="$HBASE_OPTS $HBASE_REGIONSERVER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=10445" fi
启动hbase后就可以看到debug模式开启,然后只要在eclipse中设置remote Debug,这样就可以监听master和regionserver了,debug时regionserver最好就一台,好调试。
相关推荐
晨曦之星 2020-08-14
lwb 2020-07-26
eternityzzy 2020-07-19
大而话之BigData 2020-06-16
ITwangnengjie 2020-06-14
gengwx00 2020-06-11
大而话之BigData 2020-06-10
鲸鱼写程序 2020-06-08
needyit 2020-06-04
strongyoung 2020-06-04
WeiHHH 2020-05-30
ITwangnengjie 2020-05-09
gengwx00 2020-05-08
gengwx00 2020-05-09
大而话之BigData 2020-05-06
Buerzhu 2020-05-01
gengwx00 2020-04-30