为什么pg_restore在AWSECS中静默失败?

考虑这个 pg_restore 命令:

pg_restore -h 123.123.123.123 -d my_database -U my_user --no-owner --no-privileges --no-password -t specific_table 616f6d35-202104.backup

当我在本地运行它时,它可以工作。但是当我运行它时,我的 ECS 实例不会恢复。没有错误,退出代码为 0。

如果我在语句中创建数据库(通过添加 --create 标志并将 my_database 更改为 postgres),如下所示:

pg_restore -h 123.123.123.123 -d postgres -U my_user --create --no-owner --no-privileges --no-password -t specific_table 616f6d35-202104.backup

它仍然在本地工作。当我在 ECS 中运行它时,它会创建数据库但仍然没有恢复表。如果我排除特定表:

pg_restore -h 123.123.123.123 -d my_database -U my_user --no-owner --no-privileges --no-password 616f6d35-202104.backup

然后它起作用了。但它加载了我不想要的整个数据库。所以这与在本地工作但不在我的 ECS 实例中的 -t 标志有关。

编辑:
似乎确实存在版本不匹配。我能得到的最接近的环境是ECS 上的PostgreSQL v10.16和具有 Postgres 服务器 123.123.123.123的目标 EC2 上的 v10.4。仍然不起作用。这可能是问题吗?如果是这样,我如何安装 postgresql 或 postgresql-client 的特定次要版本?

对于 docker 文件中的 ECS,我有:

RUN apt-get update
RUN apt-get install -y curl ca-certificates gnupg
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" | tee /etc/apt/sources.list.d/docker.list
RUN apt-get update
RUN apt-get install -y postgresql-10

这让我在 ECS 上使用 v10.16(仍然不起作用)。但是,如果我更改最后一行以指定特定的次要版本(以更紧密地匹配 EC2 的版本),则无法找到它。

RUN apt-get install -y postgresql-10.5

E: Unable to locate package postgresql-10.5
E: Couldn't find any package by glob 'postgresql-10.5'
E: Couldn't find any package by regex 'postgresql-10.5'

同样,它在本地工作 - 我在本地拥有的版本是 v10.5

EDIT-2:我对此有更多的了解。看起来它输出这两行然后停止 - 仍然没有错误:

pg_restore: connecting to database for restore
pg_restore: implied data-only restore

似乎“隐含的仅数据还原”可能不会引起问题 - 似乎应该有输出。但在我的情况下,输出就停止了。

以上是为什么pg_restore在AWSECS中静默失败?的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>