Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu 在一台机器上安装Spark_Ubuntu_Apache Spark - Fatal编程技术网

Ubuntu 在一台机器上安装Spark

Ubuntu 在一台机器上安装Spark,ubuntu,apache-spark,Ubuntu,Apache Spark,我需要在运行Ubuntu14.04的一台机器上安装spark,我需要它主要用于教育目的,所以我对高性能不太感兴趣 我没有足够的知识来学习本教程,也不知道应该安装哪个版本的Spark 有人能告诉我如何在我的机器上一步一步地设置一个工作的火花系统吗 编辑: 根据评论和当前答案,我能够运行spark控制台并使用它 donbeo@donbeo-HP-EliteBook-Folio-9470m:~/Applications/spark/spark-1.1.0$ ./bin/spark-shell

我需要在运行Ubuntu14.04的一台机器上安装spark,我需要它主要用于教育目的,所以我对高性能不太感兴趣

我没有足够的知识来学习本教程,也不知道应该安装哪个版本的Spark

有人能告诉我如何在我的机器上一步一步地设置一个工作的火花系统吗

编辑: 根据评论和当前答案,我能够运行spark控制台并使用它

    donbeo@donbeo-HP-EliteBook-Folio-9470m:~/Applications/spark/spark-1.1.0$ ./bin/spark-shell
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
15/02/04 10:20:20 INFO SecurityManager: Changing view acls to: donbeo,
15/02/04 10:20:20 INFO SecurityManager: Changing modify acls to: donbeo,
15/02/04 10:20:20 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(donbeo, ); users with modify permissions: Set(donbeo, )
15/02/04 10:20:20 INFO HttpServer: Starting HTTP Server
15/02/04 10:20:20 INFO Utils: Successfully started service 'HTTP class server' on port 48135.
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /___/ .__/\_,_/_/ /_/\_\   version 1.1.0
      /_/

Using Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.7.0_75)
Type in expressions to have them evaluated.
Type :help for more information.
15/02/04 10:20:23 WARN Utils: Your hostname, donbeo-HP-EliteBook-Folio-9470m resolves to a loopback address: 127.0.1.1; using 192.168.1.45 instead (on interface wlan0)
15/02/04 10:20:23 WARN Utils: Set SPARK_LOCAL_IP if you need to bind to another address
15/02/04 10:20:23 INFO SecurityManager: Changing view acls to: donbeo,
15/02/04 10:20:23 INFO SecurityManager: Changing modify acls to: donbeo,
15/02/04 10:20:23 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(donbeo, ); users with modify permissions: Set(donbeo, )
15/02/04 10:20:23 INFO Slf4jLogger: Slf4jLogger started
15/02/04 10:20:23 INFO Remoting: Starting remoting
15/02/04 10:20:23 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkDriver@192.168.1.45:34171]
15/02/04 10:20:23 INFO Remoting: Remoting now listens on addresses: [akka.tcp://sparkDriver@192.168.1.45:34171]
15/02/04 10:20:23 INFO Utils: Successfully started service 'sparkDriver' on port 34171.
15/02/04 10:20:23 INFO SparkEnv: Registering MapOutputTracker
15/02/04 10:20:23 INFO SparkEnv: Registering BlockManagerMaster
15/02/04 10:20:24 INFO DiskBlockManager: Created local directory at /tmp/spark-local-20150204102024-1e7b
15/02/04 10:20:24 INFO Utils: Successfully started service 'Connection manager for block manager' on port 44926.
15/02/04 10:20:24 INFO ConnectionManager: Bound socket to port 44926 with id = ConnectionManagerId(192.168.1.45,44926)
15/02/04 10:20:24 INFO MemoryStore: MemoryStore started with capacity 265.4 MB
15/02/04 10:20:24 INFO BlockManagerMaster: Trying to register BlockManager
15/02/04 10:20:24 INFO BlockManagerMasterActor: Registering block manager 192.168.1.45:44926 with 265.4 MB RAM
15/02/04 10:20:24 INFO BlockManagerMaster: Registered BlockManager
15/02/04 10:20:24 INFO HttpFileServer: HTTP File server directory is /tmp/spark-58772693-4106-4ff0-a333-6512bcfff504
15/02/04 10:20:24 INFO HttpServer: Starting HTTP Server
15/02/04 10:20:24 INFO Utils: Successfully started service 'HTTP file server' on port 51677.
15/02/04 10:20:24 INFO Utils: Successfully started service 'SparkUI' on port 4040.
15/02/04 10:20:24 INFO SparkUI: Started SparkUI at http://192.168.1.45:4040
15/02/04 10:20:24 INFO Executor: Using REPL class URI: http://192.168.1.45:48135
15/02/04 10:20:24 INFO AkkaUtils: Connecting to HeartbeatReceiver: akka.tcp://sparkDriver@192.168.1.45:34171/user/HeartbeatReceiver
15/02/04 10:20:24 INFO SparkILoop: Created spark context..
Spark context available as sc.

scala> val x = 3
x: Int = 3

scala> 
现在假设我想在scala文件中使用spark,例如

/* SimpleApp.scala */
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf

object SimpleApp {
  def main(args: Array[String]) {
    val logFile = "YOUR_SPARK_HOME/README.md" // Should be some file on your system
    val conf = new SparkConf().setAppName("Simple Application")
    val sc = new SparkContext(conf)
    val logData = sc.textFile(logFile, 2).cache()
    val numAs = logData.filter(line => line.contains("a")).count()
    val numBs = logData.filter(line => line.contains("b")).count()
    println("Lines with a: %s, Lines with b: %s".format(numAs, numBs))
  }
}

我该怎么做呢?

如果您只是计划在一台机器上运行它进行学习等,那么您可以使用本地1 core或本地[*]all cores值作为主机。然后,它就像正常的JVM进程一样运行,即使在IDE、调试器等中也是如此。。我写了一个自己动手的研讨会,如果你需要一个例子,它就是这样工作的


如果本地足够,其中一个二进制下载将满足您的需要。

如果有帮助,有一个逐步安装指南。你不确定哪些部分?@DNA我可以运行向导并使用终端的火花壳。现在,我如何在新的scala项目中使用spark?请参阅本节链接的,以及spark附带的示例。如果您不确定如何运行基本的Scala程序,在尝试编写Spark jobs之前,您首先需要学习有关该程序的教程。我有Scala的基本知识,并且能够运行Scala程序。但我不明白如何用spark做到这一点。我能够运行简单的scala程序或spark中的示例,但无法运行新示例。例如,如果我在新文件SparkPi2中复制SparkPi,我如何运行它?这个问题似乎比预期的要复杂。我将接受答案并提出一个关于如何提交任务的新问题。我可以使用sbt或activator运行您的教程。但是我如何启动一个新的spark项目呢?如果你喜欢一般的方法,你可以复制项目并删除你不想要的源文件和脚本,然后修改剩余的文件来创建你的新应用程序。如果您想使用Spark自己的Spark submit脚本运行您的应用程序或我的示例,请使用sbt/activator shell命令包创建jar文件,然后按照说明将其与Spark submit一起使用。请注意,您需要下载Spark发行版。要得到脚本等。谢谢,但我仍然有问题。我在这里问了一个更具体的问题