Zeppelin0.8.1上操作hive(使用jdbc解释器)

@羲凡——只为了更好的活着

Zeppelin0.8.1上操作hive(使用jdbc解释器)

Hive解释器将被弃用并合并到JDBC解释器中。通过使用具有相同功能的JDBC解释器,可以使用Hive解释器。可结合官网查看如何操作 http://zeppelin.apache.org/docs/0.8.1/interpreter/hive.html

1.登录8080界面后,点击右上角用户名进入interpreter

Zeppelin0.8.1上操作hive(使用jdbc解释器)

2.点击右上角 +Create按钮,进入界面填写如下

Zeppelin0.8.1上操作hive(使用jdbc解释器)

3.在Properties和Dependencies中分别填写如下

Properties

name value
default.driver org.apache.hive.jdbc.HiveDriver
default.url jdbc:hive2://deptest48:10000
default.user root(如果你的hiveserver2没有设置用户名密码,可以不填)
default.password root(如果你的hiveserver2没有设置用户名密码,可以不填)

Dependencies

artifact exclude
org.apache.hive:hive-jdbc:1.2.1
org.apache.hadoop:hadoop-common:2.7.3

最后,点击下方的 Save 按钮,保存退出

4.测试

a. 会到首页点击 Create new note,设置Note Name(自定义)和Default Interpreter(选择刚才设置的hive)

b. 随便输入一个可执行的hive语句即可,如果执行可查出结果,则表示配置成功。特别强调如果在创建该note时指定Default Interpreter为hive,这语句中的 %hive可以不写。
Zeppelin0.8.1上操作hive(使用jdbc解释器)

5.报错处理

a. 报错org.apache.zeppelin.interpreter.InterpreterNotFoundException: Either no interpreter named hive or it is not binded to this note,这很有可能是你在创建该note时 Default Interpreter没有选择 hive。解决方法:
方法一.删除该note重新创建一个新的note,且在Default Interpreter中选择hive
方法二.点击该note右上角的 设置 按钮,进入界面会看到 hive%hive显示为白色,点击一下将其变成蓝色如下图,然后点击保存即可。但是这种方式必须在语句前面加上 %hive
Zeppelin0.8.1上操作hive(使用jdbc解释器)
b. 报错 org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 1:40 extraneous input ';' expecting EOF near '<EOF>'这个是因为hive的解释器不识别“;”,将你sql语句中的分号去掉即可。

====================================================================

@羲凡——只为了更好的活着

若对博客中有任何问题,欢迎留言交流