因为Hive当中的HiveServer无法处理客户端的并发请求所以采用了HiveServer2。Beeline是一个基于SQLLine的JDBC客户端。作者采用的也是Beeline。因为Hive的hive cli在0.15之后就不再支持hiveserver了。所以也不推荐使用Hive Cli
HiveCli当中的命令在beeline当中也是支持的
Usage: java org.apache.hive.cli.beeline.BeeLine-u <database url> the JDBC URL to connect to#数据库-n <username> the username to connect as#用户名-p <password> the password to connect as#密码-d <driver class> the driver class to use#jdbc驱动-i <init file> script file for initialization#初始化配置-e <query> query that should be executed#执行SQL命令-f <exec file> script file that should be executed#在进入交互模式之前进行初始化脚本
使用用户名和密码连接Hivebeeline -u jdbc:hive2://node01:10000 -n root -p root
Hive配置
可以通过三种方式对Hive的相关属性进行配置1. 配置文件hive有三个可选的配置文件hive-site.xml hive的主要配置文件hivemetastore-site.xml 关于元数据的配置2. hiveconf在方式二为在启动命令行的时候使用 --hiveconf指定配置,这种方式配置的时间为一次session会话。hive --hiveconf hive.exec.scratchdir=/tmp/mydir3.set在进入交互环境下,使用set 命令指定,这种作用还未也是session
关于配置文件的优先级别
hive-site.xml----->hivemestore-site.xml---->hiveserver2-site.xml-->hiveconf-->set
