【发布时间】:2018-08-23 14:30:05
【问题描述】:
我想知道将 AWS Data Pipeline 连接到 Heroku 数据库的可行性。 heroku 数据库存储在 EC2 实例(东部区域)上,并且需要 SSL。
我尝试使用JdbcDatabase 对象打开连接,但每次都遇到问题。
我尝试了以下方法:
{
"id" : "heroku_database",
"name" : "heroku_database",
"type" : "JdbcDatabase",
"jdbcDriverClass" : "org.postgresql.Driver",
"connectionString" : "jdbc:postgresql://#{myHerokuDatabaseHost}:#{myHerokuDatabasePort}/#{myHerokuDatabaseName}",
"jdbcProperties": "ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory",
"username" : "#{myHerokuDatabaseUserName}",
"*password" : "#{*myHerokuDatabasePassword}"
},
结果为:
unable to find valid certification path to requested target
ActivityFailed:SunCertPathBuilderException
还有:
{
"id" : "heroku_database",
"name" : "heroku_database",
"type" : "JdbcDatabase",
"jdbcDriverClass" : "org.postgresql.Driver",
"connectionString" : "jdbc:postgresql://#{myHerokuDatabaseHost}:#{myHerokuDatabasePort}/#{myHerokuDatabaseName}",
"jdbcProperties": "sslmode=require",
"username" : "#{myHerokuDatabaseUserName}",
"*password" : "#{*myHerokuDatabasePassword}"
},
结果为:
amazonaws.datapipeline.database.ConnectionFactory: Unable to establish connection to jdbc:postgresql://ec2-54-235-something-something.compute-1.amazonaws.com:5442/redacted FATAL: no pg_hba.conf entry for host "52.13.105.196", user "redacted", database "redacted", SSL off
启动 -- 我也尝试使用ShellCommandActivity 将 postgres 表从 ec2 实例复制并标准输出到我的 s3 存储桶 -- 但是 ec2 实例不理解 psql 命令:
{
"id": "herokuDatabaseDump",
"name": "herokuDatabaseDump",
"type": "ShellCommandActivity",
"runsOn": {
"ref": "Ec2Instance"
},
"stage": "true",
"stdout": "#{myOutputS3Loc}/#{myOutputFileName}",
"command": "PGPASSWORD=#{*myHerokuDatabasePassword} psql -h #{myHerokuDatabaseHost} -U #{myHerokuDatabaseUserName} -d #{myHerokuDatabaseName} -p #{myHerokuDatabasePort} -t -A -F',' -c 'select * #{myHerokuDatabaseTableName}'"
},
而且我也不能事先 yum 安装 postgres。
同时将 RDS 和 Heroku 作为我们的数据库源很糟糕。关于如何通过数据管道对 heroku postgres db 运行选择查询的任何想法都会有很大帮助。谢谢。
【问题讨论】:
标签: postgresql amazon-web-services jdbc amazon-ec2 amazon-data-pipeline