当前位置: 首页 > article >正文

全网独家:zabbixV7版本容器服务器无法访问Postgres V17数据库的问题解决

近期将zabbix平台从V6.2.6升级到7.2.4,遇到问题“PostgresoL server is not available. Waiting 5seconds”,容器无法访问Postgres V17数据库,本文记录问题解决过程。

一、系统环境

1、数据库版本

数据库版本:postgres-17.4-timescale-2.17.2,如下:

#  psql -U zabbix  zabbix -h 192.168.128.111  
Password for user zabbix: 
psql (13.3, server 17.4)
WARNING: psql major version 13, server major version 17.
         Some psql features might not work.
Type "help" for help.

zabbix=> \dx
                                                List of installed extensions
    Name     | Version |   Schema   |                                      Description                              
        
-------------+---------+------------+-------------------------------------------------------------------------------
--------
 plpgsql     | 1.0     | pg_catalog | PL/pgSQL procedural language
 timescaledb | 2.17.2  | public     | Enables scalable inserts and complex queries for time-series data (Community E
dition)
(2 rows)

zabbix=> \q

2、zabbix服务器容器版本

zabbix/zabbix-web-apache-pgsql:centos-7.2.4
zabbix/zabbix-server-pgsql:centos-7.2.4

二、报错信息

zabbix服务器连接数据库报错:“PostgresoL server is not available. Waiting 5seconds”

三、问题分析

1、数据库版本是否兼容

 从zabbix官网,可以看到相关数据库版本在兼容清单的

support for PostgreSQL versions:- 17.X  

support for TimescaleDB versions: 2.17.X 

 2、测试数据库外部连接情况
#  psql -U zabbix  zabbix -h 192.168.128.111  
Password for user zabbix: 
psql (13.3, server 17.4)
WARNING: psql major version 13, server major version 17.
         Some psql features might not work.
Type "help" for help.

zabbix=> \dx
                                                List of installed extensions
    Name     | Version |   Schema   |                                      Description                              
        
-------------+---------+------------+-------------------------------------------------------------------------------
--------
 plpgsql     | 1.0     | pg_catalog | PL/pgSQL procedural language
 timescaledb | 2.17.2  | public     | Enables scalable inserts and complex queries for time-series data (Community E
dition)
(2 rows)

zabbix=> \q

 可以看到,数据库外部访问正常,可以查询到库的信息,可以排除数据库自身的问题。

3、问题定位

经过本人全面检查,最终查到本问题是因为zabbix服务器官方容器包的问题。

原因为zabbix使用--list来检查数据库服务是否存活,在容器外本地使用该命令,反馈信息如下:

# psql -U zabbix  zabbix -h 192.168.128.111 --list
Password for user zabbix: 
                             List of databases
   Name    |  Owner   | Encoding  | Collate | Ctype |   Access privileges   
-----------+----------+-----------+---------+-------+-----------------------
 postgres  | postgres | SQL_ASCII | C       | C     | 
 template0 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
 template1 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
 zabbix    | zabbix   | UTF8      | C       | C     | 
(4 rows)

登入zabbix服务器容器,可以看到容器内封装的PostgreSQL客户端版本为16.6,该命令执行反馈信息报错“column d.daticulocale does not exist”:

# docker exec -it zbxsrv /bin/bash
bash-5.1$ psql -V
psql (PostgreSQL) 16.6
bash-5.1$ psql -h 192.168.128.111 -U zabbix -d zabbix --list
Password for user zabbix: 
psql: ERROR:  column d.daticulocale does not exist
LINE 8:   d.daticulocale as "ICU Locale",
          ^
HINT:  Perhaps you meant to reference the column "d.datlocale".
bash-5.1$ cat /etc/centos-release 
CentOS Stream release 9

 且zabbix官方Centos、ubuntu系统容器包都存在此问题。

四、解决办法

使用zabbix官方alpine系统平台的服务器容器镜像。

zabbix/zabbix-server-pgsql:alpine-7.2-latestalpine-7.2-latest(目前实际是7.2.4)

zabbix/zabbix-web-apache-pgsql:alpine-7.2.4

如下:

[root@localhost ~]# docker pull zabbix/zabbix-server-pgsql:alpine-7.2-latest
alpine-7.2-latest: Pulling from zabbix/zabbix-server-pgsql
f18232174bc9: Already exists 
145118636fb4: Pull complete 
2e36442cfc45: Pull complete 
90bbfafe739a: Pull complete 
ff10713dcc30: Pull complete 
39a26e625a05: Pull complete 
4f4fb700ef54: Pull complete 
db0d9b0bdf27: Pull complete 
Digest: sha256:c8db24a3fc509ea4b1a3d9f4ef197e1ee46f2656f586c3c5f9014ca6de61804b
Status: Downloaded newer image for zabbix/zabbix-server-pgsql:alpine-7.2-latest
docker.io/zabbix/zabbix-server-pgsql:alpine-7.2-latest
[root@localhost ~]# docker pull zabbix/zabbix-web-apache-pgsql:alpine-7.2.4
alpine-7.2.4: Pulling from zabbix/zabbix-web-apache-pgsql
f18232174bc9: Already exists 
0068142ce15f: Pull complete 
a2c25e127afd: Pull complete 
0f6189e461cd: Pull complete 
4f4fb700ef54: Pull complete 
5d085b3ca5ae: Pull complete 
Digest: sha256:3e91ca4aad3bd051ed33cdfa343fb9711b9dd5a33518798926af862a9bae4c41
Status: Downloaded newer image for zabbix/zabbix-web-apache-pgsql:alpine-7.2.4
docker.io/zabbix/zabbix-web-apache-pgsql:alpine-7.2.4

运行容器,可以看到,服务器已正常连接:

 问题得到解决。


http://www.kler.cn/a/573104.html

相关文章:

  • UNIAPP前端配合thinkphp5后端通过高德API获取当前城市天气预报
  • 磐石云AXB小号平台——安全与隐私的守护者
  • C++第八节:继承
  • 低空监视-无人机专用ADS-B应答机
  • 从数据到决策,永洪科技助力良信电器“智”领未来
  • MWC 2025|美格智能发布基于高通®X85 5G调制解调器及射频的新一代5G-A通信模组SRM819W
  • Jadx Gui 的详细介绍、安装指南、使用方法及配置说明
  • 面向多任务的夜间雾度成像增强器,用于视觉驱动测量系统(Python实现)
  • LINUX网络基础 [一] - 初识网络,理解网络协议
  • 如何利用Python爬虫按图搜索1688商品(拍立淘):实战指南
  • 专项:STM32状态机结构简述
  • Stable Diffusion模型采样方法与参数配置详解(含步数及画风适配表)
  • 在Linux中开发OpenGL——环境搭建
  • 【BFS最短路问题】最小基因变化
  • 服务器数据恢复—raid5阵列中硬盘掉线导致上层应用不可用的数据恢复案例
  • 【MySQL】与MongoDB的区别,字符集,三范式,存储引擎InnoDB、MyISAM
  • 优化cache利用、减少cache miss的方法
  • LLM 模型 Prompt 工程
  • [Computer Vision]图像分割技术
  • Android10.0关于发送广播Sending non-protected broadcast android.price.public.close