kon*_*ify 8 postgresql migration postgis
我需要将一个非常大(约 320 GB)的 PostGIS 数据库从server1(PostgreSQL 9.1,PostGIS 1.5)移动并升级到server2(PostgreSQL 9.3,PostGIS 2.1)。
升级过程有据可查。问题是我在server1上没有足够的空间将文件转储到那里,校验它,然后将它复制到server2并验证总和。我试过:
nc
。sshfs
。两次转储文件似乎都已损坏。pg_restore
在不同的地方打破了这样的错误:
pg_restore: [compress_io] could not uncompress data: incorrect data check
任何人都可以提出更好的方法来完成此移动和升级吗?
更新:尝试过 NFS(并再次尝试 SSHFS)。很明显,这些远程文件系统无法可靠地传输这么多数据。生成的 SQL 文件中明显缺少块,导致导入过程中出现如下语法错误:
ERROR: invalid input syntax for integer: "8266UPDATE spatial_ref_sys o set auth_name = n.auth_name, auth_srid = n.auth_srid, srtext = n.srtext, proj4text = n.proj4text FROM _pgis_restore_spatial_ref_sys n WHERE o.srid = n.srid;"
Run Code Online (Sandbox Code Playgroud)
我建议像这样从新的 9.3 服务器转储 9.1 数据库:
pg_dump -h remoteserver -U remoteuser remotedbname -Fc -f my_old_server_backup.dump
Run Code Online (Sandbox Code Playgroud)
我建议使用 9.3,pg_dump
因为pg_dump
它总是向后兼容,但不向前兼容。换句话说,较新的pg_dump
将处理新服务器要求旧实用程序不知道的任何语法更改。
请务必确保您的pg_hba.conf
和listen_addresses
inpostgresql.conf
设置为允许您远程连接和适当地转储。
如果你想一步尝试转储和恢复,你也可以试试这个:
pg_dump -h remotehost -U remoteuser remotedbname | psql -U localuser localdbname
Run Code Online (Sandbox Code Playgroud)
希望有帮助。=)