【发布时间】:2020-02-04 16:33:38
【问题描述】:
我正在尝试连接到 Redshift 并从 Glue DevEndpoint 运行简单查询(这是必需的),但似乎无法连接。
以下代码只是超时:
df = spark.read \
.format('jdbc') \
.option("url", "jdbc:redshift://my-redshift-cluster.c512345.us-east-2.redshift.amazonaws.com:5439/dev?user=myuser&password=mypass") \
.option("query", "select distinct(tablename) from pg_table_def where schemaname = 'public'; ") \
.option("tempdir", "s3n://test") \
.option("aws_iam_role", "arn:aws:iam::147912345678:role/my-glue-redshift-role") \
.load()
可能是什么原因?
我检查了 URL、用户、密码,还尝试了不同的 IAM 角色,但每次都挂起..
还尝试不使用 IAM 角色(仅具有已存在的 URL、用户/密码、架构/表)并且还挂起/超时:
jdbcDF = spark.read \
.format("jdbc") \
.option("url", "jdbc:redshift://my-redshift-cluster.c512345.us-east-2.redshift.amazonaws.com:5439/dev") \
.option("dbtable", "public.test") \
.option("user", "myuser") \
.option("password", "mypass") \
.load()
从 S3 或 Glue 表(目录)读取数据(直接在 Glue SSH 终端中)似乎很好,所以我知道 Spark 和 Dataframes 很好,只是与 RedShift 有一些连接但不确定是什么?
【问题讨论】:
-
你有胶水连接吗?您可能需要创建胶水连接,对其进行测试,然后将其添加到您的胶水作业中
-
我有一个连接器,但您如何“将其添加到工作中”?
-
把它移到私有子网怎么样?
标签: amazon-web-services amazon-redshift aws-glue