步骤一:启动为前台:bin/hiveserver2

步骤二:启动为后台:nohup bin/hiveserver2 1>/var/log/hiveserver.log 2>/var/log/hiveserver.err &

1:启动成功后,可以在别的节点上用beeline去连接

  方式一:

    hive/bin/beeline  回车,进入beeline的命令界面

    输入命令连接hiveserver2

    beeline> !connect jdbc:hive2//master:10000

    (master机器是hiveserver2所启动的那台主机名,端口默认是10000)

  方式二:

    或者启动就连接:

    bin/beeline -u jdbc:hive2://master:10000 -n hadoop

接下来就可以做正常sql查询了

1:将Hive作为一个服务器,其他机器可以作为客户端进行访问:

2:然后寻找符合thrift的这种协议的客户端来连这个服务,然而hive自带这种客户端(我这里复制本台机器,弄了两个窗口):

然后呢,就是开启了命令行客户端了,然后了连接你的hive即可。我这里遇到一个错误,顺手贴一下吧。

造成这个错误的原因是!connect jdbc:hive2//master:10000写成!connect jdbc:hive2//localhost:10000即可。

 1 [root@master apache-hive-1.2.1-bin]# cd bin/
 2 [root@master bin]# ls
 3 beeline  ext  hive  hive-config.sh  hiveserver2  metatool  schematool
 4 [root@master bin]# ./beeline
 5 Beeline version 1.2.1 by Apache Hive
 6 beeline> !connect jdbc:hive2//master:10000
 7 scan complete in 1ms
 8 17/12/12 04:42:53 [main]: ERROR beeline.ClassNameCompleter: Fail to parse the class name from the Jar file due to the exception:java.io.FileNotFoundException: minlog-1.2.jar (No such file or directory)
 9 17/12/12 04:42:53 [main]: ERROR beeline.ClassNameCompleter: Fail to parse the class name from the Jar file due to the exception:java.io.FileNotFoundException: objenesis-1.2.jar (No such file or directory)
10 17/12/12 04:42:53 [main]: ERROR beeline.ClassNameCompleter: Fail to parse the class name from the Jar file due to the exception:java.io.FileNotFoundException: reflectasm-1.07-shaded.jar (No such file or directory)
11 scan complete in 5708ms
12 No known driver to handle "jdbc:hive2//master:10000"

然后呢我写成beeline> !connect jdbc:hive2://localhost:10000回车。会让你输入账号和密码,这里直接输入你的登陆linux的账号和密码即可,我习惯使用root和其密码操作,虽然不好,但是这里直接输入root账号,123456密码即可登陆。

 1 beeline> !connect jdbc:hive2://localhost:10000
 2 Connecting to jdbc:hive2://localhost:10000
 3 Enter username for jdbc:hive2://localhost:10000: hadoop
 4 Enter password for jdbc:hive2://localhost:10000:
 5 Error: Failed to open new session: java.lang.RuntimeException: java.lang.RuntimeException: org.apache.hadoop.security.AccessControlException: Permission denied: user=hadoop, access=EXECUTE, inode="/tmp":root:supergroup:drwx------
 6     at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkFsPermission(FSPermissionChecker.java:271)
 7     at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:257)
 8     at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkTraverse(FSPermissionChecker.java:208)
 9     at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:171)
10     at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkPermission(FSNamesystem.java:6545)
11     at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(FSNamesystem.java:4182)
12     at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getFileInfo(NameNodeRpcServer.java:881)
13     at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getFileInfo(ClientNamenodeProtocolServerSideTranslatorPB.java:821)
14     at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
15     at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:619)
16     at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:975)
17     at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2040)
18     at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2036)
19     at java.security.AccessController.doPrivileged(Native Method)
20     at javax.security.auth.Subject.doAs(Subject.java:415)
21     at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1656)
22     at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2034) (state=,code=0)
23 0: jdbc:hive2://localhost:10000 (closed)> !connect jdbc:hive2://localhost:10000
24 Connecting to jdbc:hive2://localhost:10000
25 Enter username for jdbc:hive2://localhost:10000: root
26 Enter password for jdbc:hive2://localhost:10000: ******
27 Connected to: Apache Hive (version 1.2.1)
28 Driver: Hive JDBC (version 1.2.1)
29 Transaction isolation: TRANSACTION_REPEATABLE_READ
30 1: jdbc:hive2://localhost:10000> 

登陆以后即可以进行操作,演示如下所示:

停更......

2017-12-12 20:50:44

Hive thrift服务(将Hive作为一个服务器,其他机器可以作为客户端进行访问)相关推荐

  1. Hive thrift服务--beeline使用

    hive提供了thrift服务,只要客户端符合thrift标准就可以与它对接. 这样可以以在一台服务器上启动一个hive,其他用户通过thrift访问hive. hive自带了一个thrift的客户端 ...

  2. 【游戏开发实战】用Go语言写一个服务器,实现与Unity客户端通信(Golang | Unity | Socket | 通信 | 教程 | 附工程源码)

    文章目录 一.前言 二.Go开发环境搭建(Windows系统) 1.安装Go命令行工具 2.创建GoWorkspace目录 3.配置GOPATH环境变量 4.配置GOPROXY代理 5.安装VSCod ...

  3. 学习笔记Hive(一)—— Hive简介

    一.Hive设计思想 (了解) Facebook用户社交数据存储与处理 Facebook是美国的一个社交网站 ,于2004年2月4日上线.主要创始人为美国人马克·扎克伯格.Facebook是世界排名领 ...

  4. SMTP 服务器要求安全连接或客户端未通过身份验证的各个解决方案(C#)

    最近在做邮件发送接口 把遇到的问题和解决方法告诉大家  希望对了解邮件的人有所帮助      原程序部分代码如下   //设置邮件信息 发件人地址.收件人地址.标题.主题   MailMessage ...

  5. hive后台启动_将Hive Thrift server 添加到服务后台运行

    1.  将hive 的metastore用mysql连接储存 2  在/etc/init.d/文件夹中编辑文件hive-thrift #!/bin/bash # init script forHive ...

  6. hive后台启动_将Hive Thrift server 添加到服务后台运行 | 学步园

    1.  将hive 的metastore用mysql连接储存 2  在/etc/init.d/文件夹中编辑文件hive-thrift #!/bin/bash # init script forHive ...

  7. Hive 元数据服务 MetaStore

    1. 概念 MetaSore 是 Hive 元数据存储的地方.Hive 数据库.表.函数等的定义都存储在 MetaStore 中.根据系统配置方式,统计信息和授权记录也可以存储在这.Hive 或者其他 ...

  8. Hive Thrift Server

    Thrift 允许客户端使用包括Java.C++.Ruby和其他很多种语言,通过编程的方式远程访问Hive 一.启动Thrift Server 通过如下命令启动 Thrift Server [hado ...

  9. hive 启动服务命令及连接

    启动元数据服务 ./hive --service metastore & 启动server ./hive --service hiveserver2 -hiveconf hive.server ...

最新文章

  1. 生成对抗网络(GAN)应用于图像分类
  2. 电脑开机3秒就重启循环_移动办公神器!电脑包秒变支架、鼠标垫,3合1设计超方便!...
  3. linux打开u盘里的文件,Linux下U盘内容为只读文件不能存储其他内容的解决办法
  4. php设计模式总结-单件模式
  5. dmidecode 硬件查看
  6. C++编程语言中接收用户输入参数的方法
  7. java从0单排之java就业培训教程复习与面试题回顾——02
  8. Gantt - attachEvent事件监听
  9. GD32系列外部中断
  10. 多种前端框架的优缺点
  11. northwind数据库介绍
  12. 深圳大学毕业答辩PPT模板
  13. CPU 工作原理(附详细图解)
  14. 家里的网络太慢了,怎么办?
  15. java 对汉字(中文)的汉语拼音(发音)进行排序工具类(代码实现)
  16. 计算s=1+1/2+1/3+…+1/n。当n足够大s>k,求n
  17. QT之OpenGL坐标系统
  18. 锐龙 7 7840HS 性能怎么样 r77840HS相当于什么水平级别
  19. 论信息系统人力资源管理
  20. Android 7.0 Vold工作流程

热门文章

  1. 浙江省二级计算机试题,2015浙江省计算机等级考试试题 二级ACCESS考试题库
  2. linux内核按键驱动,嵌入式Linux按键驱动框架
  3. 抓包,反抓包,反反抓包
  4. 程序老鸟:软件测试的工资高还是开发者工资高?
  5. 还在人工测越权漏洞?快来自动扫描吧!
  6. contentprovider java_ContentProvider和数据库的区别
  7. python循环怎么跳过开始循环,如果循环内部调用的函数执行时间太长,你怎么能跳过python中的循环迭代?...
  8. db2有主键时默认hash分区_Spark RDD依赖关系以及分区属性
  9. EfficientNet-B4-Ranger:自然复杂环境下温室黄瓜病害识别新方法(同时存在两种疾病)
  10. 基于 CNN 和迁移学习的农作物病害识别方法研究