继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

Zabbix 3.x 升级到 Zabbix 4.x

慕哥9229398
关注TA
已关注
手记 1277
粉丝 199
获赞 913

Zabbix升级步骤

备份数据库

# 数据库全备时间比较长且文件交大,建议压缩或者使用xtrabackupmysqldump -uzabbix -pzabbix --opt --skip-lock-tables --database zabbix > zabbix.sql
mysqldump -uzabbix -pzabbix --opt --skip-lock-tables --database zabbix | gzip > zabbix_`date +'%Y%m%d%H%M%S'`.sql.gz

CentOS

# 停止服务service zabbix-server stop
service zabbix-agent stop
service httpd stop# 备份 zabbix 文件mkdir /opt/zabbix-backup/
cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/
cp /etc/httpd/conf.d/zabbix.conf  /opt/zabbix-backup/
cp -R /usr/share/zabbix/ /opt/zabbix-backup/
cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/# 升级zabbix源rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm# 升级zabbix# yum upgrade zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-proxy-mysqlyum clean all
yum upgrade zabbix-server-mysql zabbix-web-mysql zabbix-agent 

# 启动zabbixservice zabbix-server start
service zabbix-agent start
service httpd start# 检查升级日志tail -f /var/log/zabbix/zabbix_server.log

5044:20181101:212148.975 Starting Zabbix Server. Zabbix 4.0.1 (revision 86073).
  5044:20181101:212149.173 ****** Enabled features ******
  5044:20181101:212149.173 SNMP monitoring:           YES
  5044:20181101:212149.173 IPMI monitoring:           YES
  5044:20181101:212149.173 Web monitoring:            YES
  5044:20181101:212149.173 VMware monitoring:         YES
  5044:20181101:212149.173 SMTP authentication:       YES
  5044:20181101:212149.173 Jabber notifications:      YES
  5044:20181101:212149.173 Ez Texting notifications:  YES
  5044:20181101:212149.173 ODBC:                      YES
  5044:20181101:212149.173 SSH2 support:              YES
  5044:20181101:212149.173 IPv6 support:              YES
  5044:20181101:212149.173 TLS support:               YES
  5044:20181101:212149.173 ******************************
  5044:20181101:212149.173 using configuration file: /etc/zabbix/zabbix_server.conf
  5044:20181101:212149.276 current database version (mandatory/optional): 03040000/03040007
  5044:20181101:212149.360 required mandatory version: 04000000
  5044:20181101:212149.361 starting automatic database upgrade
  5044:20181101:212149.774 completed 0% of database upgrade
  5044:20181101:212149.775 completed 1% of database upgrade
  5044:20181101:212149.865 completed 2% of database upgrade
  5044:20181101:212149.867 completed 3% of database upgrade
  5044:20181101:212149.871 completed 4% of database upgrade
  5044:20181101:212149.874 completed 5% of database upgrade
  5044:20181101:212149.922 completed 6% of database upgrade
  5044:20181101:212150.015 completed 7% of database upgrade
  5044:20181101:212150.169 completed 8% of database upgrade
  5044:20181101:212150.314 completed 9% of database upgrade
  5044:20181101:212150.469 completed 10% of database upgrade
  5044:20181101:212150.523 completed 11% of database upgrade
  5044:20181101:212150.563 completed 12% of database upgrade
  5044:20181101:212150.565 completed 13% of database upgrade
  5044:20181101:212150.574 completed 14% of database upgrade
  5044:20181101:212150.621 completed 15% of database upgrade
  5044:20181101:212150.715 completed 16% of database upgrade
  5044:20181101:212150.809 completed 17% of database upgrade
  5044:20181101:212150.818 completed 18% of database upgrade
  5044:20181101:212150.867 completed 19% of database upgrade
  5044:20181101:212150.871 completed 20% of database upgrade
  5044:20181101:212150.959 completed 21% of database upgrade
  5044:20181101:212151.124 completed 22% of database upgrade
  5044:20181101:212151.209 completed 23% of database upgrade
  5044:20181101:212151.272 completed 24% of database upgrade
  5044:20181101:212151.275 completed 25% of database upgrade
  5044:20181101:212151.314 completed 26% of database upgrade
  5044:20181101:212152.118 completed 27% of database upgrade
  5044:20181101:212152.613 completed 28% of database upgrade
  5044:20181101:212153.271 completed 29% of database upgrade
  5044:20181101:212153.570 completed 30% of database upgrade
  5044:20181101:212154.869 completed 31% of database upgrade
  5044:20181101:212156.368 completed 32% of database upgrade
  5044:20181101:212156.665 completed 33% of database upgrade
  5044:20181101:212157.465 completed 34% of database upgrade
  5044:20181101:212157.820 completed 35% of database upgrade
  5044:20181101:212158.509 completed 36% of database upgrade
  5044:20181101:212200.662 completed 37% of database upgrade
  5044:20181101:212200.710 completed 38% of database upgrade
  5044:20181101:212200.715 completed 39% of database upgrade
  5044:20181101:212200.761 completed 40% of database upgrade
  5044:20181101:212200.807 completed 41% of database upgrade
  5044:20181101:212200.810 completed 42% of database upgrade
  5044:20181101:212200.811 completed 43% of database upgrade
  5044:20181101:212200.813 completed 44% of database upgrade
  5044:20181101:212200.815 completed 45% of database upgrade
  5044:20181101:212200.818 completed 46% of database upgrade
  5044:20181101:212200.913 completed 47% of database upgrade
  5044:20181101:212200.960 completed 48% of database upgrade
  5044:20181101:212201.013 completed 49% of database upgrade
  5044:20181101:212201.116 completed 50% of database upgrade
  5044:20181101:212201.119 completed 51% of database upgrade
  5044:20181101:212201.157 completed 52% of database upgrade
  5044:20181101:212201.160 completed 53% of database upgrade
  5044:20181101:212201.164 completed 54% of database upgrade
  5044:20181101:212201.166 completed 55% of database upgrade
  5044:20181101:212201.169 completed 56% of database upgrade
  5044:20181101:212201.206 completed 57% of database upgrade
  5044:20181101:212201.208 completed 58% of database upgrade
  5044:20181101:212201.305 completed 59% of database upgrade
  5044:20181101:212201.308 completed 60% of database upgrade
  5044:20181101:212201.311 completed 61% of database upgrade
  5044:20181101:212201.356 completed 62% of database upgrade
  5044:20181101:212201.363 completed 63% of database upgrade
  5044:20181101:212201.413 completed 64% of database upgrade
  5044:20181101:212201.414 completed 65% of database upgrade
  5044:20181101:212201.465 completed 66% of database upgrade
  5044:20181101:212201.517 completed 67% of database upgrade
  5044:20181101:212201.562 completed 68% of database upgrade
  5044:20181101:212201.656 completed 69% of database upgrade
  5044:20181101:212201.666 completed 70% of database upgrade
  5044:20181101:212201.719 completed 71% of database upgrade
  5044:20181101:212201.758 completed 72% of database upgrade
  5044:20181101:212201.760 completed 73% of database upgrade
  5044:20181101:212201.764 completed 74% of database upgrade
  5044:20181101:212201.766 completed 75% of database upgrade
  5044:20181101:212201.817 completed 76% of database upgrade
  5044:20181101:212201.862 completed 77% of database upgrade
  5044:20181101:212202.054 completed 78% of database upgrade
  5044:20181101:212202.112 completed 79% of database upgrade
  5044:20181101:212202.158 completed 80% of database upgrade
  5044:20181101:212202.210 completed 81% of database upgrade
  5044:20181101:212202.261 completed 82% of database upgrade
  5044:20181101:212202.315 completed 83% of database upgrade
  5044:20181101:212202.566 completed 84% of database upgrade
  5044:20181101:212202.609 completed 85% of database upgrade
  5044:20181101:212202.619 completed 86% of database upgrade
  5044:20181101:212202.656 completed 87% of database upgrade
  5044:20181101:212202.659 completed 88% of database upgrade
  5044:20181101:212202.661 completed 89% of database upgrade
  5044:20181101:212202.669 completed 90% of database upgrade
  5044:20181101:212202.761 completed 91% of database upgrade
  5044:20181101:212203.214 completed 92% of database upgrade
  5044:20181101:212203.360 completed 93% of database upgrade
  5044:20181101:212203.365 completed 94% of database upgrade
  5044:20181101:212203.403 completed 95% of database upgrade
  5044:20181101:212203.417 completed 96% of database upgrade
  5044:20181101:212203.467 completed 97% of database upgrade
  5044:20181101:212203.508 completed 98% of database upgrade
  5044:20181101:212203.564 completed 99% of database upgrade
  5044:20181101:212203.566 completed 100% of database upgrade
  5044:20181101:212203.566 database upgrade fully completed
  5044:20181101:212203.660 starting event name update forced by database upgrade
  5044:20181101:212203.706 completed 1% of event name update
  5044:20181101:212203.706 completed 2% of event name update
  5044:20181101:212203.706 completed 3% of event name update
  5044:20181101:212203.706 completed 4% of event name update
  5044:20181101:212203.706 completed 5% of event name update
  5044:20181101:212203.706 completed 6% of event name update
  5044:20181101:212203.706 completed 7% of event name update
  5044:20181101:212203.706 completed 8% of event name update
  5044:20181101:212203.706 completed 9% of event name update
  5044:20181101:212203.706 completed 10% of event name update
  5044:20181101:212203.706 completed 11% of event name update
  5044:20181101:212203.706 completed 12% of event name update
  5044:20181101:212203.707 completed 13% of event name update
  5044:20181101:212203.707 completed 14% of event name update
  5044:20181101:212203.707 completed 15% of event name update
  5044:20181101:212203.707 completed 16% of event name update
  5044:20181101:212203.707 completed 17% of event name update
  5044:20181101:212203.707 completed 18% of event name update
  5044:20181101:212203.707 completed 19% of event name update
  5044:20181101:212203.707 completed 20% of event name update
  5044:20181101:212203.707 completed 21% of event name update
  5044:20181101:212203.707 completed 22% of event name update
  5044:20181101:212203.707 completed 23% of event name update
  5044:20181101:212203.707 completed 24% of event name update
  5044:20181101:212203.707 completed 25% of event name update
  5044:20181101:212203.708 completed 26% of event name update
  5044:20181101:212203.708 completed 27% of event name update
  5044:20181101:212203.708 completed 28% of event name update
  5044:20181101:212203.708 completed 29% of event name update
  5044:20181101:212203.708 completed 30% of event name update
  5044:20181101:212203.708 completed 31% of event name update
  5044:20181101:212203.708 completed 32% of event name update
  5044:20181101:212203.710 completed 33% of event name update
  5044:20181101:212203.712 completed 34% of event name update
  5044:20181101:212203.714 completed 35% of event name update
  5044:20181101:212203.717 completed 36% of event name update
  5044:20181101:212203.717 completed 37% of event name update
  5044:20181101:212203.717 completed 38% of event name update
  5044:20181101:212203.717 completed 39% of event name update
  5044:20181101:212203.718 completed 40% of event name update
  5044:20181101:212203.718 completed 41% of event name update
  5044:20181101:212203.718 completed 42% of event name update
  5044:20181101:212203.718 completed 43% of event name update
  5044:20181101:212203.718 completed 44% of event name update
  5044:20181101:212203.718 completed 45% of event name update
  5044:20181101:212203.718 completed 46% of event name update
  5044:20181101:212203.718 completed 47% of event name update
  5044:20181101:212203.718 completed 48% of event name update
  5044:20181101:212203.719 completed 49% of event name update
  5044:20181101:212203.719 completed 50% of event name update
  5044:20181101:212203.758 completed 51% of event name update
  5044:20181101:212203.804 completed 52% of event name update
  5044:20181101:212203.804 completed 53% of event name update
  5044:20181101:212203.804 completed 54% of event name update
  5044:20181101:212203.804 completed 55% of event name update
  5044:20181101:212203.805 completed 56% of event name update
  5044:20181101:212203.805 completed 57% of event name update
  5044:20181101:212203.805 completed 58% of event name update
  5044:20181101:212203.805 completed 59% of event name update
  5044:20181101:212203.805 completed 60% of event name update
  5044:20181101:212203.805 completed 61% of event name update
  5044:20181101:212203.805 completed 62% of event name update
  5044:20181101:212203.805 completed 63% of event name update
  5044:20181101:212203.805 completed 64% of event name update
  5044:20181101:212203.805 completed 65% of event name update
  5044:20181101:212203.805 completed 66% of event name update
  5044:20181101:212203.806 completed 67% of event name update
  5044:20181101:212203.806 completed 68% of event name update
  5044:20181101:212203.806 completed 69% of event name update
  5044:20181101:212203.807 completed 70% of event name update
  5044:20181101:212203.807 completed 71% of event name update
  5044:20181101:212203.807 completed 72% of event name update
  5044:20181101:212203.807 completed 73% of event name update
  5044:20181101:212203.807 completed 74% of event name update
  5044:20181101:212203.807 completed 75% of event name update
  5044:20181101:212203.807 completed 76% of event name update
  5044:20181101:212203.807 completed 77% of event name update
  5044:20181101:212203.808 completed 78% of event name update
  5044:20181101:212203.808 completed 79% of event name update
  5044:20181101:212203.808 completed 80% of event name update
  5044:20181101:212203.808 completed 81% of event name update
  5044:20181101:212203.808 completed 82% of event name update
  5044:20181101:212203.808 completed 83% of event name update
  5044:20181101:212203.808 completed 84% of event name update
  5044:20181101:212203.808 completed 85% of event name update
  5044:20181101:212203.809 completed 86% of event name update
  5044:20181101:212203.809 completed 87% of event name update
  5044:20181101:212203.810 completed 88% of event name update
  5044:20181101:212203.810 completed 89% of event name update
  5044:20181101:212203.810 completed 90% of event name update
  5044:20181101:212203.810 completed 91% of event name update
  5044:20181101:212203.810 completed 92% of event name update
  5044:20181101:212203.810 completed 93% of event name update
  5044:20181101:212203.810 completed 94% of event name update
  5044:20181101:212203.811 completed 95% of event name update
  5044:20181101:212203.811 completed 96% of event name update
  5044:20181101:212203.811 completed 97% of event name update
  5044:20181101:212203.811 completed 98% of event name update
  5044:20181101:212203.811 completed 99% of event name update
  5044:20181101:212203.811 completed 100% of event name update
  5044:20181101:212205.304 event name update completed

Ubuntu

# 停止服务service zabbix-server stop
service zabbix-agent stop
service apache2 stop# 备份 zabbix 文件mkdir /opt/zabbix-backup/
cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/
cp /etc/apache2/conf-enabled/zabbix.conf /opt/zabbix-backup/
cp -R /usr/share/zabbix/ /opt/zabbix-backup/ 
cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/# 升级zabbix源rm -Rf /etc/apt/sources.list.d/zabbix.list
wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb
dpkg -i zabbix-release_4.0-2+xenial_all.deb
apt-get update# 添加时出现问题:dpkg: error: dpkg status database is locked by another processrm /var/lib/dpkg/lock
dpkg --configure -a# 升级zabbix# apt-get install --only-upgrade zabbix-server-mysql zabbix-frontend-php zabbix-agent zabbix-proxy-mysqlapt-get install --only-upgrade zabbix-server-mysql zabbix-frontend-php zabbix-agent# 启动zabbixservice zabbix-server start
service zabbix-agent start
service apache2 start

docker

  1. 拉取最新镜像

  2. 停止并删除当前运行容器

  3. 用最新镜像重新创建容器

  4. All Done

# 查找当前系统中使用的镜像docker images# 拉取最新镜像docker pull zabbix/zabbix-web-nginx-mysql
docker pull zabbix/zabbix-server-mysql# 查找容器IDdocker ps# 导出之前的容器配置信息docker inspect 14fd67405076# 停止容器docker stop 14fd67405076
docker kill 14fd67405076# 删除容器docker rm 14fd67405076# 用最新镜像重新创建容器docker run --name zabbix-server-mysql -t \
--link mysql-server:mysql \
-e DB_SERVER_HOST="mysql-server" \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix" \
-e MYSQL_ROOT_PASSWORD="zabbix" \
-v /etc/localtime:/etc/localtime:ro \
-v /data/docker/zabbix/alertscripts:/usr/lib/zabbix/alertscripts \
-v /data/docker/zabbix/externalscripts:/usr/lib/zabbix/externalscripts \
-p 10051:10051 \
-d \
zabbix/zabbix-server-mysql

docker run --name zabbix-web-nginx-mysql -t \
--link mysql-server:mysql \
--link zabbix-server-mysql:zabbix-server \
-e DB_SERVER_HOST="mysql-server" \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix" \
-e MYSQL_ROOT_PASSWORD="zabbix" \
-e PHP_TZ="Asia/Singapore" \
-p 80:80 \
-d \
zabbix/zabbix-web-nginx-mysql



作者:王奥OX
链接:https://www.jianshu.com/p/333d464dae3a


打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP