转载请注明出处:https://blog.csdn.net/l1028386804/article/details/88524593
修改Log4J属性
可以修改$HIVE_HOME/conf目录下的Log4J配置文件来配置日志。
也可以临时改变日志配置而无需拷贝和修改Log4J文件。在Hive Shell启动时可以通过hiveconf参数制定log4j.properties文件中的任意属性。
hive -hiveconf hive.root.logger=DEBUG,console
连接Java调试器到Hive
通过附加一个Java调试器,对Hive代码进行单步调试,来找到问题所在。
远程调试是Java提供的一个功能,其可以通过命令行对JVM指定参数后进行启动。
[root@binghe ~]# hive --help --debug
Allows to debug Hive by connecting to it via JDI API
Usage: hive --debug[:comma-separated parameters list]
Parameters:
recursive=<y|n> Should child JVMs also be started in debug mode. Default: y
port=<port_number> Port on which main JVM listens for debug connection. Default: 8000
mainSuspend=<y|n> Should main JVM wait with execution for the debugger to connect. Default: y
childSuspend=<y|n> Should child JVMs wait with execution for the debugger to connect. Default: n
swapSuspend Swaps suspend options between main and child JVMs
从源码编译Hive
svn co http://svn.apache.org/repos/asf/hive/trunk hive-trunk
cd hive-trunk
ant package
ls build/dist/
bin examples LICENSE README.txt scripts
conf lib NOTICE RELEASE_NOTES.txt
配置Hive和Eclipse
通过如下操作可以让Hive代码在Eclipse中使用
ant clean package eclipse-files
cd metastore
ant model-jar
cd ../ql
ant gen-test
编译之后就可以将Hive工程导入到eclipse