zabbix2.4.5 Migrating to zabbix3.0
Reference documents
http://qicheng0211.blog.51cto.com/3958621/1744603
Cause
Zabbix 2.4.5 database MySQL suddenly died, find the MySQL database log found to save data disk read and write error, originally that is Taiwan r410 old machine, and then simply changed 1 units R610 slightly good machine, now the machines are changed to Zabbix version also
Change together, open the zabbix3.0 mode, the following is the main step, the database this is only found this time a simple method.
0, first to have the original database backup
Hardware server also upgraded, only the most recent database full backup, found that the data is too large, if all the import time-consuming, find a variety of data found no way to ignore some tables, and later thought to manually filter the SQL data table.
Grep-v ' INSERT into ' history_uint ' VALUES ' Zabbix.sql >zabbix.nohistory.sql
Grep-v ' INSERT into ' history ' VALUES ' Zabbix.nohistory.sql >zabbix.nohistory0.sql
If you want to import historical trends, the next two steps can not be needed, I need to keep
Grep-v ' INSERT into ' trends_uint ' VALUES ' zabbix.nohistory0.sql > Zabbix.nohistory1.sql
Grep-v ' INSERT into ' trends ' VALUES ' Zabbix.nohistory1.sql > Zabbix.nohistory2.sql
I later modified the backup method by ignoring the historical data from all the original backups to the backup.
Mysqldump-uroot-p ' pasword ' Zabbix--ignore-table=zabbix.history_uint--ignore-table=zabbix.history > Zabbix.nohistory.sql
1,lamp or LNMP environment
Many online methods, that is, MySQL use InnoDB engine, version 5.6 or above, PHP version 5.6 or above, Apache or Nginx according to personal interests. I use RPM package, data with the MARIADB.
MARIADB Source
Cat/etc/yum.repos.d/mariadb.repo
# http://mariadb.org/mariadb/repositories/
[MARIADB]
Name = MariaDB
BaseURL = Http://yum.mariadb.org/5.5/centos6-amd64
Gpgkey=https://yum.mariadb.org/rpm-gpg-key-mariadb
Gpgcheck=1
Installation
Yum-y Install mariadb-client mariadb-server mariadb-devel
2,zabbix3.0 source package or RPM is also based on personal interests.
# upgrade CENTOS6 's Zabbix official Yum source (official Yum source does not provide CentOS6 version of zabbix3.0 server)
RPM-UVH http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
# download Itnihao packaged CentOS6 version of the zabbix3.0 RPM package, thanks to Itnihao dedication
Mkdir/data
Cd/data
Yum Install git createrepo-y
git clone https://github.com/zabbixcn/zabbix3.0-rpm.git
# Create zabbix3.0 local Yum source
Createrepo/data/zabbix3.0-rpm/rpms
Cat >/etc/yum.repos.d/zabbix3.0.repo << ' EOF '
[zabbix3.0]
name=zabbix3.0 Itnihao
Baseurl=file:///data/zabbix3.0-rpm/rpms
Enabled=0
Gpgcheck=0
Eof
# rebuild Yum Cache
Yum Clean All
Yum Makecache
# Yum installs zabbix3.0 related services (note: To disable Epel sources)
Yum--disablerepo=epel--enablerepo=zabbix3.0 Install zabbix-server-mysql zabbix-agent zabbix-get Zabbix-sender Zabbix-web Zabbix-web-mysql Zabbix-release
3, Import data
mysql-u root password ' password ' < Zabbix.nohistory0.sql
4, Start Zabbix-server
Service Zabbix-server Start
The Zabbix database is automatically updated
5, set the web side
Here is mainly a font, you need to note that the default open graphics garbled, download simplified characters. Upload, modify the code.
vim/usr/share/zabbix/include/defines.inc.php
:%s/graphfont/dejavusans/g
Also note that the 3.0 version of the Zabbix-server configuration file is not the same as the 2.4.5, I refer to the default modification of 3.0 here, the results are as follows:
Logfile=/var/log/zabbix/zabbix_server.log
Logfilesize=0
Pidfile=/var/run/zabbix/zabbix_server.pid
Dbhost=localhost
Dbname=zabbix
Dbuser=zabbix
Dbpassword=password
startpollers=160
Startipmipollers=1
Startpollersunreachable=80
Starttrappers=20
startpingers=100
startdiscoverers=120
starthttppollers=2
Startsnmptrapper=1
cachesize=1024m
Startdbsyncers=16
trendcachesize=1024m
Trappertimeout=30
Fpinglocation=/usr/sbin/fping
Dbsocket=/var/lib/mysql/mysql.sock
Snmptrapperfile=/var/log/snmptrap/snmptrap.log
timeout=10
Alertscriptspath=/usr/lib/zabbix/alertscripts
Externalscripts=/usr/lib/zabbix/externalscripts
logslowqueries=3000
This article is from the "jerrymin" blog, make sure to keep this source http://jerrymin.blog.51cto.com/3002256/1757890
zabbix2.4.5 Migrating to zabbix3.0