This is a translation of the original English documentation page. Help us make it better.

5 TimescaleDB beállítása

Áttekintés

A Zabbix támogatja a TimescaleDB-t, a PostgreSQL-alapú adatbázis-megoldást az adatok automatikus particionálása időalapú darabokra a gyorsabb támogatás érdekében méretarányos teljesítmény.

Jelenleg a TimescaleDB-t a Zabbix nem támogatja meghatalmazott.

Az ezen az oldalon található utasítások felhasználhatók TimescaleDB adatbázis létrehozásához vagy a meglévő PostgreSQL-táblákról a TimescaleDB-be való áttelepítés.

Configuration

We assume that TimescaleDB extension has been already installed on the database server (see installation instructions).

TimescaleDB extension must also be enabled for the specific DB by executing:

echo "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" | sudo -u postgres psql zabbix

Running this command requires database administrator privileges.

If you use a database schema other than 'public' you need to add a SCHEMA clause to the command above. E.g.:
echo "CREATE EXTENSION IF NOT EXISTS timescaledb SCHEMA yourschema CASCADE;" | sudo -u postgres psql zabbix

Then run the timescaledb.sql script located in database/postgresql. For new installations the script must be run after the regular PostgreSQL database has been created with initial schema/data (see database creation):

cat /usr/share/zabbix-sql-scripts/postgresql/timescaledb.sql | sudo -u zabbix psql zabbix

The migration of existing history and trend data may take a lot of time. Zabbix server and frontend must be down for the period of migration.

The timescaledb.sql script sets the following housekeeping parameters:

  • Override item history period
  • Override item trend period

In order to use partitioned housekeeping for history and trends, both these options must be enabled. It is also possible to enable override individually either for history only or trends only.

For PostgreSQL version 10.2 or higher and TimescaleDB version 1.5 or higher, the timescaledb.sql script sets two additional parameters:

  • Enable compression
  • Compress records older than 7 days

A tömörítés csak akkor használható, ha mindkét Elemelőzmények időszakának felülbírálása és a Tételtrend-időszak felülbírálása opciók engedélyezve vannak. Ha a felülírás le van tiltva, és a táblákban vannak tömörített darabok, a házvezetőnő nem távolítja el az adatokat ezekből a táblázatokból, és a hibás konfigurációra vonatkozó figyelmeztetések jelennek meg az adminisztrációs képernyőn Housekeeping és a System information szakasz.

Mindezek a paraméterek módosíthatók az AdminisztrációÁltalános → menüpontban Háztartás a telepítés után.

Érdemes lehet futtatni a timescaledb-tune eszközt a TimescaleDB segítségével a PostgreSQL konfigurációs paramétereinek optimalizálásához postgresql.conf.

TimescaleDB compression

Native TimescaleDB compression is supported starting from Zabbix 5.0 for PostgreSQL version 10.2 or higher and TimescaleDB version 1.5 or higher for all Zabbix tables that are managed by TimescaleDB. During the upgrade or migration to TimescaleDB, initial compression of the large tables may take a lot of time.

Note that compression is supported under the "timescale" Timescale Community license and it is not supported under "apache" Apache 2.0 license. Starting with Zabbix 6.0.7, Zabbix detects if compression is supported. If it is not supported a warning message is written into the Zabbix server log and users cannot enable compression in the frontend.

Users are encouraged to get familiar with TimescaleDB compression documentation before using compression.

Note, that there are certain limitations imposed by compression, specifically:

  • Compressed chunk modifications (inserts, deletes, updates) are not allowed
  • Schema changes for compressed tables are not allowed.

Compression settings can be changed in the History and trends compression block in AdministrationGeneralHousekeeping section of Zabbix frontend.

Parameter Default Comments
Enable compression Enabled Checking or unchecking the checkbox does not activate/deactivate compression immediately. Because compression is handled by the Housekeeper, the changes will take effect in up to 2 times HousekeepingFrequency hours (set in zabbix_server.conf)

After disabling compression, new chunks that fall into the compression period will not be compressed. However, all previously compressed data will stay compressed. To uncompress previously compressed chunks, follow instructions in TimescaleDB documentation.

When upgrading from older versions of Zabbix with TimescaleDB support, compression will not be enabled by default.
Compress records older than 7d This parameter cannot be less than 7 days.

Due to immutability of compressed chunks all late data (e.g. data delayed by a proxy) that is older than this value will be discarded.