GeoServer Image Mosaics:PostGIS 索引表上的查询超过最大连接限制
Posted
技术标签:
【中文标题】GeoServer Image Mosaics:PostGIS 索引表上的查询超过最大连接限制【英文标题】:GeoServer Image Mosaics: Queries on PostGIS index tables exceed max connection limit 【发布时间】:2021-11-02 14:54:44 【问题描述】:我已经成功地为时间序列栅格创建了 2 个 Geoserver ImageMosaics,索引是一个 PostGIS 数据库表,在 datastore.properties
文件中定义。属性配置文件的可选参数Connection\ timeout
、max\ connections
等都默认保留。
现在,我遇到了栅格图层的可用性问题,因为从(我假设是)GeoServer 实例到数据库的打开连接数超过了 PostgreSQL 一次 100 个连接的限制。
下面是 PostgreSQL 的 pg_stat_activity;
的部分读数,以显示与数据库的活动连接(替换了一些名称)。
我的问题是,这是否反映了正常行为:
根据datastore.properties
默认值,我预计每个 ImgMosaic 最多只有 10 个连接(这里:image_mosaic_1 有 13 个打开的连接)。此外,所有连接都处于空闲状态,有时长达数小时。
我知道将 JNDI 用于 GeoServer 连接池的选项。但我不确定这是否能解决问题,或者这是否表明 ImgMosaics 的配置错误(或我的理解有误)。
pg_stat_activity 输出(部分)
application_name | backend_start | query_start | state_change | wait_event_type | wait_event | state | query | backend_type |
---|---|---|---|---|---|---|---|---|
PostgreSQL JDBC Driver | 2021-11-02 15:00:42 | 2021-11-02 15:00:48 | 2021-11-02 15:00:48 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:09:59 | 2021-11-02 13:34:58 | 2021-11-02 13:34:58 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:42:59 | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 15:00:42 | 2021-11-02 15:00:49 | 2021-11-02 15:00:49 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:42:33 | 2021-11-02 14:43:01 | 2021-11-02 14:43:01 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:42:59 | 2021-11-02 14:43:01 | 2021-11-02 14:43:01 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:24 | 2021-11-02 13:34:56 | 2021-11-02 13:34:56 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:07 | 2021-11-02 13:34:58 | 2021-11-02 13:34:58 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:43:00 | 2021-11-02 14:43:01 | 2021-11-02 14:43:01 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 15:00:42 | 2021-11-02 15:00:48 | 2021-11-02 15:00:48 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 15:00:42 | 2021-11-02 15:00:42 | 2021-11-02 15:00:42 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_1" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 15:19:58 | 2021-11-02 15:19:59 | 2021-11-02 15:19:59 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_2" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:46 | 2021-11-02 13:54:10 | 2021-11-02 13:54:10 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_2" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:54:06 | 2021-11-02 13:54:10 | 2021-11-02 13:54:10 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_2" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:46 | 2021-11-02 13:54:10 | 2021-11-02 13:54:10 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_2" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:54:06 | 2021-11-02 13:54:31 | 2021-11-02 13:54:31 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_2" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:46 | 2021-11-02 13:28:16 | 2021-11-02 13:28:16 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_2" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 15:19:59 | 2021-11-02 15:20:01 | 2021-11-02 15:20:01 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_2" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:54:06 | 2021-11-02 13:54:10 | 2021-11-02 13:54:10 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_2" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:54:10 | 2021-11-02 13:54:34 | 2021-11-02 13:54:34 | Client | ClientRead | idle | SELECT min("time_stamp") FROM "image_mosaic_schema"."img_mosaic_2" WHERE ("time_stamp" BETWEEN $1 AND $2 AND "time_stamp" > $3) | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:09:59 | 2021-11-02 13:34:58 | 2021-11-02 13:34:58 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:09:59 | 2021-11-02 13:34:58 | 2021-11-02 13:34:58 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:09:59 | 2021-11-02 13:34:58 | 2021-11-02 13:34:58 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:09:59 | 2021-11-02 13:34:50 | 2021-11-02 13:34:50 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 15:19:58 | 2021-11-02 15:20:01 | 2021-11-02 15:20:01 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:42 | 2021-11-02 13:28:16 | 2021-11-02 13:28:16 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:43:00 | 2021-11-02 14:43:01 | 2021-11-02 14:43:01 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:43:00 | 2021-11-02 14:43:01 | 2021-11-02 14:43:01 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:43:00 | 2021-11-02 14:43:01 | 2021-11-02 14:43:01 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | 2021-11-02 14:43:00 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:46 | 2021-11-02 13:28:16 | 2021-11-02 13:28:16 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:46 | 2021-11-02 13:28:16 | 2021-11-02 13:28:16 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:46 | 2021-11-02 13:54:34 | 2021-11-02 13:54:34 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:46 | 2021-11-02 13:28:16 | 2021-11-02 13:28:16 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:10:46 | 2021-11-02 13:54:10 | 2021-11-02 13:54:10 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:17:14 | 2021-11-02 13:34:58 | 2021-11-02 13:34:58 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:28:14 | 2021-11-02 13:28:15 | 2021-11-02 13:28:15 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:28:15 | 2021-11-02 13:28:15 | 2021-11-02 13:28:15 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:28:15 | 2021-11-02 13:28:16 | 2021-11-02 13:28:16 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:28:15 | 2021-11-02 13:28:15 | 2021-11-02 13:28:15 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:28:15 | 2021-11-02 13:28:15 | 2021-11-02 13:28:15 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:28:15 | 2021-11-02 13:28:15 | 2021-11-02 13:28:15 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:54:06 | 2021-11-02 13:54:34 | 2021-11-02 13:54:34 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:54:06 | 2021-11-02 13:54:33 | 2021-11-02 13:54:33 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 13:54:10 | 2021-11-02 13:54:34 | 2021-11-02 13:54:34 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 15:00:42 | 2021-11-02 15:00:49 | 2021-11-02 15:00:49 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 15:00:42 | 2021-11-02 15:00:48 | 2021-11-02 15:00:48 | Client | ClientRead | idle | ROLLBACK | client backend |
PostgreSQL JDBC Driver | 2021-11-02 15:00:42 | 2021-11-02 15:00:48 | 2021-11-02 15:00:48 | Client | ClientRead | idle | ROLLBACK | client backend |
【问题讨论】:
【参考方案1】:GeoServer 使用 Postgis 连接池,因此打开的空闲连接数是正常的。
如果您的 Postgis 服务器速度较慢或其他人大量使用它,您会看到请求超时,首先确保您的 tile 索引表上有一个索引,并且它正在被 GeoServer 所在的查询使用制作(如果您将日志记录到GEOSERVER-DEVELOPER
,这些将出现在日志文件中)。
未能从默认设置连接超时。
【讨论】:
以上是关于GeoServer Image Mosaics:PostGIS 索引表上的查询超过最大连接限制的主要内容,如果未能解决你的问题,请参考以下文章
geoserver发布瓦片,geoserver发布arcgis切片和geoserver发布金字塔切片