一年多以来,我一直在运行一个充满 OSM 数据的内部 PostGIS 服务器,用于基于 Mapnik 的瓦片生成和基于 Nominatim 的地理编码,并使用日复制更新。这很好用。
然而,随着使用量呈指数级增长,我希望通过添加额外的 PostgreSQL 服务器来实现更好的可靠性和性能。我有点迷失了。
由于 PostgreSQL 似乎不能自己处理复制,我会考虑使用像 PgPool-II 这样的中间件来保持服务器同步。但恐怕对于这种用法来说,这只是必要的:非常高的读写比率,所有写入每天都在同一确切时间完成。
我的问题很简单:你会怎么做才能使这些服务器保持同步?而且,OpenStreetMap Foundation、MapQuest、Mapbox 或 CloudMade 为此做了什么?
谢谢。
我有一个 TileMill/PostGIS 堆栈在 OpenStack 云上的 8 核 Ubuntu 12.04 VM 上运行。这是一个非常相似的系统的重建,该系统上周在非常相似的硬件(相同的云,但不同的物理硬件,我相信)上运行良好。我试图重建与原来完全相同的堆栈(使用我构建的一些脚本)。
一切都在运行,但数据库执行查询的速度非常缓慢,这最终表现为非常缓慢的 tile 生成。一个示例查询(计算澳大利亚每个城镇半径内的酒吧数量),以前需要 10-20 秒,现在需要 10 多分钟:
explain (analyze, buffers) update places set pubs =
(select count(*) from planet_osm_point p where p.amenity = 'pub' and st_dwithin(p.way,places.way,scope)) +
(select count(*) from planet_osm_polygon p where p.amenity = 'pub' and st_dwithin(p.way,places.way,scope)) ;
Update on places (cost=0.00..948254806.93 rows=9037 width=160) (actual time=623321.558..623321.558 rows=0 loops=1)
Buffers: shared hit=132126300
-> Seq Scan on places (cost=0.00..948254806.93 rows=9037 width=160) (actual time=68.130..622931.130 rows=9037 loops=1)
Buffers: shared hit=132107781
SubPlan 1 …Run Code Online (Sandbox Code Playgroud) 我们在windows下有一个postgres-databse,就是9.1版本。我们想转储数据并在运行 Postgres 8.4 的 Linux 服务器下导入。数据包括带有 Postgis 的空间数据。
问题是,转储不会导入,因为它使用诸如“CREATE EXTENSION ..”之类的命令,这些命令在较旧的 Postgres 上无法理解。有没有办法在这些数据库之间传输数据?
这是我的情况:
ALTER EXTENSION postgis UPGRADE TO '2.2.0';)。这似乎有效(在安装了 postgis 的两个数据库上都select postgis_full_version()显示POSTGIS="2.2.0 r14208" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 2.0.1, released 2015/09/15" LIBXML="2.9.3" LIBJSON="0.11" RASTER了),尽管旧的postgis-2.1.so留在了 lib 目录中。pg_upgrade. pg_upgrade失败:您的安装引用了新安装中缺少的可加载库。您可以将这些库添加到新安装中,或者从旧安装中删除使用它们的功能。问题库列表在文件中:loadable_libraries.txt
loadable_libraries.txt 包含:
无法加载库“$libdir/rtpostgis-2.1”错误:无法访问文件“$libdir/rtpostgis-2.1”:没有这样的文件或目录
无法加载库“$libdir/postgis-2.1”错误:无法访问文件“$libdir/postgis-2.1”:没有这样的文件或目录
我不知道为什么新版本的 Postgresql 需要旧版本的 Postgis ......它不应该被删除吗?我从 9.4 的 lib 目录中移动了旧文件postgis-2.1.so和rtpostgis-2.1.so文件,但错误仍然存在。
我还尝试针对 Postgresql 9.5beta2 …
我正在尝试将 9.5 服务器升级到 9.6,并且 pg_upgrade 给了我以下错误:
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
Checking database user is the install user ok
Checking database connection settings ok
Checking for prepared transactions ok
Checking for reg* system OID user data types ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for roles starting with 'pg_' ok
Creating dump of global objects ok
Creating dump of database schemas
ok
Checking for presence of required libraries fatal
Your installation references loadable libraries that …Run Code Online (Sandbox Code Playgroud) 我遵循了本手册:http : //www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/ 我使用 aptitude 安装:
postgis
postgresql-8.4-postgis
Run Code Online (Sandbox Code Playgroud)
但是 .sql 文件中没有脚本 lwpostgis.sql /usr/share/postgresql-8.4-postgis/。
使用 mac OSX Yosemite 10.10.1。我用自制软件卸载并重新安装了 postgres 和 postgis。我知道 postgres 正在寻找 postgis 控制文件的错误位置。还注意到 'which psql' 路径似乎不正确。我如何/在哪里解决这个问题?
查询语句
(9.4.0, server 9.3.5)
ERROR: could not open extension control file "/usr/local/Cellar/postgresql/9.3.5_1/share/postgresql/extension/postgis.control": No such file or directory
Run Code Online (Sandbox Code Playgroud)
find /usr -name postgis.control
/usr/local/Cellar/postgresql/9.4.0/share/postgresql/extension/postgis.control
Run Code Online (Sandbox Code Playgroud)
哪个 psql
/usr/local/bin/psql
Run Code Online (Sandbox Code Playgroud)
哪个 pg_config
/usr/local/bin/pg_config
Run Code Online (Sandbox Code Playgroud)
酿造信息postgis
postgis: stable 2.1.5, HEAD
http://postgis.net
/usr/local/Cellar/postgis/2.1.5 (45 files, 8.6M) *
Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/postgis.rb
Run Code Online (Sandbox Code Playgroud)
酿造信息 postgres
postgresql: stable 9.4.0 (bottled)
http://www.postgresql.org/
Conflicts with: postgres-xc
/usr/local/Cellar/postgresql/9.4.0 (3049 files, 74M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/postgresql.rb
Run Code Online (Sandbox Code Playgroud)
.bashrc …
postgis ×7
postgresql ×7
bottleneck ×1
diagnostic ×1
dump ×1
performance ×1
replication ×1
ubuntu ×1