Restoring Zabbix from backup

To do the DB dump, we used pg_dump to connect to the old server from the new server, however this requires the old server being configured to allow connections over the network. Depending on the size of your database, this could take quite a long time.
# pg_dump -h [ZABBIX SERVER] -U [ZABBIX DB USER] > /tmp/zabbix_dump.sql

After the dump completes, we\x92ll use psql to reload the data into a new database. This database will need to be created first via psql or other postgresql administration means. I\x92m also creating the zabbix role when I create the database \x96 update the password as necessary in the create role command.
sudo -u postgres psql

postgres=# create database zabbix;
postgres=# \c zabbix
postgres=# create role zabbix with password 'zabbix';
postgres=# ALTER ROLE zabbix LOGIN;

We\x92ve called the database zabbix in this example, so I\x92m loading the data from the zabbix_dump.sql file into the zabbix database.
sudo -u postgres psql -dzabbix -f /tmp/zabbix_dump.sql

After the data is loaded in, you will need to start Zabbix so that it recognises the data has been loaded in.
sudo systemctl start zabbix-server.service

It's time to edit /etc/php.ini to set the timezone and some parameters:

date.timezone = UTC

We must give permission to zabbix user to access the DB
sudo vim /var/lib/pgsql/data/pg_hba.conf

local   zabbix      zabbix                            md5
host    zabbix      zabbix      127.0.0.1/32          md5
host    zabbix      zabbix      ::1/128               md5

sudo systemctl restart postgresql.service
sudo systemctl restart httpd.service
sudo systemctl restart zabbix-server-pgsql.service
sudo systemctl enable zabbix-server-pgsql.service

Follow the indications in http://localhost/zabbix to setup the zabbix agent.
Topic revision: r1 - 05 Jun 2018, AndrewColson
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback