dav*_*rez 5 postgresql postgresql-9.3
我已经多次使用这种技术在服务器之间传输数据库:
\n\npg_dump --no-owner -Fd mydb -j 4 -f tmp/mydb\nscp -r tmp/mydb otherserver:tmp/\n
Run Code Online (Sandbox Code Playgroud)\n\n然后在另一台服务器中:
\n\ndropdb --if-exists mydb && \ncreatedb -T template0 mydb && \npg_restore -j 4 -d mydb tmp/mydb && \nrm -rf tmp/mydb\n
Run Code Online (Sandbox Code Playgroud)\n\n它运行完美。\n使用 Postgres 9.3.16 和 CentOS 7。
\n\n但现在,在新服务器中,pg_restore 抱怨:
\n\npg_restore: [archiver] parallel restore is not supported with this archive file format\n
Run Code Online (Sandbox Code Playgroud)\n\n我可以删除该-j 4
参数,但理论上它应该是有效的。\n根据pg_restore 文档:
\n\n\n-j 作业数\n --jobs=作业数
\n\n运行 pg_restore \xe2\x80\x94 中最耗时的部分,这些部分使用多个并发作业加载\n 数据、创建索引或创建约束 \xe2\x80\x94。此选项可以显着减少将大型数据库恢复到多处理器计算机上运行的服务器的时间。
\n\n每个作业都是一个进程或一个线程,具体取决于操作系统,并使用与服务器的单独连接。
\n\n此选项的最佳值取决于服务器、客户端和网络的硬件设置。因素包括 CPU 核心数量和磁盘设置。一个好的起点是服务器上的 CPU 核心数,但在许多情况下,大于该值的值也可能导致更快的恢复时间。当然,太高的值会因抖动而导致性能下降。
\n\n此选项仅支持自定义和目录存档格式。\n 输入必须是常规文件或目录(例如,不是管道)。当发出脚本而不是直接连接到数据库服务器时,将忽略此选项。此外,多个作业不能与选项 --single-transaction 一起使用。
\n
我正在使用以下目录格式pg_dump
:-Fd
!\n为什么它会抱怨?
我不知道为什么,但我有作为服务器的 Postgres 9.3 和psql
,pg_restore
并且pg_dump
属于版本 9.2。
/usr/bin/pg_restore 是版本 9.2,但 /usr/pgsql-9.3/bin/pg_dump 是版本 9.3。
这就是问题的原因。
postgresql.x86_64 9.2.18-1.el7 @base
postgresql-devel.x86_64 9.2.18-1.el7 @base
postgresql-libs.x86_64 9.2.18-1.el7 @base
postgresql-odbc.x86_64 09.03.0100-2.el7 @base
postgresql93.x86_64 9.3.17-1PGDG.rhel7 @pgdg93
postgresql93-contrib.x86_64 9.3.17-1PGDG.rhel7 @pgdg93
postgresql93-libs.x86_64 9.3.17-1PGDG.rhel7 @pgdg93
postgresql93-server.x86_64 9.3.17-1PGDG.rhel7 @pgdg93
Run Code Online (Sandbox Code Playgroud)
解决方案很简单:
yum remove postgresql
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2291 次 |
最近记录: |