本文以 Zepplin 0.91 以上版本为例,主要介绍常见 Zeppelin 解析的配置以及验证方法。
SPARK_HOME: /usr/local/service/spark
spark.master: yarn
spark.submit.deployMode: cluster
spark.app.name: zeppelin-spark
%spark
val data = sc.textFile("hdfs://HDFS45983/tmp/wordcount.txt")
case class WordCount(word: String, count: Integer)
val result = data.flatMap(x => x.split(" ")).map(x => (x, 1)).reduceByKey(_ + _).map(x => WordCount(x._1, x._2))
result.toDF().registerTempTable("result")
%sql
select * from result
FLINK_HOME: /usr/local/service/flink
flink.execution.mode: yarn
%flink
val data = benv.fromElements("hello world", "hello flink", "hello hadoop")
data.flatMap(line => line.split("\\s"))
.map(w => (w, 1))
.groupBy(0)
.sum(1)
.print()
hbase.home: /usr/local/service/hbase
hbase.ruby.sources: lib/ruby
zeppelin.hbase.test.mode: false
注意:此解析器依赖的 jar 包已集成到集群/usr/local/service/zeppelin/local-repo 路径下,因此不用配置 dependencies,如需已定义 jar 包才需配置dependencies。
%hbase
help 'get'
%hbase
list
zeppelin.livy.url: http://ip:8998
%livy.spark
sc.version
%livy.pyspark
print "1"
%livy.sparkr
hello <- function( name ) {
sprintf( "Hello, %s", name );
}
hello("livy")
kylin.api.url: http://ip:16500/kylin/api/query
kylin.api.user: ADMIN
kylin.api.password: KYLIN
kylin.query.project: default
%kylin(default)
select count(*) from table1
default.url: jdbc:mysql://ip:3306
default.user: xxx
default.password: xxx
default.driver: com.mysql.jdbc.Driver
注意:此解析器依赖的 jar 包已集成到集群/usr/local/service/zeppelin/local-repo 路径下,因此不用配置 dependencies,如需已定义 jar 包才需配置 dependencies。
验证
%mysql
show databases
default.url: jdbc:hive2://ip:7001
default.user: hadoop
default.password:
default.driver: org.apache.hive.jdbc.HiveDriver
注意:此解析器依赖的 jar 包已集成到集群/usr/local/service/zeppelin/local-repo 路径下,因此不用配置 dependencies,如需已定义 jar 包才需配置 dependencies。
%hive
show databases
%hive
use default;
show tables;
default.url: jdbc:presto://ip:9000?user=hadoop
default.user: hadoop
default.password:
default.driver: io.prestosql.jdbc.PrestoDriver
注意:此解析器依赖的 jar 包已集成到集群/usr/local/service/zeppelin/local-repo 路径下,因此不用配置 dependencies,如需已定义 jar 包才需配置 dependencies。
%presto
show catalogs;
%presto
show schemas from hive;
%presto
show tables from hive.default;
更多版本及解析器配置请参考 Zeppelin 官网文档。
本页内容是否解决了您的问题?