在Eclipse中运行火花code火花正在安装另一台服务器上

编程入门 行业动态 更新时间:2024-10-13 04:23:40
本文介绍了在Eclipse中运行火花code火花正在安装另一台服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经配置了斯卡拉Eclipse和创建一个Maven项目,而在Windows写了一个简单的字数火花的工作。现在我的火花+ Hadoop的安装Linux服务器。如何从Eclipse启动我的火花code火花簇(这是在Linux上)?

I have configured eclipse for scala and created a maven project and wrote a simple word count spark job on windows. Now my spark+hadoop are installed on linux server. How can I launch my spark code from eclipse to spark cluster (which is on linux)?

任何建议。

推荐答案

其实这个答案并非如此简单,你所期望的。

Actually this answer is not so simple, as you would expect.

我在许多假设,首先你使用 SBT ,第二个是,你是在一个基于Linux的计算机工作,第三是最后被你有两个类在您的项目,比方说邵仁枚和全局,和最后的假设是你想要设置里面的程序设置。因此,在某个地方你可运行code你必须有这样的事情:

I will make many assumptions, first that you use sbt, second is that you are working in a linux based computer, third is the last is that you have two classes in your project, let's say RunMe and Globals, and the last assumption will be that you want to set up the settings inside the program. Thus, somewhere in your runnable code you must have something like this:

object RunMe { def main(args: Array[String]) { val conf = new SparkConf() .setMaster("mesos://master:5050") //If you use Mesos, and if your network resolves the hostname master to its IP. .setAppName("my-app") .set("spark.executor.memory", "10g") val sc = new SparkContext(conf) val sqlContext = new SQLContext() //your code comes here } }

您必须遵循的步骤如下:

The steps you must follow are:

  • 编译工程,在它的根,通过使用:

  • Compile the project, in the root of it, by using:

$ SBT组装

将作业发送到主节点,这是有趣的部分(假设你有一个结构项目中的目标/斯卡拉/ ,和里面你有一个文件的.jar ,对应于编译的项目)

Send the job to the master node, this is the interesting part (assuming you have the next structure in your project target/scala/, and inside you have a file .jar, which corresponds to the compiled project)

$火花提交--class邵仁枚的目标/斯卡拉/ app.jar

注意,因为我认为该项目有你必须确定你想要运行的类两个或多个类。此外,我敢打赌,这两种方法,为纱线和 Mesos 非常相似。

Notice that, because I assumed that the project has two or more classes you would have to identify which class you want to run. Furthermore, I bet that both approaches, for Yarn and Mesos are very similar.

更多推荐

在Eclipse中运行火花code火花正在安装另一台服务器上

本文发布于:2023-11-24 02:31:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623643.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:火花   另一台   器上   Eclipse   code

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!