More

Upgrading Zabbix 7 DB to PostgreSQL17 with Timescaledb 2.17

By Antti Hurme 25/11/2024 No Comments 4 Min Read

With Zabbix release 7.0.6 (Release Notes for Zabbix 7.0.6) both TimescaleDB extension 2.7 (ZBXNEXT-9532) and PostgreSQL 17 (ZBXNEXT-9238) became officially supported. Great! Time to upgrade the homelab environment!

Upgrading to PostgreSQL 17

In my homelab environment, I’ve had PostgreSQL 15 before the upgrade with TimescaleDB extension version 2.15. Always refer to the official PostgreSQL upgrade manual for upgrade paths.

Note that this is for a stand-alone single node PGSQL database, not a postgresql cluster on a Rocky Linux 9 server.
  1. Upgrade your Zabbix Server to 7.0.6
    • dnf update zabbix*
  2. Upgrade your timescaledb extension
  3. Update your PostgreSQL repository
    • yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-$(rpm -E %{rhel})-x86_64/pgdg-redhat-repo-latest.noarch.rpm
    • or edit your vim /etc/yum.repos.d/pgdg-redhat-all.repo and add PostgreSQL 17
  4. Install PostgreSQL17 with your current PostgreSQL database
    • dnf install postgresql17-server postgresql17-contrib
  5. Install TimescaleDB extension for PostgreSQL 17 (Remember to install the same version that you have on your currently running PGSQL Zabbix database!)
    • dnf install timescaledb-2-postgresql-17.x86_64 timescaledb-2-loader-postgresql-17.x86_64
  6. Initialize your PostgreSQL 17 database
    • sudo /usr/pgsql-17/bin/postgresql-17-setup initdb
  7. Run TimescaleDB tune
    • timescaledb-tune --pg-config=/usr/pgsql-17/bin/pg_config
  8. Shutdown Zabbix Server and the old PostgreSQL dabase (Also disable autoboot for the old DB)
    • systemctl stop zabbix-server
      systemctl stop postgresql-15.service
      systemctl disable postgresql-15.service
  9. Upgrade the PostgreSQL Database
    • /usr/pgsql-17/bin/pg_upgrade -b /usr/pgsql-15/bin -B /usr/pgsql-17/bin -d /var/lib/pgsql/15/data -D /var/lib/pgsql/17/data -j 4
    • Note: You will get error messages if you are missing other extensions or they are incorrectly installed and/or loaded before running pg_upgrade
  10. Start PostgreSQL 17 and Zabbix Server
    • systemctl enable --now postgresql-17
      systemctl start zabbix-server

Hopefully everything went smoothly and you now have newest version of PostgreSQL17 and TimescaleDB extension. Once you’ve verified everything is working properly as expected, remove the old PostgreSQL version and database directory.

  • dnf remove postgresql15-server postgresql15-contrib timescaledb-2-postgresql-15.x86_64 timescaledb-2-loader-postgresql-15.x86_64

I

Resources

Timescale Documentation | Install TimescaleDB on Linux

Written By

Who am I? | Linkedin

View All Articles
U
Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.