在亚马逊 EMR 上通过 spark-submit 添加 postgresql jar [英] Adding postgresql jar though spark-submit on amazon EMR

查看:40
本文介绍了在亚马逊 EMR 上通过 spark-submit 添加 postgresql jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过使用 --driver-class-path 和 --jars 进行 spark-submit 并尝试过这种方法 https://petz2000.wordpress.com/2015/08/18/get-blas-working-with-spark-on-amazon-emr/

I've tried spark-submit with --driver-class-path, with --jars as well as tried this method https://petz2000.wordpress.com/2015/08/18/get-blas-working-with-spark-on-amazon-emr/

在命令行中使用 SPARK_CLASSPATH 就像在

On using SPARK_CLASSPATH in the commandline as in

SPARK_CLASSPATH=/home/hadoop/pg_jars/postgresql-9.4.1208.jre7.jar pyspark

我收到此错误

Found both spark.executor.extraClassPath and SPARK_CLASSPATH. Use only the former.

但是我无法添加它.如何添加 postgresql JDBC jar 文件以从 pyspark 使用它?我使用的是 EMR 4.2 版

But I'm not able to add it. How do I add postgresql JDBC jar file to use it from pyspark? I'm using EMR version 4.2

谢谢

推荐答案

1) 清除环境变量:

unset SPARK_CLASSPATH

2) 使用 --jars 选项在您的集群上分发 postgres 驱动程序:

2) Use --jars option to distribute postgres driver over your cluster:

pyspark --jars=/home/hadoop/pg_jars/postgresql-9.4.1208.jre7.jar
//or
spark-submit --jars=/home/hadoop/pg_jars/postgresql-9.4.1208.jre7.jar <your py script or app jar>

这篇关于在亚马逊 EMR 上通过 spark-submit 添加 postgresql jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆