Apache Spark error : Could not connect to akka.tcp://sparkMaster@

后端 未结 3 1538
星月不相逢
星月不相逢 2020-12-11 03:18

This is our first steps using big data stuff like apache spark and hadoop.

We have a installed Cloudera CDH 5.3. From the cloudera manager we choose to install spark

相关标签:
3条回答
  • 2020-12-11 04:08

    I notice no accepted answer, just for info I thought I'd mention a couple things.

    First, in the spark-env.sh file in the conf directory, the SPARK_MASTER_IP and SPARK_LOCAL_IP settings can be hostnames. You don't want them to be, but they can be.

    As noted in another answer, Spark can be a little picky about hostname vs. IP address, because of this resolved bug/feature: See bug here. The problem is, it's not clear if they "resolved" is simply by telling us to use IP instead of hostname?

    Well I am having this same problem right now, and the first thing you do is check the basics.

    Can you ping the box where the Spark master is running? Can you ping the worker from the master? More importantly, can you password-less ssh to the worker from the master box? Per 1.5.2 docs you need to be able to do that with a private key AND have the worker entered in the conf/slaves file. I copied the relevant paragraph at the end.

    You can get a situation where the worker can contact the master but the master can't get back to the worker so it looks like no connection is being made. Check both directions.

    Finally of all the combinations of settings, in a limited experiment just now I only found one that mattered: On the master, in spark-env.sh, set the SPARK_MASTER_IP to the IP address, not hostname. Then connect from the worker with spark://192.168.0.10:7077 and voila it connects! Seemingly none of the other config parameters are needed here.

    Here's the paragraph from the docs about ssh and slaves file in conf:

    To launch a Spark standalone cluster with the launch scripts, you should create a file called conf/slaves in your Spark directory, which must contain the hostnames of all the machines where you intend to start Spark workers, one per line. If conf/slaves does not exist, the launch scripts defaults to a single machine (localhost), which is useful for testing. Note, the master machine accesses each of the worker machines via ssh. By default, ssh is run in parallel and requires password-less (using a private key) access to be setup. If you do not have a password-less setup, you can set the environment variable SPARK_SSH_FOREGROUND and serially provide a password for each worker.

    Once you have done that, using the IP address should work in your code. Let us know! This can be an annoying problem, and learning that most of the config params don't matter was nice.

    0 讨论(0)
  • 2020-12-11 04:12

    When you create your Spark master using the shell command "sbin/start-master.sh". go the the address http://localhost:8080 and check the "URL" row.

    0 讨论(0)
  • 2020-12-11 04:19

    Check your Spark master logs, you should see something like:

    15/02/11 13:37:14 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkMaster@mymaster:7077]
    15/02/11 13:37:14 INFO Remoting: Remoting now listens on addresses: [akka.tcp://sparkMaster@mymaster:7077]
    15/02/11 13:37:14 INFO Master: Starting Spark master at spark://mymaster:7077
    

    Then when your connecting to the master, be sure to use exactly the same hostname as found in the logs above (do not use the IP address):

    .setMaster("spark://mymaster:7077"));
    

    Spark standalone is a bit picky with this hostname/IP stuff.

    0 讨论(0)
提交回复
热议问题