做app+的模板下载网站,佛山网站建设排名,茂名营销型网站建设,新媒体营销课程心得体会目录#xff1a;1、前言2、beeline相关的Server.Thrift配置3、启动beeline并访问Hive4、期间遇到的问题和解决方法 目录#xff1a;
1、前言
作为数据仓库的工具#xff0c;hive提供了两种ETL运行方式#xff0c;分别是通过Hive 命令行和beeline客户端#xff1b;
命令…目录1、前言2、beeline相关的Server.Thrift配置3、启动beeline并访问Hive4、期间遇到的问题和解决方法 目录
1、前言
作为数据仓库的工具hive提供了两种ETL运行方式分别是通过Hive 命令行和beeline客户端
命令行方式即通过hive进入命令模式后通过执行不同的HQL命令得到对应的结果相当于胖客户端模式即客户机中需要安装JRE环境和Hive程序。
beeline客户端方式相当于瘦客户端模式采用JDBC方式借助于Hive Thrift服务访问Hive数据仓库。
HiveThrift(HiveServer)是Hive中的组件之一设计目的是为了实现跨语言轻量级访问Hive数据仓库有Hiveserver和 Hiveserver2两个版本两者不兼容使用中要注意区分。体现在启动HiveServer的参数和jdbc:hiveX的参数上。
2、beeline相关的Server.Thrift配置
主要是hive/conf/hive-site.xml中hive.server2.thrift相关的一些配置项但要注意一致性。 propertynamehive.server2.thrift.bind.host/namevalueha1/valuedescriptionBind host on which to run the HiveServer2 Thrift service./description/propertypropertynamehive.server2.thrift.port/namevalue10000/valuedescriptionPort number of HiveServer2 Thrift interface when hive.server2.transport.mode is binary./description/property进入beeline连接数据库后因为要访问的文件在HDFS上对应的路径有访问权限限制所以这里要设成hadoop中的用户名实例中用户名即为’root’(看你用什么用户来启动hadoop的)。如果使用其它用户名可能会报权限拒绝的错误。或通过修改hadoop中的配置项hadoop.proxyuser.为“*” 来放宽用户名和权限如示例。 hadoop/etc/hadoop/core-site.xml propertynamehadoop.proxyuser.hadoop.hosts/name!--valuemaster/value--value*/value/propertypropertynamehadoop.proxyuser.hadoop.groups/name!--valuehadoop/value--value*/value/property
3、启动beeline并访问Hive
slave01上启动hiveserver2,
nohup hive --service hiveserver2
nohup hiveserver2 1/root/apps/hive-2.1.1/logs/hiveserver.log 2/root/apps/hive-2.1.1/logs/hiveserver.err 将hivesever的日志导入对应的目录ps -ef | grep Hive
能看到Hiveserver2已启动
master机器上执行beeline并访问hive
rootmaster:~/bigdata/hive$ beeline
Beeline version 1.2.1.spark2 by Apache Hive
beeline beeline !connect jdbc:hive2://ha1:10000 // 2中配置项的host:port 因为启动的是hiveserver2所以参数中是hive2
Connecting to jdbc:hive2://ndh-ha1:10000
Enter username for jdbc:hive2://ndh-ha1:10000: root
Enter password for jdbc:hive2://ndh-ha1:10000: **** //2中配置项的user/password
17/09/08 14:39:27 INFO jdbc.Utils: Supplied authorities: ndh-slave01:10000
17/09/08 14:39:27 INFO jdbc.Utils: Resolved authority: ndh-slave01:10000
17/09/08 14:39:27 INFO jdbc.HiveConnection: Will try to open client transport with JDBC Uri: jdbc:hive2://ha1:10000
Connected to: Apache Hive (version 2.1.1)
Driver: Hive JDBC (version 1.2.1.spark2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://ha1:10000 0: jdbc:hive2://slave01:10000 show databases;
------------------
| database_name |
------------------
| default |
| feigu3 |
| wordcount |
------------------
3 rows selected (0.379 seconds)0: jdbc:hive2://slave01:10000 select * from wordcount order by count desc limit 50;.........................................................................................看到结果后进入hadoop yarn
http://master:8088/cluster/apps/FINISHED 可看到刚执行的任务。0: jdbc:hive2://slave01:10000 !q 退出beeline
4、期间遇到的问题和解决方法
4.1 hadoop is not allowed to impersonate hive // hadoop是hadoop中配置的用户名解决方法见中说明 具体的原因见https://blog.csdn.net/qq_16633405/article/details/82190440
转自https://blog.csdn.net/wqhlmark64/article/details/77894026