gpt4 book ai didi

apache-spark - EMR LinkageError 上的 Spark + Cassandra

转载 作者:行者123 更新时间:2023-12-04 04:43:32 24 4
gpt4 key购买 nike

我在 EMR 4.4.0 上部署了 Spark 1.6
我正在连接到部署在 EC2 上的 datastax cassandra 2.2.5。

该连接使用 spark-connector 1.4.2_s2.10 将数据保存到 cassandra 中(因为它有 guava 14)但是使用 1.4.2 版本的连接器从 cassandra 读取数据失败。

正确的组合建议使用 1.5.x,因此我开始使用 1.5.0。
首先,我遇到了 Guava 问题,并使用 userClasspathFirst 解决方案修复了它。

spark-shell --conf spark.yarn.executor.memoryOverhead=2048 
--packages datastax:spark-cassandra-connector:1.5.0-s_2.10
--conf spark.cassandra.connection.host=10.236.250.96
--conf spark.executor.extraClassPath=/home/hadoop/lib/guava-16.0.1.jar:/etc/hadoop/conf:/etc/hive/conf:/usr/lib/hadoop-lzo/lib/*:/usr/share/aws/aws-java-sdk/*:/usr/share/aws/emr/emrfs/conf:/usr/share/aws/emr/emrfs/lib/*:/usr/share/aws/emr/emrfs/auxlib/*
--conf spark.driver.extraClassPath=/home/hadoop/lib/guava-16.0.1.jar:/etc/hadoop/conf:/etc/hive/conf:/usr/lib/hadoop-lzo/lib/*:/usr/share/aws/aws-java-sdk/*:/usr/share/aws/emr/emrfs/conf:/usr/share/aws/emr/emrfs/lib/*:/usr/share/aws/emr/emrfs/auxlib/*
--conf spark.driver.userClassPathFirst=true
--conf spark.executor.userClassPathFirst=true

现在我解决了 Guava 16 错误,但是由于我使用的是 userClassPathFirst,我面临另一个冲突,我没有任何方法来解决它。
Lost task 2.1 in stage 2.0 (TID 6, ip-10-187-78-197.ec2.internal): java.lang.LinkageError: 
loader constraint violation: loader (instance of org/apache/spark/util/ChildFirstURLClassLoader) previously initiated loading for a different type with name "org/slf4j/Logger"

当我使用 Java 代码而不是 spark-shell 重复这些步骤时,我遇到了同样的问题。
有什么解决方案可以克服它,或任何其他更清洁的方法?

谢谢!

最佳答案

使用“userClassPathFirst”标志时,我遇到了同样的错误。

从配置中删除这 2 个标志,只需使用“extraClassPath”参数。

详细回答在这里:
https://stackoverflow.com/a/40235289/3487888

关于apache-spark - EMR LinkageError 上的 Spark + Cassandra,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36273337/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com