因为Hive当中的HiveServer无法处理客户端的并发请求所以采用了HiveServer2。Beeline是一个基于SQLLine的JDBC客户端。作者采用的也是Beeline。因为Hive的hive cli在0.15之后就不再支持hiveserver了。所以也不推荐使用Hive Cli
HiveCli当中的命令在beeline当中也是支持的

  1. Usage: java org.apache.hive.cli.beeline.BeeLine
  2. -u <database url> the JDBC URL to connect to#数据库
  3. -n <username> the username to connect as#用户名
  4. -p <password> the password to connect as#密码
  5. -d <driver class> the driver class to use#jdbc驱动
  6. -i <init file> script file for initialization#初始化配置
  7. -e <query> query that should be executed#执行SQL命令
  8. -f <exec file> script file that should be executed#在进入交互模式之前进行初始化脚本
  1. 使用用户名和密码连接Hive
  2. beeline -u jdbc:hive2://node01:10000 -n root -p root

Hive配置

  1. 可以通过三种方式对Hive的相关属性进行配置
  2. 1. 配置文件
  3. hive有三个可选的配置文件
  4. hive-site.xml hive的主要配置文件
  5. hivemetastore-site.xml 关于元数据的配置
  6. 2. hiveconf
  7. 在方式二为在启动命令行的时候使用 --hiveconf指定配置,这种方式配置的时间为一次session会话。
  8. hive --hiveconf hive.exec.scratchdir=/tmp/mydir
  9. 3.set
  10. 在进入交互环境下,使用set 命令指定,这种作用还未也是session

关于配置文件的优先级别

  1. hive-site.xml----->hivemestore-site.xml---->hiveserver2-site.xml-->hiveconf-->set