2021-5-1

问题:因为分配异常,Jar 运行后自动停止

报错内容:

  1. java.lang.IllegalStateException: No current assignment for partition first-0

原因:多个相同的 Spark Streaming 同时消费同一个 topic,导致的 offset 问题。

解决办法:等待程序执行完毕后再依次执行下一个程序。
**

2021-07-12

问题:spark-shell启动失败

  1. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataInputStream
  2. at org.apache.spark.deploy.SparkSubmitArguments$$anonfun$mergeDefaultSparkProperties$1.apply(SparkSubmitArguments.scala:123)
  3. at org.apache.spark.deploy.SparkSubmitArguments$$anonfun$mergeDefaultSparkProperties$1.apply(SparkSubmitArguments.scala:123)
  4. at scala.Option.getOrElse(Option.scala:120)
  5. at org.apache.spark.deploy.SparkSubmitArguments.mergeDefaultSparkProperties(SparkSubmitArguments.scala:123)
  6. at org.apache.spark.deploy.SparkSubmitArguments.<init>(SparkSubmitArguments.scala:109)
  7. at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:114)
  8. at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
  9. Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FSDataInputStream
  10. at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
  11. at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  12. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
  13. at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

image.png
解决:spark-env.sh中添加:
export SPARK_DIST_CLASSPATH=$(/opt/cloudera/parcels/CDH/bin/hadoop classpath)
image.png