Doctorbal / zabbix-postgres-partitioning

Zabbix PostgreSQL version 11 Native Partitioning
MIT License
43 stars 15 forks source link

Fresh install #7

Closed amar3lo closed 4 years ago

amar3lo commented 4 years ago

how should i proceed on a fresh installation? which step should I import the create.sql?

Doctorbal commented 4 years ago

Excellent question @amar3lo!

I realized I did not mention that in the guide as this was mainly addressed to migrating to a partitioned database from an already running Zabbix instance.

To use partitioning on a fresh install on the following specifications:

  1. Install PostgreSQL v11.
  2. Prepare Zabbix Database.
  3. Create Empty history and trends Tables, install pg_partman, ensure make the necessary changes in the postgresql.conf file, create the partitioned tables. _Alternatively you can use my ansible role to install pg_partman which performs the previous blocks_. Ensure you read the comments in the defaults/main.yml file.
  4. Then import the Zabbix 4.0 schema by performing the following:
    $ cd /tmp
    $ wget https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-3+stretch_all.deb
    $ sudo dpkg -i zabbix-release_4.0-3+stretch_all.deb
    $ sudo apt update
    $ sudo apt-get install --no-install-recommends zabbix-server-pgsql
    # Now import the schema. You will get errors stating some tables and indexes already exist but ignore those as they were purposefully set on the partitioning portion.
    $ zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbix
  5. Continue with the rest of the installation.

Let me know how it goes and if you run into any issues.

All the best, Andreas

amar3lo commented 4 years ago

I have no words to express my gratitude!!! it works like a charm, thank you!

Doctorbal commented 4 years ago

Awesome to hear @amar3lo ! I'm going to add this into the guide as well so others can follow this for a fresh install. Thanks for verifying that it worked seamlessly.