點擊查看原文(包含源碼和圖片):http://note.youdao.com/noteshare?id=fdb03eb81783f7b3c77ffd78c6c95612&sub=DC8EC22B5004468D9A76E21A9C42D36E
1.下載
http://mirrors.tuna.tsinghua.edu.cn/apache/zeppelin/zeppelin-0.8.2/zeppelin-0.8.2-bin-all.tgz
2.解壓
3.啓動
雙擊 bin/zeppelin.cmd
4.進入web界面
http://localhost:8080/#/
5.新建Interpreters
- 頁面右上角 點擊用戶
- 進入後可以瀏覽一下,已經創建好的Interpreter
- 創建一個新的Interpreter
- 填寫Interpreter Name(隨意命名)
- 選擇一個 Interpreter group
- 畫紅框框的地方,修改成自己的mysql配置
- artifact 處需要填寫mysql-connector-java-5.1.xx.jar 路徑,然後保存
6.左上角,新建一個筆記本
7.鏈接sql數據庫,並執行語句
8.Hive Interpreter 設置
- 添加jar包。如果不行,再添加一個hadoop-common那個jar包
- 運行
9.Spark Interpreter 設置
val bankText = sc.textFile("D:/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 ) ) // convert to DataFrame and create temporal table bank.toDF().registerTempTable("bank")
- 使用默認寫好的spark Interpreter即可
- 按圖輸入,測試代碼,運行
10.Flink Interpreter 設置
- 新建flink Interpreter
- 新建筆記本
%flink 表示執行 flink代碼
%flink case class WordCount(word: String, frequency: Int) val bible:DataSet[String] = benv.readTextFile("D://Test//10.txt.utf-8") val partialCounts: DataSet[WordCount] = bible.flatMap{ line => """\b\w+\b""".r.findAllIn(line).map(word => WordCount(word, 1)) // line.split(" ").map(word => WordCount(word, 1)) } val wordCounts = partialCounts.groupBy("word").reduce{ (left, right) => WordCount(left.word, left.frequency + right.frequency) } val result10 = wordCounts.first(10).collect()