zeppelin入门使用

Display System

  1. text
    • 默认使用scala语言输出text内容
      这里写图片描述
    • shell
      这里写图片描述
  2. html
    • scala 输出html
      这里写图片描述
    • shell 输出html
      这里写图片描述
  3. table
    • scala
      这里写图片描述
    • shell
      这里写图片描述
    • table
      scala:
      这里写图片描述
      shell:
      这里写图片描述
      html:
      这里写图片描述

Manual

  1. 动态表格

    • 使用表格模板
      文本输入格式:
      使用 formName使{formName=defaultValue} 提供默认值
      这里写图片描述
      这里写图片描述
    • 下拉选择表格
      ${formName=defaultValue,option1|option2…}
      这里写图片描述
      k-v格式,${formName=defaultValue,
      option1(DisplayName)|option2(DisplayName)…}
      这里写图片描述
    • 动态编程
      这里写图片描述
      z 是ZeppelinContext对象
    • 文本输入格式
      这里写图片描述
    • 带默认值的文本输入格式
      这里写图片描述
    • 下拉选择表格
      这里写图片描述
  2. Notebook as Homepage
    这部分不是很重,直接看这个链接吧,http://zeppelin.incubator.apache.org/docs/manual/notebookashomepage.html

Interpreter

  1. spark,http://zeppelin.incubator.apache.org/docs/interpreter/spark.html
  2. hive
  3. md
  4. sh
  5. flink
  6. and so on
    上面都有涉及,如何使用

Tutorial with Local File

val bankText = sc.textFile("/home/cluster/data/test/bank/bank-full.csv")

case class Bank(age:Integer, job:String, marital : String, education : String, balance : Integer)

val bank = bankText.map(s=>s.split(";")).filter(s=>s(0)!=""age"").map(
    s=>Bank(s(0).toInt, 
            s(1).replaceAll(""", ""),
            s(2).replaceAll(""", ""),
            s(3).replaceAll(""", ""),
            s(5).replaceAll(""", "").toInt
        )
)

// Below line works only in spark 1.3.0.
// For spark 1.1.x and spark 1.2.x,
// use bank.registerTempTable("bank") instead.
bank.toDF().registerTempTable("bank")
  • Data Retrieval
    Suppose we want to see age distribution from bank. To do this, run:
    执行以下语句,可看到年龄的分布:
%sql select age, count(1) from bank where age < 30 group by age order by age

这里写图片描述
动态输入maxAge参数(默认是30岁):

%sql select age, count(1) from bank where age < ${maxAge=30} group by age order by age

这里写图片描述
根据婚姻状况选项,查看年龄分布状况:

%sql select age, count(1) from bank where marital="${marital=single,single|divorced|married}" group by age order by age

这里写图片描述

Zeppelin的工作方式和Spark的Thrift Server很像,都是向Spark提交一个应用(Application),然后每一个查询对应一个stage。
这里写图片描述

因此,在启动Zeppelin前,可以通过配置环境变量ZEPPELIN_JAVA_OPTS来对即将启动的Spark driver进行配置,例如“-Dspark.executor.memory=6g -Dspark.cores.max=32”。
尊重原创,拒绝转载,http://blog.csdn.net/stark_summer/article/details/48318059

版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/stark-summer/p/4829745.html