在搞定了Hive服务的环境搭建后.我们需要启动Hive Server2 来供我们的程序提交任务,以及获取到相关的返回结果.HiveServer2 提供了一个简单的 WEB UI 页面,在页面中我们可以直观的看到当前链接的会话、历史日志、配置参数以及度量信息.
HiveServer2是一个服务接口,能够允许远程的客户端去执行SQL请求且得到检索结果。HiveServer2的实现,依托于Thrift RPC,是HiveServer的提高版本,它被设计用来提供更好的支持对于open API例如JDBC和ODBC。
这些服务都是Hive的内置服务,只需要一些简单的配置后就可以使用[email protected]
配置文件 Hive Server2一般用默认的就好了
配置项
默认值
说明
hive.server2.transport.mode
binary
HiveServer2 的传输模式,binary或者http
hive.server2.thrift.port
10000
HiveServer2 传输模式设置为 binary 时,Thrift 接口的端口号
hive.server2.thrift.http.port
10001
HiveServer2 传输模式设置为 http 时,Thrift 接口的端口号
hive.server2.thrift.bind.host
localhost
Thrift服务绑定的主机
hive.server2.thrift.min.worker.threads
5
Thrift最小工作线程数
hive.server2.thrift.max.worker.threads
500
Thrift最大工作线程数
hive.server2.authentication
NONE
客户端认证类型,NONE、LDAP、KERBEROS、CUSTOM、PAM、NOSASL
hive.server2.thrift.client.user
cuiyaonan2000
Thrift 客户端用户名
hive.server2.thrift.client.password
cuiyaonan2000
Thrift 客户端密码
修改对应Hadoop的core-site.xml 增加如下内容,让hive 有权限去读写hdfs.
hadoop.proxyuser.root.hosts * hadoop.proxyuser.root.groups *
启动命令:
./hiveserver2 &验证
[root@[email protected] bin]# beeline beeline> !connect jdbc:hive2://127.0.0.01:10000 0: jdbc:hive2://localhost:10000> show databases; 0: jdbc:hive2://localhost:10000> use default; 0: jdbc:hive2://localhost:10000> show tables;
在默认数据库default下.我们看到了之前创建的一个测试表.
Web Ui
默认配置即可
hive.server2.webui.host 0.0.0.0 hive.server2.webui.port 10002
启动:随着Hive Server2的启动 WebUi会跟随启动.
访问地址:http://172.17.12.124:10002/
可以看到刚才我们测试的几个命令都被执行了,以Mapreduce的方式
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)