目录
一、CLI连接
二、HiveServer2/beeline
1、修改 hadoop 集群的 hdfs-site.xml 配置文件
2、修改 hadoop 集群的 core-site.xml 配置文件
三、Web UI
正文:
一、CLI连接
进入到 bin 目录下,直接输入命令:
[potter@potter2 ~]$ hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/potter/apps/apache-hive-2.3.3-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/potter/apps/hadoop-2.7.5/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Logging initialized using configuration in jar:file:/home/potter/apps/apache-hive-2.3.3-bin/lib/hive-common-2.3.3.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
hive>
查看:
hive> show databases;
OK
default
myhive
Time taken: 12.432 seconds, Fetched: 2 row(s)
hive>
启动成功的话如上图所示,接下来便可以做 hive 相关操作
补充:
1、上面的 hive 命令相当于在启动的时候执行:hive --service cli
2、使用 hive --help,可以查看 hive 命令可以启动那些服务
3、通过 hive --service serviceName --help 可以查看某个具体命令的使用方式
二、HiveServer2/beeline
在现在使用的最新的 hive-2.3.3 版本中:都需要对 hadoop 集群做如下改变,否则无法使用
第一:修改 hadoop 集群的 hdfs-site.xml 配置文件:加入一条配置信息,表示启用 webhdfs
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
第二:修改 hadoop 集群的 core-site.xml 配置文件