使用受到限制
—jars
:如果要为位置指定目录
jar/xml
文件,它不允许目录扩展。这意味着如果您需要为每个jar指定绝对路径。
如果你指定
—driver-class-path
并且您正在纱线群集模式下执行,然后驱动程序类不会更新。我们可以在选项卡环境下验证spark ui或spark history server下的类路径是否更新。
对我来说通过包含目录扩展并在纱线集群模式下工作的罐子的选项是
—conf
选项。传递驱动程序和执行程序类路径更好
—conf
,它将它们添加到spark会话对象本身,这些路径反映在Spark配置上。但请确保将jar放在整个群集的相同路径上。
spark-submit \
—master yarn \
—queue spark_queue \
—deploy-mode cluster \
—num-executors 12 \
—executor-memory 4g \
—driver-memory 8g \
—executor-cores 4 \
—conf spark.ui.enabled=False \
—conf spark.driver.extraClassPath=/usr/hdp/current/hbase-master/lib/hbase-server.jar:/usr/hdp/current/hbase-master/lib/hbase-common.jar:/usr/hdp/current/hbase-master/lib/hbase-client.jar:/usr/hdp/current/hbase-master/lib/zookeeper.jar:/usr/hdp/current/hbase-master/lib/hbase-protocol.jar:/usr/hdp/current/spark2-thriftserver/examples/jars/scopt_2.11-3.3.0.jar:/usr/hdp/current/spark2-thriftserver/examples/jars/spark-examples_2.10-1.1.0.jar:/etc/hbase/conf \
—conf spark.hadoop.mapred.output.dir=/tmp \
—conf spark.executor.extraClassPath=/usr/hdp/current/hbase-master/lib/hbase-server.jar:/usr/hdp/current/hbase-master/lib/hbase-common.jar:/usr/hdp/current/hbase-master/lib/hbase-client.jar:/usr/hdp/current/hbase-master/lib/zookeeper.jar:/usr/hdp/current/hbase-master/lib/hbase-protocol.jar:/usr/hdp/current/spark2-thriftserver/examples/jars/scopt_2.11-3.3.0.jar:/usr/hdp/current/spark2-thriftserver/examples/jars/spark-examples_2.10-1.1.0.jar:/etc/hbase/conf \
—conf spark.hadoop.mapreduce.output.fileoutputformat.outputdir=/tmp
</code>