无法绑定到:spark-master,使用具有两个worker的远程群集

时间:2015-04-27 21:56:01

标签: binding apache-spark runtime-error

我正在努力让所有人都与本地主人和两名远程工作人员合作。现在,我想连接到具有相同远程工作者的远程主服务器。我已尝试在Internet上使用/ etc / hosts和其他推荐设置的不同设置组合,但没有工作。

主要课程是:

public static void main(String[] args) {
    ScalaInterface sInterface = new ScalaInterface(CHUNK_SIZE,
            "awsAccessKeyId",
            "awsSecretAccessKey");

    SparkConf conf = new SparkConf().setAppName("POC_JAVA_AND_SPARK")
            .setMaster("spark://spark-master:7077");

    org.apache.spark.SparkContext sc = new org.apache.spark.SparkContext(
            conf);

    sInterface.enableS3Connection(sc);
    org.apache.spark.rdd.RDD<Tuple2<Path, Text>> fileAndLine = (RDD<Tuple2<Path, Text>>) sInterface.getMappedRDD(sc, "s3n://somebucket/");

    org.apache.spark.rdd.RDD<String> pInfo = (RDD<String>) sInterface.mapPartitionsWithIndex(fileAndLine);

    JavaRDD<String> pInfoJ = pInfo.toJavaRDD();

    List<String> result = pInfoJ.collect();

    String miscInfo = sInterface.getMiscInfo(sc, pInfo);

    System.out.println(miscInfo);

}

它失败了:

List<String> result = pInfoJ.collect();

我得到的错误是:

1354 [sparkDriver-akka.actor.default-dispatcher-3] ERROR akka.remote.transport.netty.NettyTransport  - failed to bind to spark-master/192.168.0.191:0, shutting down Netty transport
1354 [main] WARN  org.apache.spark.util.Utils  - Service 'sparkDriver' could not bind on port 0. Attempting port 1.
1355 [main] DEBUG org.apache.spark.util.AkkaUtils  - In createActorSystem, requireCookie is: off
1363 [sparkDriver-akka.actor.default-dispatcher-3] INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator  - Shutting down remote daemon.
1364 [sparkDriver-akka.actor.default-dispatcher-3] INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator  - Remote daemon shut down; proceeding with flushing remote transports.
1364 [sparkDriver-akka.actor.default-dispatcher-5] INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator  - Remoting shut down.
1367 [sparkDriver-akka.actor.default-dispatcher-4] INFO  akka.event.slf4j.Slf4jLogger  - Slf4jLogger started
1370 [sparkDriver-akka.actor.default-dispatcher-6] INFO  Remoting  - Starting remoting
1380 [sparkDriver-akka.actor.default-dispatcher-4] ERROR akka.remote.transport.netty.NettyTransport  - failed to bind to spark-master/192.168.0.191:0, shutting down Netty transport
Exception in thread "main" 1382 [sparkDriver-akka.actor.default-dispatcher-6] INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator  - Shutting down remote daemon.
1382 [sparkDriver-akka.actor.default-dispatcher-6] INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator  - Remote daemon shut down; proceeding with flushing remote transports.
java.net.BindException: Failed to bind to: spark-master/192.168.0.191:0: Service 'sparkDriver' failed after 16 retries!
    at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
    at akka.remote.transport.netty.NettyTransport$$anonfun$listen$1.apply(NettyTransport.scala:393)
    at akka.remote.transport.netty.NettyTransport$$anonfun$listen$1.apply(NettyTransport.scala:389)
    at scala.util.Success$$anonfun$map$1.apply(Try.scala:206)
    at scala.util.Try$.apply(Try.scala:161)
    at scala.util.Success.map(Try.scala:206)
    at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
    at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
    at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
1383 [sparkDriver-akka.actor.default-dispatcher-7] INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator  - Remoting shut down.
1385 [delete Spark temp dirs] DEBUG org.apache.spark.util.Utils  - Shutdown hook called

谢谢你的帮助!

4 个答案:

答案 0 :(得分:55)

设置环境变量SPARK_LOCAL_IP = 127.0.0.1为我解决了这个问题。

答案 1 :(得分:12)

当我的/etc/hosts文件将错误的IP地址映射到我的本地主机名时,我遇到了这个问题。

日志中的BindException会抱怨IP地址192.168.0.191。我假设解析为您的计算机的主机名,而您的网络接口正在使用的实际IP地址。一旦解决了这个问题,它应该可以正常工作。

答案 2 :(得分:5)

我的EC2实例中有火花。我启动了一个新的Web服务器并满足其要求我必须将主机名更改为ec2公共DNS名称,即

hostname ec2-54-xxx-xxx-xxx.compute-1.amazonaws.com

之后我的火花无法正常工作并显示如下错误:

  

16/09/20 21:02:22 WARN Utils:Service&#39; sparkDriver&#39;无法绑定端口0.尝试端口1。   16/09/20 21:02:22错误SparkContext:初始化SparkContext时出错。

我通过将SPARK_LOCAL_IP设置为如下来解决此问题:

export SPARK_LOCAL_IP="localhost"

然后刚刚启动闪闪发光的外壳如下:

$SPARK_HOME/bin/spark-shell

答案 3 :(得分:1)

可能你的主人在非默认端口上运行。你可以发布你的提交命令吗? 看看https://spark.apache.org/docs/latest/spark-standalone.html#connecting-an-application-to-the-cluster