2017-04-05 35 views
0

我有一個Postgres數據庫,我已經能夠轉儲和恢復等Postgres的使用沒有問題,安裝:進口的Postgres數據庫到新的AWS

pg_dump the_db_name > the_backup.sql 

備份然後複製到開發服務器,恢復使用:

psql the_new_dev_db < the_backup.sql 

h/t to this link for that gem.

我還能夠安裝和配置EC2,S3和EB(彈性魔豆)安裝的WordPress,紅寶石節點js需要。但是,我正在盯着試圖將postgres數據庫導入amazon rds實例的深淵。我懷疑這不是一個psql問題,而是一個安全問題。任何建議什麼嘗試我會不勝感激。

我使用.pem文件連接到aws。

我可以配置pgAdmin以使用ssh隧道連接到我的rds實例。

使用PSQL nor can I configure pgAdmin to connect to my db in the way AWS recommends.

在這兩種情況下,我得到的錯誤,我不能連接到我的Postgres數據庫在AWS:

psql: could not connect to server: Connection timed out 
    Is the server running on host "xxxxxxx.us-west-2.rds.amazonaws.com" (xx.xx.xx.xx) and accepting 
    TCP/IP connections on port 5432? 

在RDS儀表板我看到我的情況是兩個安全的一部分組。當我點擊一個鏈接後,說:

Your account does not support the EC2-Classic Platform in this region. DB Security Groups are only needed when the EC2-Classic Platform is supported. Instead, use VPC Security Groups to control access to your DB Instances. Go to the EC2 Console to view and manage your VPC Security Groups. For more information, see AWS Documentation on Supported Platforms and Using RDS in VPC 

當我點擊其他安全組,並去其入境標籤我看到有兩個引用,顯示PostgreSQL是在端口接收TCP 5432

而且RDS儀表板我看到我有一個VPC ID,but after reading this article,我不確定要走哪條路,因爲沒有「支持的平臺」字段。

如果我嘗試做從工作在配置pgAdmin的,我收到了類似的消息,作爲連接一個恢復:

pg_restore: [archiver (db)] connection to database "ebdb" failed: could not connect to server: Connection timed out 
    Is the server running on host "XXXX.us-west-2.rds.amazonaws.com" (54.148.0.217) and accepting 
    TCP/IP connections on port 5432? 

最後,我試圖調出控制檯PSQL在DB中pgAdmin的。它配備了,我可以像運行psql的命令:

ebdb=> \conninfo 
You are connected to database "ebdb" as user "awsuser" on host "127.0.0.1" at port "34883". 
SSL connection (protocol: TLSv1.2, cipher: XXXX, bits: 256, compression: off) 

但是,如果我嘗試pg_restore的跑這裏來使用這個命令:

ebdb=> \! /usr/bin/pg_restore --dbname "ebdb" --section pre-data --section data --section post-data --create --clean --verbose "/home/awsuser/040517.backup" 

它不會產生任何表格或推的任何數據。控制檯放下並閃爍所有的SQL命令和數據,就像它工作一樣,但是當我回到pgAdmin並看它仍然是空的。

回答

0

我能夠通過添加彈性beanstalk服務器的安全組作爲我的postgres入站流量的源來獲取使用上述pg_restore命令導入的數據庫。

EC2控制檯\安全組\入站 我有PostgresQL和端口5432,但需要將eb服務器的安全組sg-xxxx添加到源字段中。

對新錯誤!