hive常用命令整理

xiaoxiao2021-02-28  88

1. 开启行转列功能之后: set hive.cli.print.header=true; // 打印列名 set hive.cli.print.row.to.vertical=true; // 开启行转列功能, 前提必须开启打印列名功能 set hive.cli.print.row.to.vertical.num=1; // 设置每行显示的列数 2.使用过程中出错采用: hive -hiveconf hive.root.logger=DEBUG,console   //重启调试。 3. hive的三种启动方式区别:   1,hive  命令行模式,直接输入/hive/bin/hive的执行程序,或者输入 hive –service cli      用于linux平台命令行查询,查询语句基本跟mysql查询语句类似   2,hive  web界面的启动方式,hive –service hwi        用于通过浏览器来访问hive,感觉没多大用途   3,hive  远程服务 (端口号10000) 启动方式,nohup hive –service hiveserver  &       用java等程序实现通过jdbc等驱动的访问hive就用这种起动方式了,这个是程序员最需要的方式了  启动hive service :$HIVE_HOME/bin/hive --service hiveserver 10001 >/dev/null 2>/dev/null &   4. hive插入的2中方式: 基本的插入语法: INSERT OVERWRITE TABLE tablename [PARTITON(partcol1=val1,partclo2=val2)]select_statement FROM from_statement insert overwrite table test_insert select * from test_table; 对多个表进行插入操作: FROM fromstatte INSERT OVERWRITE TABLE tablename1 [PARTITON(partcol1=val1,partclo2=val2)]select_statement1 INSERT OVERWRITE TABLE tablename2 [PARTITON(partcol1=val1,partclo2=val2)]select_statement2 5.添加metastore启动脚本bin/hive-metastore.sh #!/bin/sh nohup ./hive --service metastore >> metastore.log 2>&1 & echo $! > hive-metastore.pid 添加hive server启动脚本bin/hive-server.sh nohup ./hive --service hiveserver >> hiveserver.log 2>&1 & echo $! > hive-server.pid 启动metastore和hive server ./hive-metastore.sh ./hive-server.sh
转载请注明原文地址: https://www.6miu.com/read-59368.html

最新回复(0)