在Azure上更新本地Dockerized Postgress DB
我有一台未更新的本地Postgres服务器,在Docker容器上运行,现在我想更新Production DB中的所有新记录, 在Azure Postgres DB上运行。
我知道pg_dump 但是,我不清楚我应该在哪里赞扬 - Azure DB不知道本地的DB,反之亦然?
I have an un-updated local Postgres server, running on a docker container, now I want to update all new records from Production DB,
which runs on Azure Postgres DB.
I'm aware of the pg_dump as in this Answer
but, I'm not clear where should I commend it - the Azure DB doesn't know the Local one and vice versa?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试多种方法。
最常见,最简单的方法是使用
pg_dump
和pg_restore
命令bash
以升级数据库。在上述方法中,您首先使用pg_dump从源服务器创建一个转储。然后,您使用pg_restore将转储文件还原到目标服务器。
要备份现有的PostgreSQL数据库,请运行以下命令:
pg_dump -fc -v -v -host =< host> - username =< name> -dbname =<数据库名称> -f< database> .dump
创建文件后,将其下载在本地环境中。
创建目标数据库后,可以使用PG_Restore命令和-DBNAME参数将数据从转储文件还原到目标数据库。
pg_restore -v -no所有者 - honst =<服务器名称> -port =< port> - username =<用户名> -dbname =< target数据库名称>.dump
To find more upgrade methods, you can refer
要获取有关
pg_dump
和pg_restore
methood的更多详细信息,请参阅Microsoft官方文档使用转储和还原迁移您的PostgreSQL数据库。There are multiple methods which you can try.
The most common and simple approach is to use
pg_dump
andpg_restore
commands inbash
to upgrade the database.In above mentioned method, you first create a dump from the source server using pg_dump. Then you restore that dump file to the target server using pg_restore.
To back up an existing PostgreSQL database, run the following command:
pg_dump -Fc -v --host=<host> --username=<name> --dbname=<database name> -f <database>.dump
Once the file has been created, download it in local environment.
After you've created the target database, you can use the pg_restore command and the --dbname parameter to restore the data into the target database from the dump file.
pg_restore -v --no-owner --host=<server name> --port=<port> --username=<user-name> --dbname=<target database name> <database>.dump
To find more upgrade methods, you can refer https://learn.microsoft.com/en-us/azure/postgresql/how-to-upgrade-using-dump-and-restore#method-1-using-pg_dump-and-psql.
To get more details on
pg_dump
andpg_restore
methood, please refer Microsoft Official document Migrate your PostgreSQL database by using dump and restore.