有人能在spark-submit脚本中解释一下--packages和--jars之间的区别吗?
nohup ./bin/spark-submit --jars ./xxx/extrajars/stanford-corenlp-3.8.0.jar,./xxx/extrajars/stanford-parser-3.8.0.jar \
--packages datastax:spark-cassandra-connector_2.11:2.0.7 \
--class xxx.mlserver.Application \
--conf spark.cassandra.connection.host=192.168.0.33 \
--conf spark.cores.max=4 \
--master spark://192.168.0.141:7077 ./xxx/xxxanalysis-mlserver-0.1.0.jar 1000 > ./logs/nohup.out &另外,如果依赖项在我的应用程序pom.xml中,我是否需要--packages配置?(我这么问是因为我刚刚在--packages中更改了版本,却忘了在pom.xml中更改,从而毁掉了我的应用程序)
我目前使用--jars是因为jar很大(超过100 am ),因此会减慢阴影jar的编译速度。我承认我不确定我为什么要使用--packages,除了因为我在遵循datastax文档
发布于 2018-07-20 12:23:16
如果您执行spark-submit --help,它将显示:
--jars JARS Comma-separated list of jars to include on the driver
and executor classpaths.
--packages Comma-separated list of maven coordinates of jars to include
on the driver and executor classpaths. Will search the local
maven repo, then maven central and any additional remote
repositories given by --repositories. The format for the
coordinates should be groupId:artifactId:version.如果是--jars
然后
spark不会命中maven,但它会在本地文件系统中搜索指定的jar,它还支持以下URL方案hdfs/http/https/ftp。
因此,如果是--packages
然后,
将在本地maven存储库、中央maven存储库或由--repositories提供的任何存储库中搜索特定的包,然后下载它。
现在回到你的问题上:
另外,如果依赖项在我的应用程序pom.xml中,我是否需要--packages配置?
JDBC :如果您不是直接在jar中导入/使用类,但需要通过一些类加载器或服务加载器(例如驱动程序)加载类,则不需要。是的,不然。
顺便说一句,如果你在你的pom.xml中使用特定jar的特定版本,那么为什么不把你的应用程序制作成更高/更高版本的jar,或者在中提供依赖jar --jars参数呢?不使用--packages
参考链接:
spark advanced-dependency-management
https://stackoverflow.com/questions/51434808
复制相似问题