Sqoop远程调试,源码学习

1.搭建sqoop的eclipse调试环境

下载源码

git clone https://github.com/apache/sqoop

编译for eclipse

ant eclipse

import to eclipse

设置debug点

Sqoop远程调试,源码学习_第1张图片
设置debug点

2.修改hadoop执行脚本

修改${HADOOP_HOME}/bin/hadoop中最后面为

    exec "$JAVA" -Xdebug -Xrunjdwp:transport=dt_socket,address=8002,server=y,suspend=y $HADOOP_OPTS -classpath "$CLASSPATH" $CLASS "$@"
    #exec "$JAVA" $JAVA_HEAP_MAX $HADOOP_OPTS $CLASS "$@"

3.eclipse新建一个远程调试客户端

Sqoop远程调试,源码学习_第2张图片
Debug Configurations

4.执行调试

[xdata@bdas05 sqoop-1.4.6]$ bin/sqoop import --connect jdbc:oracle:thin:@192.168.16.223:1521/orcl --username sitts --password password --table SITTS.ESB_SERVICE_PARAM --split-by PARAM_ID --hbase-table ora_test --hbase-row-key PARAM_ID --column-family data

Warning: /xbdp/sqoop-1.4.6/bin/../../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /xbdp/sqoop-1.4.6/bin/../../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /xbdp/sqoop-1.4.6/bin/../../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
Listening for transport dt_socket at address: 8002

如果卡住了,relaunch一下

Sqoop远程调试,源码学习_第3张图片
Debug-Relaunch

拿到了参数,并可以debug了

Sqoop远程调试,源码学习_第4张图片
shell输入的参数

你可能感兴趣的:(Sqoop远程调试,源码学习)