zeppelin入門使用

Display System

  1. text
    • 默認使用scala語言輸出text內容
      這裏寫圖片描述
    • shell
      這裏寫圖片描述
  2. html
    • scala 輸出html
      這裏寫圖片描述
    • shell 輸出html
      這裏寫圖片描述
  3. table
    • scala
      這裏寫圖片描述
    • shell
      這裏寫圖片描述
    • table
      scala:
      這裏寫圖片描述
      shell:
      這裏寫圖片描述
      html:
      這裏寫圖片描述

Manual

  1. 動態表格html

    • 使用表格模板
      文本輸入格式:
      使用 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.htmlsql

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歲):shell

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

這裏寫圖片描述
根據婚姻情況選項,查看年齡分佈情況:apache

%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/48318059markdown

版權聲明:本文爲博主原創文章,未經博主容許不得轉載。this

相關文章
相關標籤/搜索