【发布时间】:2020-01-02 20:56:47
【问题描述】:
我正在运行一个 Spark SQL 程序,从 S3 和 Redshift 获取数据,加入数据,然后写回 EMR 上的 Redshift。我遇到了一个凭证问题,一旦我查询 Redshift,我就无法再访问 EMR,并且我的程序错误如下:
pyspark.sql.utils.IllegalArgumentException: u'AWS Access Key ID and Secret Access Key must be specified as the username or password (respectively) of a s3 URL, or by setting the fs.s3.awsAccessKeyId or fs.s3.awsSecretAccessKey properties (respectively).'
连接到redshift的代码是:
df.write \
.format("com.databricks.spark.redshift") \
.option("url", rs_jdbc + ":" + rs_port + "/" + rs_db + "?user=" + rs_username + "&password=" + rs_password) \
.option("dbtable", table) \
.option("tempdir", s3_temp_out) \
.mode("error") \
.save(mode='append')
对此的任何帮助将不胜感激
【问题讨论】:
-
请添加访问密钥和密钥以触发会话。 sc._jsc.hadoopConfiguration().set("fs.s3n.awsAccessKeyId", AWS_ACCESS_KEY) sc._jsc.hadoopConfiguration().set("fs.s3n.awsSecretAccessKey", AWS_SECRET_KEY)
-
谢谢,这似乎可以设置“fs.s3.awsAccessKeyId”和“fs.s3.awsSecretAccessKey”,请随时添加答案,我会接受
标签: amazon-s3 pyspark amazon-redshift pyspark-sql amazon-emr