简体   繁体   English

将本地 postgres 数据库迁移到 aws rds 上的 postgres 实例的步骤是什么?

[英]What are the steps to migrate a local postgres database to a postgres instance on aws rds?

I have a 4GB local postgres database that I want to migrate to an AWS RDS database instance.我有一个 4GB 的本地 postgres 数据库,我想将它迁移到 AWS RDS 数据库实例。

Here is what I have done:这是我所做的:

  1. On the aws rds console, I created a database instance called "testdatabase"在 aws rds 控制台上,我创建了一个名为“testdatabase”的数据库实例

  2. I added my IP address to a security group to allow for inbounding traffic.我将我的 IP 地址添加到安全组以允许入站流量。

  3. I dumped my database to a file using the following command:我使用以下命令将数据库转储到文件中:

pg_dump -U postgres --dbname=TestDatabase -f C:\Users\lucag\Documents\Work\Data\DatabaseDumps\Descriptive_Dumps\rds\rds_initial.sql pg_dump -U postgres --dbname=TestDatabase -f C:\Users\lucag\Documents\Work\Data\DatabaseDumps\Descriptive_Dumps\rds\rds_initial.sql

  1. I then try to use psql to push this dump to the aws rds database instance I have created然后我尝试使用 psql 将此转储推送到我创建的 aws rds 数据库实例

psql -f C:\Users\lucag\Documents\Work\Data\DatabaseDumps\Descriptive_Dumps\rds\rds_initial.sql --host testdatabase.xxxxxxxxxxx.us-east-2.rds.amazonaws.com --port 5432 --username postgres --password secretpassword --dbname testdatabase psql -f C:\Users\lucag\Documents\Work\Data\DatabaseDumps\Descriptive_Dumps\rds\rds_initial.sql --host testdatabase.xxxxxxxxxxx.us-east-2.rds.amazonaws.com --port 5432 --username postgres --password secretpassword --dbname testdatabase

When I try to run this last command, it first tells me that "extra command line arguments: '--dbname' and 'testdatabase'" will be ignored.当我尝试运行最后一个命令时,它首先告诉我“额外的命令行 arguments:'--dbname' 和 'testdatabase'”将被忽略。 Then it spits out this error:然后它吐出这个错误:

psql: error: could not connect to server: could not connect to server: Connection timed out (0x0000274C/10060)
        Is the server running on host "testdatabase.xxxxxxxxxxx.us-east-2.rds.amazonaws.com" (172.31.2.110) and accepting
        TCP/IP connections on port 5432?

I do not understand this error because I would have thought that my step 2 would resolve it.我不明白这个错误,因为我认为我的第 2 步会解决它。 In fact the security group is set up to allow all types of traffic, all protocols, and all ports from my specific IP address.事实上,安全组设置为允许来自我的特定 IP 地址的所有类型的流量、所有协议和所有端口。

What am I missing?我错过了什么?

In order to migrate to RDS you can use the AWS Database Migration Service (DMS) which takes care of a lot of the heavy lifting for you.为了迁移到 RDS,您可以使用 AWS Database Migration Service (DMS),它可以为您处理很多繁重的工作。

This article walks you through the steps for migrating an on-premises PostgreSQL database to Amazon RDS using AWS DMS: Migrate an on-premises PostgreSQL database to Amazon RDS for PostgreSQL本文将引导您完成使用 AWS DMS 将本地 PostgreSQL 数据库迁移到 Amazon RDS 的步骤: 将本地 PostgreSQL 数据库迁移到 Amazon RDS for PostgreSQL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM