Backup and Restore Zabbix Server

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Access Spectrum

Backup and Restore Guide for


Zabbix Server

Access Spectrum Co., Ltd.


No. 364/366, Mahabandoola Garden (Barr) Street
Kyauktada Township, Yangon, Myanmar.
Tel: +95 (1) 386567. Fax: +95(1) 380900
URL: http://www.accessspectrum.net
email: [email protected]
Access Spectrum Backup and Restore Zabbix Server

Zabbix Server Backup and Restore Guide


How to Backup Zabbix Server

1. Backup Zabbix components


(1) Stop Zabbix Server
# systemctl stop zabbix-server

(2) Create directories for backup files


# mkdir -p /opt/zabbix_backup/bin_files /opt/zabbix_backup/conf_files /opt/zabbix_backup/doc_files
# mkdir -p /opt/zabbix_backup/web_files /opt/zabbix_backup/db_files

(3) Backup Zabbix binary, doc and conf files


# cp -rp /etc/zabbix/zabbix_server.conf /opt/zabbix_backup/conf_files
# cp -rp /usr/sbin/zabbix_server /opt/zabbix_backup/bin_files
# cp -rp /usr/share/doc/zabbix-* /opt/zabbix_backup/doc_files
# cp -rp /etc/httpd/conf.d/zabbix.conf /opt/zabbix_backup/conf_files 2>/dev/null
# cp -rp /etc/apache2/conf-enabled/zabbix.conf /opt/zabbix_backup/conf_files 2>/dev/null
# cp -rp /etc/zabbix/php-fpm.conf /opt/zabbix_backup/conf_files 2>/dev/null

(4) Backup Zabbix web files (frontend)


# cp -rp /usr/share/zabbix/ /opt/zabbix_backup/web_files

(5) Backup Zabbix database


hostname, user, password and db name

# mysqldump -h localhost -u'root' -p'rootDBpass' --single-transaction 'zabbix' | gzip >


/opt/zabbix_backup/db_files/zabbix_backup.sql.gz

Access Spectrum Page | 1


Access Spectrum Backup and Restore Zabbix Server

2. How to Restore Zabbix Server

(1) Stop Zabbix server


# systemctl stop zabbix-server

(2) Delete database and create a new one with the right permissions
# mysql -u'root' -p'rootDBpass' -e "drop database zabbix"
# mysql -u'root' -p'rootDBpass' -e "create database zabbix character set utf8 collate utf8_bin;"
# mysql -u'root' -p'rootDBpass' -e "grant all privileges on zabbix.* to zabbix@localhost identified by
'zabbixDBpass';"

(3) Import database from the backup


# zcat /opt/zabbix_backup/db_files/zabbix_backup.sql.gz | mysql -h localhost -u'root' -p'rootDBpass'
'zabbix'

(4) Remove Zabbix web and bin files


# rm -rf /usr/sbin/zabbix_server /usr/share/zabbix

(5) Restore files from the backup


# cp -rp /opt/zabbix_backup/conf_files/zabbix_server.conf /etc/zabbix/zabbix_server.conf
# cp -rp /opt/zabbix_backup/bin_files/zabbix_server /usr/sbin/zabbix_server
# cp -rp /opt/zabbix_backup/doc_files/zabbix-* /usr/share/doc/
# cp -rp /opt/zabbix_backup/web_files/zabbix /usr/share/zabbix
# cp -rp /opt/zabbix_backup/conf_files/zabbix.conf /etc/httpd/conf.d/zabbix.conf 2>/dev/null
# cp -rp /opt/zabbix_backup/conf_files/zabbix.conf /etc/apache2/conf-enabled/zabbix.conf 2>/dev/null
# cp -rp /opt/zabbix_backup/conf_files/php-fpm.conf /etc/zabbix/php-fpm.conf 2>/dev/null

(6) Start Zabbix server


# systemctl start zabbix-server

============================End Of Documentation==========================

Access Spectrum Page | 2

You might also like