Jupyter配置Spark开发环境

兄弟连大数据培训(www.lampbrother.net

)和大家一起探究Jupyter配置

Spark
开发环境

简介

  为Jupyter配置Spark开发环境,可以安装全家桶–Spark Kernel或Toree,也可按需安装相关组件。

  考虑到一般人更喜欢一步到位,并且Toree将会代替Spark Kernel,故直接且仅需安装Toree即可,不过下面还是给出了所有的安装方法。

  Spark Kernel的安装

  参照Spark Kernel支持的语言,安装好Spark Kernel后,其默认可以支持Scala,Python,R,SQL,对应的Spark实现分别是Scala with Spark,Python with PySpark,R With SparkR,Spark SQL。

  参照上述链接,要切换语言时,只需简单的在语句前面加上%%scala/%%pyspark即可。当然,什么都不加时,默认语言为Scala。

  另外,启动Jupyter后,可直接在http://localhost:4040/jobs/监控所有作业。

  Spark Kernel(旧的项目)

  参照下面的安装步骤进行即可,就是有些繁琐。

  Getting Started with theSpark Kernel

  Guide to Integrating theSpark Kernel with Jupyter

  Toree(新项目)

  根据Spark Kernel的介绍,自从Spark Kernel变成Apache的孵化项目后,其最新仓库已经 迁移到了incubator-toree。

  安装时,参照Quick Start What isApache Toree ,仅需两条命令即可完成安装。

  pip install toree

  jupyter toree install--spark_home=your-spark-home12

  值得注意的是:

  Toree虽然还在孵化中,但已经能完成上述Spark Kernel的全部功能,即可支持PySpark,Spark SQL等。

  该kernel安装在/usr/local/share/jupyter/kernels/apache_toree_scala目录下

  Spark组件单独安装

  除了安装上面的方法安装Spark的全家桶外,还可以按需对各组件进行安装。

  Scala Kernel的安装

  参照jupyter-scala安装即可。

  PySpark的安装

  PySpark: How to install andIntegrate with the Jupyter Notebook

  Integrate Apache Spark withlatest IPython Notebook (Jupyter 4.x)

  Running Spark ApplicationsUsing IPython and Jupyter Notebooks


猜你喜欢

转载自xdlliutao.iteye.com/blog/2329238