远程调试hive运行程序:
hive --debug[:port=5005]
hive日志级别及输出:
hive --hiveconf hive.root.logger=DEBUG,console
cli服务常用变量设置
//对于输入数据量比较小的任务,hive使用本地模式在单台机器上执行所有的任务
set hive.exec.mode.local.auto=true
//是否打印表头
set hive.cli.print.header=true/false
//是否显示当前所在数据库
set hive.cli.print.current.db=true/false
约束设置
//设置数据库的模式为严格/非严格模式
/**严格模式
如果多表JOIN,没有加连接条件,则hive阻止该查询的执行;
如果表为分区表,则查询必须带上WHERE分区键的条件;
如果使用ORDER BY查询,必须加上LIMIT关键字.
*/
set hive.mapred.mode=strict/nostrict
//设置表或表的分区不可删除
alter table tab_name [partition(...)] enable/disable no_drop
//设置表或表的分区不可查询
alter table tab_name [partition(...)] enable/disable offline
优化设置
//设置job执行时的输入文件格式化类,
//默认org.apache.hadoop.hive.ql.io.CombineHiveInputFormat
set hive.input.format
//split的最大size
set mapreduce.input.fileinputformat.split.maxsize
//split的最小size
set mapreduce.input.fileinputformat.split.minsize
//每个node的split的最小size
set mapreduce.input.fileinputformat.split.minsize.per.node
//每个机架的split的最小size
set mapreduce.input.fileinputformat.split.minsize.per.rack
//job的map任务数量[split的数量]
set mapreduce.job.maps
//每个reducer处理的字节数
set hive.exec.reducers.bytes.per.reducers
//每个job的最大reduce task数量
set hive.exec.reducers.max
//手动设置reduce task数量
set mapred.reduce.tasks