我使用在bash脚本中指定的spark-submit为:
CLUSTER_OPTIONS=" \
--master yarn-cluster \
--files file:///${CONF_DIR}/app.conf#app.conf,file:///${CONF_DIR}/log4j-executor.xml#log4j.xml \
--conf "spark.executor.extraJavaOptions=-Dlog4j.configuration=file:log4j.xml" \
--driver-java-options '-Dlog4j.configuration=file:log4j.xml -Dconfig.file=app.conf' \
--keytab ${KEYTAB} \
--principal ${PRINCIPAL} \
"
Run Code Online (Sandbox Code Playgroud)
我收到此错误消息时发现应用程序配置文件没有被提取:
Error: Unrecognized option: -Dconfig.file=file:app.conf'
Run Code Online (Sandbox Code Playgroud)
我还尝试了不同的方法来封装driver-java-options:
1)
--driver-java-options \"-Dlog4j.configuration=file:log4j.xml -Dconfig.file=app.conf\" \
Error: Unrecognized option: -Dconfig.file=file:app.conf"
Run Code Online (Sandbox Code Playgroud)
2)
--driver-java-options "-Dlog4j.configuration=file:log4j.xml -Dconfig.file=file:transformation.conf" \
./start_app.sh: line 30: -Dconfig.file=file:app.conf --keytab /app/conf/keytab/principal.keytab --principal principal : No such file or directory
Run Code Online (Sandbox Code Playgroud)
如何指定供我的Spark应用程序使用的多个driver-java-options?
注意我正在使用Spark 1.5.0
小智 6
尝试使用:
--conf "spark.driver.extraJavaOptions=-Dlog4j.configuration=log4j.xml -Dconfig.file=app.conf"
Run Code Online (Sandbox Code Playgroud)
就我而言,它与--files一起使用时效果很好
您可能要添加:
--conf "spark.executor.extraJavaOptions=...."
Run Code Online (Sandbox Code Playgroud)
如果从执行程序访问文件
希望对您有所帮助
只是写这个因为它太奇怪了。我使它起作用的方式,直到我将--driver-java-options作为所有参数的第一个。我将其照原样保留,以便您完整了解。
使用pyspark本地模式
/opt/apache-spark/spark-2.3.0-bin-hadoop2.7/bin/spark-submit \
--driver-java-options "-Xms2G -Doracle.jdbc.Trace=true -Djava.util.logging.config.file=/opt/apache-spark/spark-2.3.0-bin-hadoop2.7/conf/oraclejdbclog.properties -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=1098 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.net.preferIPv4Stack=true -Djava.rmi.server.hostname=192.168.2.120 -Dcom.sun.management.jmxremote.rmi.port=1095" \
--driver-memory $_driver_memory \
--executor-memory $_executor_memory \
--total-executor-cores $_total_executor_cores \
--verbose \
--jars /opt/apache-spark/jars/log4j-1.2.17.jar main.py \
--dbprefix $1 \
--copyfrom $2
Run Code Online (Sandbox Code Playgroud)
希望这对某人有帮助。
在 Spark 2.3.0 中工作 2018
spark2-submit \
--class com.demo.Main \
--master yarn --deploy-mode client \
--driver-memory 10G --driver-cores 8 --executor-memory 13G --executor-cores 4 \
--num-executors 10 \
--verbose \
--conf "spark.driver.extraJavaOptions=-Dconfig.file=/$HOME/application.conf -Dlog4j.configuration=$HOME/log4j.properties" \
--conf "spark.executor.extraJavaOptions=-Dconfig.file=$HOME/application.conf -Dlog4j.configuration=$HOME/log4j.properties" \
--files "application.conf,log4j.properties" \
$HOME/ingestion-1.0-SNAPSHOT-jar-with-dependencies.jar
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7279 次 |
| 最近记录: |