Yarn执行器启动了错误的spark版本



我的集群安装了hadoop 2.6.3和spark 1.6。

最近,我将spark升级到2.0,一切似乎都很好,直到我试图在spark 1.6中运行一些旧的工作,这些工作与spark 2.0有一些兼容问题。

我尝试的第一件事是:

echo $SPARK_HOME
/usr/local/spark-1.6.1-bin-hadoop2.6
/usr/local/spark-1.6.1-bin-hadoop2.6/bin/spark-submit  --master yarn--deploy-mode client /usr/local/spark-1.6.1-bin-hadoop2.6/examples/src/main/python/pi.py 100

然而,上面的工作失败了,当我检查纱线日志时,我发现以下内容:

YARN executor launch context:
env:
CLASSPATH -> {{PWD}}<CPS>{{PWD}}/__spark__.jar<CPS>$HADOOP_CONF_DIR<CPS>$HADOOP_COMMON_HOME/share/hadoop/common/*<CPS>$HADOOP_COMMON_HOME/share/hadoop/common/lib/*<CPS>$HADOOP_HDFS_HOME/share/hadoop/hdfs/*<CPS>$HADOOP_HDFS_HOME/share/hadoop/hdfs/lib/*<CPS>$HADOOP_YARN_HOME/share/hadoop/yarn/*<CPS>$HADOOP_YARN_HOME/share/hadoop/yarn/lib/*<CPS>$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*<CPS>$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*
SPARK_LOG_URL_STDERR -> http://datanode01-bi-dev:8042/node/containerlogs/container_1476081972773_0194_01_000003/hadoop/stderr?start=-4096
    SPARK_YARN_STAGING_DIR -> .sparkStaging/application_1476081972773_0194
    SPARK_YARN_CACHE_FILES_FILE_SIZES -> 187698038,357051,44846
    SPARK_USER -> hadoop
    SPARK_YARN_CACHE_FILES_VISIBILITIES -> PRIVATE,PRIVATE,PRIVATE
    SPARK_YARN_MODE -> true
    SPARK_YARN_CACHE_FILES_TIME_STAMPS -> 1477040367079,1477040367425,1477040367454
    SPARK_HOME -> /usr/local/spark-2.0.0-bin-hadoop2.6
    PYTHONPATH -> /usr/local/spark-1.6.1-bin-hadoop2.6/python/lib/py4j-0.9-src.zip:<CPS>{{PWD}}/pyspark.zip<CPS>{{PWD}}/py4j-0.9-src.zip
    SPARK_LOG_URL_STDOUT -> http://datanode01-bi-dev:8042/node/containerlogs/container_1476081972773_0194_01_000003/hadoop/stdout?start=-4096
    SPARK_YARN_CACHE_FILES -> hdfs://10.104.90.40:8020/user/hadoop/.sparkStaging/application_1476081972773_0194/spark-assembly-1.6.1-hadoop2.6.0.jar#__spark__.jar,hdfs://10.104.90.40:8020/user/hadoop/.sparkStaging/application_1476081972773_0194/pyspark.zip#pyspark.zip,hdfs://10.104.90.40:8020/user/hadoop/.sparkStaging/application_1476081972773_0194/py4j-0.9-src.zip#py4j-0.9-src.zip
  command:
  {{JAVA_HOME}}/bin/java -server -XX:OnOutOfMemoryError='kill %p' -Xms1024m -Xmx1024m -Djava.io.tmpdir={{PWD}}/tmp '-Dspark.driver.port=26087' '-Dspark.ui.port=0' -Dspark.yarn.app.container.log.dir=<LOG_DIR> -XX:MaxPermSize=256m org.apache.spark.executor.CoarseGrainedExecutorBackend --driver-url spark://CoarseGrainedScheduler@10.104.90.41:26087 --executor-id 2 --hostname datanode01-bi-dev --cores 1 --app-id application_1476081972773_0194 --user-class-path file:$PWD/__app__.jar 1> <LOG_DIR>/stdout 2> <LOG_DIR>/stderr
.......
.......
Traceback (most recent call last):
  File "pi.py", line 39, in <module>
    count = sc.parallelize(range(1, n + 1), partitions).map(f).reduce(add)
  File "/usr/local/spark-2.0.0-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/rdd.py", line 802, in reduce
  File "/usr/local/spark-2.0.0-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/rdd.py", line 776, in collect
  File "/usr/local/spark-2.0.0-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/rdd.py", line 2403, in _jrdd
  File "/usr/local/spark-2.0.0-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/rdd.py", line 2338, in _wrap_function
  TypeError: 'JavaPackage' object is not callable

很明显,yarn使用Spark 2.0启动了执行器,导致了作业失败的问题。

我检查了我能想到的与spark环境设置相关的每个角落,但我找不到spark 2.0。

在~/

。bashrc,我有:

export PYTHONPATH=$SPARK_HOME/python/lib/py4j-0.9-src.zip:$PYTHONPATH
export SPARK_HOME=/usr/local/spark-2.0.0-bin-hadoop2.6

下面的命令给出空结果:

grep -rnw /usr/local/spark-1.6.1-bin-hadoop2.6 -e spark-2.0.0-bin-hadoop2.6 
grep -rnw /usr/local/hadoop-2.6.3 -e spark-2.0.0-bin-hadoop2.6

我在namenode和datanode上尝试了上述场景,结果却相同。

但是,java Pi的例子可以成功运行。

spark-submit --master yarn --deploy-mode cluster --class org.apache.spark.examples.SparkPi /usr/local/spark-1.6.1-bin-hadoop2.6/lib/spark-examples-1.6.1-hadoop2.6.0.jar 100
谁能告诉我为什么yarn加载错误版本的spark?

更新:

这个问题实际上是由于我的PATH被弄乱了。因此,在我清理路径并将spark 2.0设置为spark submit的默认版本之后。

首先注释掉您的.bashrc导出并从环境中删除它们-它们是不兼容的。PYTHONPATH使用spark 1.6 lib, SPARK_HOME使用spark 2.0。

然后在两个版本上使用spark-submit的绝对路径运行示例- spark-submit根据其位置设置SPARK_HOME,因此它应该在两个版本中都工作。

相关内容

  • 没有找到相关文章

最新更新