一、环境说明

Mac OSX
Java  1.7.0_71
Spark 

二、编译安装

tar -zxvf spark-.tgz
cd spark-
./sbt/sbt assembly

ps:如果之前执行过编译,需要执行 ./sbt/sbt clean  清理后才能重新编译。

三、运行

adeMacBook-Pro:spark- apple$ ./bin/spark-shell
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
// :: INFO SecurityManager: Changing view acls to: apple
// :: INFO SecurityManager: Changing modify acls to: apple
// :: INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(apple); users with modify permissions: Set(apple)
// :: INFO HttpServer: Starting HTTP Server
// :: INFO Server: jetty-.y.z-SNAPSHOT
// :: INFO AbstractConnector: Started SocketConnector@
// :: INFO Utils: Successfully started service .
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /___/ .__/\_,_/_/ /_/\_\   version
      /_/

Using Scala version  (Java HotSpot(TM) -Bit Server VM, Java 1.7.0_71)
Type in expressions to have them evaluated.
Type :help for more information.
// :: INFO SparkContext: Running Spark version
// :: INFO SecurityManager: Changing view acls to: apple
// :: INFO SecurityManager: Changing modify acls to: apple
// :: INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(apple); users with modify permissions: Set(apple)
// :: INFO Slf4jLogger: Slf4jLogger started
// :: INFO Remoting: Starting remoting
// :: INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkDriver@192.168.1.106:61567]
// :: INFO Utils: Successfully started service .
// :: INFO SparkEnv: Registering MapOutputTracker
// :: INFO SparkEnv: Registering BlockManagerMaster
// :: INFO DiskBlockManager: Created local directory at /-4d54-89f3-8d97bf15205f/blockmgr-b8410cda-aa29---d6155512cd53
// :: INFO MemoryStore: MemoryStore started with capacity 265.4 MB
// :: INFO HttpFileServer: HTTP File server directory -4d54-89f3-8d97bf15205f/httpd-a1838f08-2ccd-42d2--6e91cb6fdfad
// :: INFO HttpServer: Starting HTTP Server
// :: INFO Server: jetty-.y.z-SNAPSHOT
// :: INFO AbstractConnector: Started SocketConnector@
// :: INFO Utils: Successfully started service .
// :: INFO SparkEnv: Registering OutputCommitCoordinator
// :: INFO Server: jetty-.y.z-SNAPSHOT
// :: INFO AbstractConnector: Started SelectChannelConnector@
// :: INFO Utils: Successfully started service .
// :: INFO SparkUI: Started SparkUI at http://192.168.1.106:4040
// :: INFO Executor: Starting executor ID driver on host localhost
// :: INFO Executor: Using REPL class URI: http://192.168.1.106:61566
// :: INFO Utils: Successfully started service .
// :: INFO NettyBlockTransferService: Server created on
// :: INFO BlockManagerMaster: Trying to register BlockManager
// :: INFO BlockManagerMasterEndpoint: Registering block manager localhost: with )
// :: INFO BlockManagerMaster: Registered BlockManager
// :: INFO SparkILoop: Created spark context..
Spark context available as sc.
// :: INFO SparkILoop: Created sql context..
SQL context available as sqlContext.

scala> 

参考:

https://spark.apache.org/docs/latest/

三、使用spark交互模式

. 运行./spark-shell.sh

. scala> val data = Array(, , , , ) //产生data

data: Array[Int] = Array(, , , , )

. scala> val distData = sc.parallelize(data) //将data处理成RDD

distData: spark.RDD[Int] = spark.ParallelCollection@7a0ec850 (显示出的类型为RDD)

. scala> distData.reduce(_+_) //在RDD上进行运算,对data里面元素进行加和

// :: INFO spark.SparkContext: Starting job...

. 最后运行得到

// :: INFO spark.SparkContext: Job finished in 0.076729174 s

res2: Int = 

Spark编译安装和运行的更多相关文章

  1. Heka 编译安装后 运行报错 panic: runtime error: cgo argument has Go pointer to Go pointer

    Heka 编译安装后 运行报错 panic: runtime error: cgo argument has Go pointer to Go pointer 解决办法: 1.  Start heka ...

  2. Spark入门实战系列--2.Spark编译与部署(下)--Spark编译安装

    [注]该系列文章以及使用到安装包/测试数据 可以在<倾情大奉送--Spark入门实战系列>获取 .编译Spark .时间不一样,SBT是白天编译,Maven是深夜进行的,获取依赖包速度不同 ...

  3. spark编译安装 spark 2.1.0 hadoop2.6.0-cdh5.7.0

    1.准备: centos 6.5 jdk 1.7 Java SE安装包下载地址:http://www.oracle.com/technetwork/java/javase/downloads/java ...

  4. Ubuntu16.04下编译安装及运行单目ORBSLAM2

    官网有源代码和配置教程,地址是 https://github.com/raulmur/ORB_SLAM2 1 安装必要工具 首先,有两个工具是需要提前安装的.即cmake和Git. sudo apt- ...

  5. spark下载安装,运行examples(spark一)

    1.官方网址 http://spark.apache.org/ image.png 2.点击下载 下载最新版本目前是(2.4.3)此spark预设为hadoop2.7或者更高版本,我前面安装的是had ...

  6. 基于cdh5.10.x hadoop版本的apache源码编译安装spark

    参考文档:http://spark.apache.org/docs/1.6.0/building-spark.html spark安装需要选择源码编译方式进行安装部署,cdh5.10.0提供默认的二进 ...

  7. Spark入门实战系列--2.Spark编译与部署(上)--基础环境搭建

    [注] 1.该系列文章以及使用到安装包/测试数据 可以在<倾情大奉送--Spark入门实战系列>获取: 2.Spark编译与部署将以CentOS 64位操作系统为基础,主要是考虑到实际应用 ...

  8. Spark编译与部署

    Spark入门实战系列--2.Spark编译与部署(上)--基础环境搭建   [注] 1.该系列文章以及使用到安装包/测试数据 可以在<倾情大奉送--Spark入门实战系列>获取: 2.S ...

  9. MySQL编译安装

    1.准备工作 其官方站点为http://www.mysql.com/ 为了避免发生端口冲突.程序冲突现象.建议先查询MySQL软件的安装情况,确认没有使用以RPM方式安装的mysql-server.m ...

随机推荐

  1. LUA的编译、环境等

    Lua的环境.编译等 Lua命令行 lua命令行选项: -i:进入交互式 -e:执行lua代码 -l:加载库文件 例如使用下面的命令启动lua解释器,可以重新定义lua提示符. lua -i -e & ...

  2. Struts2中使用Servlet API步骤

    Struts2中使用Servlet API步骤 Action类中声明request等对象 Map<String, Object> request; 获得ActionContext实例 Ac ...

  3. ssh框架整合完整版

    1.导入jar包 可以在src下添加一个log4j.properties文件来记录日志 2.加入实体类+映射文件 映射:从类入手class+属性 a.映射的头文件在:hibernate3.jar--& ...

  4. WPF 动态布局Grid

    //开启线程加载 Action a = () => { ; ; var path = "../../face_img/"; var files = Directory.Get ...

  5. object-c(oc)内存管理机制详解

    1.内存的创建和释放 让我们以Object-c世界中最最简单的申请内存方式展开,谈谈关于一个对象的生命周期.首先创建一个对象: 1 2 3 //“ClassName”是任何你想写的类名,比如NSStr ...

  6. C#集合实现接口一览表

  7. Common Subsequence(dp)

    Common Subsequence Time Limit: 2 Sec  Memory Limit: 64 MBSubmit: 951  Solved: 374 Description A subs ...

  8. request-log-analyzer日志分析

    (这些文章都是从我的个人主页上粘贴过来的,大家也可以访问我的主页 www.iwangzheng.com) 日志分析是常见的工作,方法如下: 使用工具:request-log-analyzer安装:$ ...

  9. ruby代码重构第二课

    (文章都是从我的个人主页上粘贴过来的, 大家也可以访问我的主页 www.iwangzheng.com) 在第一课里提取出了相通的代码,第二课里就把常量提取出来吧 一般把常量的定义写的对应的app/mo ...

  10. ssh面试题

    ssh面试题  创建时间: 2015-8-12 22:37 来源: http://wenku.baidu.com/link?url=cw1B46f98hAde0kmr3J-wv7PpklZJRmf6I ...