我正在尝试使用pgsync
gem将数据从本地dev数据库同步到Amazon RDS上运行的测试DB。
我的.pgsync.yml
页面很简单:
from: postgres://localhost:5432/imports_development?sslmode=require
to: [See attempts below]
exclude:
- [A few tables]
我尝试了很多方法,但都不起作用。以下是所有方法和我收到的错误信息:
to: postgres://awsuser:mypassword@imports-test.abcdefg.us-east-1.rds.amazonaws.com/postgres?sslca=config/rds-combined-ca-bundle.pem
=> invalid URI query parameter: "sslca"
to: postgres://awsuser:mypassword@imports-test.abcdefg.us-east-1.rds.amazonaws.com
=> connection to server at "52.4.150.10", port 5432 failed: FATAL: database "awsuser" does not exist
to: $(heroku config:get DATABASE_URL)
=> invalid URI parameter: "sslca"
to: imports-test.abcdefg.us-east-1.rds.amazonaws.com
=> connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: database "imports-test.abcdefg.us-east-1.rds.amazonaws.com" does not exist
以下是database.yml用于RDS数据库的凭据:
rds_db_name: postgres
rds_username: awsuser
rds_password: mypassword
rds_hostname: imports-test.abcdefg.us-east-1.rds.amazonaws.com
rds_port: 5432
我可以用rails console连接到两个数据库,所以只需要正确地使用上面的语句就可以了。
1条答案
按热度按时间rlcwz9us1#
你试过
postgres://awsuser:mypassword@imports-test.abcdefg.us-east-1.rds.amazonaws.com/postgres
吗?第二次尝试似乎可以,但是根据错误,没有包括DB名称。URI的格式大致如下:
?sslca=123
和其他选项AFTER?
(查询字符串)表示选项。并非所有客户端都支持此处的所有选项。