centos7.6环境zabbix3.2源码编译安装版升级到zabbix4.0长期支持版
zabbix3.2源码编译安装版升级到zabbix4.0长期支持版 项目需求:
.2版本不再支持,想升级成4.0的长期支持版 环境介绍:
zabbix服务端是编译安装的,数据库和web在一台机器上 整体思路:
先升级3.2版本到3.4过渡版本,然后再次将3.4升级成4.0版本 因为升级过程较长
为了避免影响正常的zabbix业务,克隆出一台服务器用来升级使用,升级完成后互换ip或者直接修改客户端的agent把新的服务端也加入其中
可以并行一段时间,如果没问题就可以弃用老的zabbix服务器了 大概步骤:
.编译安装zabbix3.4.15,然后修改zabbix_server.conf连接zabbix3.2的数据库,运行zabbix_server服务端进行数据表结构升级到3.
.再次编译安装zabbix4.0.10,再次修改zabbix_server.conf连接到已经升级到zabbix3.4的表结构数据库中,再次运行zabbix_server服务端程序将数据库表结构升级到zabbix4.
最终就达到了升级的目标 实际在编译安装zabbix3.4过程中发现在原来的服务器上直接编译安装zabbix3.4是安装不上的,环境被破坏了,于是在另外一台机器上编译安装服务端和web,然后修改配置连接数据库进行数据库表结构升级 准备工作:
备份zabbix-.2相关的数据库、前端网页、执行程序文件,如果升级失败可以回滚 一、zabbix-.2版本升级zabbix3.4版本 .安装依赖
yum install mysql-devel gcc libxml2-devel libevent-devel net-snmp net-snmp-devel curl curl-devel php php-bcmath php-mbstring php-gettext php-session php-ctype php-xmlreader php-xmlwrer php-xml php-net-socket php-gd php-mysql -y https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.15/zabbix-3.4.15.tar.gz ln -s /usr/local/mysql/lib/libperconaserverclient.so /usr/lib/libperconaserverclient.so
./configure --prefix=/usr/local/zabbix-3.4. --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 # 报错如下,找了很多方案解决不了,于是再另外的服务器中编译安装zabbix3.
/libs/zbxserver/libzbxserver.a ../../src/libs/zbxdbcache/libzbxdbcache.a ../../src/libs/zbxhistory/libzbxhistory.a ../../src/libs/zbxmemory/libzbxmemory.a ../../src/libs/zbxregexp/libzbxregexp.a ../../src/libs/zbxself/libzbxself.a ../../src/libs/zbxnix/libzbxnix.a ../../src/libs/zbxalgo/libzbxalgo.a ../../src/libs/zbxsys/libzbxsys.a ../../src/libs/zbxconf/libzbxconf.a ../../src/libs/zbxmedia/libzbxmedia.a ../../src/libs/zbxcommon/libzbxcommon.a ../../src/libs/zbxcrypto/libzbxcrypto.a ../../src/libs/zbxcomms/libzbxcomms.a ../../src/libs/zbxcommshigh/libzbxcommshigh.a ../../src/libs/zbxjson/libzbxjson.a ../../src/libs/zbxhttp/libzbxhttp.a ../../src/libs/zbxipcservice/libzbxipcservice.a ../../src/libs/zbxexec/libzbxexec.a ../../src/libs/zbxicmpping/libzbxicmpping.a ../../src/libs/zbxdbupgrade/libzbxdbupgrade.a ../../src/libs/zbxdbhigh/libzbxdbhigh.a ../../src/libs/zbxdb/libzbxdb.a ../../src/libs/zbxmodules/libzbxmodules.a ../../src/libs/zbxtasks/libzbxtasks.a -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto -lxml2 -lnetsnmp -levent -lcurl -lm -ldl -lrt -lresolv -lpcre
../../src/libs/zbxhistory/libzbxhistory.a(history_elastic.o): In function `elastic_writer_flush':
/usr/local/src/zabbix-3.4./src/libs/zbxhistory/history_elastic.c:: undefined reference to `curl_multi_wait'
../../src/libs/zbxipcservice/libzbxipcservice.a(libzbxipcservice_a-ipcservice.o): In function `ipc_client_free_events':
/usr/local/src/zabbix-3.4./src/libs/zbxipcservice/ipcservice.c:: undefined reference to `event_free'
/usr/local/src/zabbix-3.4./src/libs/zbxipcservice/ipcservice.c:: undefined reference to `event_free'
../../src/libs/zbxipcservice/libzbxipcservice.a(libzbxipcservice_a-ipcservice.o): In function `zbx_ipc_service_close':
/usr/local/src/zabbix-3.4./src/libs/zbxipcservice/ipcservice.c:: undefined reference to `event_free'
/usr/local/src/zabbix-3.4./src/libs/zbxipcservice/ipcservice.c:: undefined reference to `event_free'
../../src/libs/zbxipcservice/libzbxipcservice.a(libzbxipcservice_a-ipcservice.o): In function `ipc_service_add_client':
/usr/local/src/zabbix-3.4./src/libs/zbxipcservice/ipcservice.c:: undefined reference to `event_new'
/usr/local/src/zabbix-3.4./src/libs/zbxipcservice/ipcservice.c:: undefined reference to `event_new'
../../src/libs/zbxipcservice/libzbxipcservice.a(libzbxipcservice_a-ipcservice.o): In function `zbx_ipc_service_start':
/usr/local/src/zabbix-3.4./src/libs/zbxipcservice/ipcservice.c:: undefined reference to `event_new'
/usr/local/src/zabbix-3.4./src/libs/zbxipcservice/ipcservice.c:: undefined reference to `event_new'
collect2: ld returned exit status
make[]: *** [zabbix_server] Error
make[]: Leaving directory `/usr/local/src/zabbix-3.4./src/zabbix_server'
make[]: *** [install-recursive] Error
make[]: Leaving directory `/usr/local/src/zabbix-3.4./src/zabbix_server'
make[]: *** [install-recursive] Error
make[]: Leaving directory `/usr/local/src/zabbix-3.4./src'
make: *** [install-recursive] Error .获取源码
https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.15/zabbix-3.4.15.tar.gz # 编译安装zabbix3.
./configure --prefix=/usr/local/zabbix3.4.15 --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --enable-java # 将服务器默认的zabbix链接到新的服务端程序中
cd /usr/local/
rm -f zabbix
ln -s zabbix3.4.15 zabbix 修改zabbix_server.conf连接之前的3.2数据库 # 启动zabbix服务端 [root@zabbix4_clone:~]# cat /etc/init.d/zabbix_server
#!/bin/bash
#
# chkconfig: -
# description: Starts and stops Zabbix Server using chkconfig
# Tested on Fedora Core -
# Should work on all Fedora Core versions
#
# @name: zabbix_server
# @author: Alexander Hagenah <hagenah@topconcepts.com>
# @created: 18.04.
#
# Modified for Zabbix 2.0.
# May , Zabbix SIA
#
# Source function library.
. /etc/init.d/functions # Variables
# Edit these to match your system settings # Zabbix-Directory
BASEDIR=/usr/local/zabbix # Binary File
BINARY_NAME=zabbix_server # Full Binary File Call
FULLPATH=$BASEDIR/sbin/$BINARY_NAME # PID file
PIDFILE=/tmp/$BINARY_NAME.pid # Establish args
ERROR=
STOPPING= #
# No need to edit the things below
# # application checking status
if [ -f $PIDFILE ] && [ -s $PIDFILE ]
then
PID=`cat $PIDFILE` if [ "x$PID" != "x" ] && kill - $PID >/dev/null && [ $BINARY_NAME == `ps -e | grep $PID | awk '{print $4}'` ]
then
STATUS="$BINARY_NAME (pid `pidof $APP`) running.."
RUNNING=
else
rm -f $PIDFILE
STATUS="$BINARY_NAME (pid file existed ($PID) and now removed) not running.."
RUNNING=
fi
else
if [ `ps -e | grep $BINARY_NAME | head - | awk '{ print $1 }'` ]
then
STATUS="$BINARY_NAME (pid `pidof $APP`, but no pid file) running.."
else
STATUS="$BINARY_NAME (no pid file) not running"
fi
RUNNING=
fi # functions
start() {
if [ $RUNNING -eq ]
then
echo "$0 $ARG: $BINARY_NAME (pid $PID) already running"
else
action $"Starting $BINARY_NAME: " $FULLPATH
touch /var/lock/subsys/$BINARY_NAME
fi
} stop() {
echo -n $"Shutting down $BINARY_NAME: "
killproc $BINARY_NAME
RETVAL=$?
echo
[ $RETVAL -eq ] && rm -f /var/lock/subsys/$BINARY_NAME
RUNNING=
} # logic
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $BINARY_NAME
;;
restart)
stop
sleep
start
;;
help|*)
echo $"Usage: $0 {start|stop|status|restart|help}"
cat <<EOF start - start $BINARY_NAME
stop - stop $BINARY_NAME
status - show current status of $BINARY_NAME
restart - restart $BINARY_NAME if running by sending a SIGHUP or start if not running
help - this screen EOF
exit
;;
esac exit # 查看zabbix服务端日志,出现以下内容说明升级成功
::213252.069 Starting Zabbix Server. Zabbix 3.4. (revision ).
::213252.070 ****** Enabled features ******
::213252.070 SNMP monitoring: YES
::213252.070 IPMI monitoring: NO
::213252.070 Web monitoring: YES
::213252.070 VMware monitoring: YES
::213252.070 SMTP authentication: YES
::213252.070 Jabber notifications: NO
::213252.070 Ez Texting notifications: YES
::213252.070 ODBC: NO
::213252.070 SSH2 support: NO
::213252.070 IPv6 support: NO
::213252.070 TLS support: NO
::213252.070 ******************************
::213252.070 using configuration file: /usr/local/zabbix-3.4./etc/zabbix_server.conf
::213252.080 current database version (mandatory/optional): /
::213252.080 required mandatory version:
::213252.081 optional patches were found
::213252.081 starting automatic database upgrade
::213252.093 completed % of database upgrade
::213252.145 completed % of database upgrade
::213252.244 completed % of database upgrade
::213252.267 completed % of database upgrade
::213252.293 completed % of database upgrade
::213252.371 completed % of database upgrade
::213252.416 completed % of database upgrade
::213252.436 completed % of database upgrade
::213252.449 completed % of database upgrade
::213252.694 completed % of database upgrade
::213253.316 completed % of database upgrade
::213253.792 completed % of database upgrade
::213253.827 completed % of database upgrade
::213253.832 completed % of database upgrade
::213253.855 completed % of database upgrade
::213253.888 completed % of database upgrade
::213253.897 completed % of database upgrade
::213253.911 completed % of database upgrade
::213253.922 completed % of database upgrade
::213253.932 completed % of database upgrade
::213253.948 completed % of database upgrade
::213253.954 completed % of database upgrade
::213253.965 completed % of database upgrade
::213253.983 completed % of database upgrade
::213253.989 completed % of database upgrade
::213253.998 completed % of database upgrade
::213254.012 completed % of database upgrade
::213254.019 completed % of database upgrade
::213254.029 completed % of database upgrade
::213254.046 completed % of database upgrade
::213254.058 completed % of database upgrade
::213254.075 completed % of database upgrade
::213254.086 completed % of database upgrade
::213254.097 completed % of database upgrade
::213254.101 completed % of database upgrade
::213254.105 completed % of database upgrade
::213254.108 completed % of database upgrade
::213254.130 completed % of database upgrade
::213254.138 completed % of database upgrade
::213254.157 completed % of database upgrade
::213254.177 completed % of database upgrade
::213254.195 completed % of database upgrade
::213254.205 completed % of database upgrade
::213254.215 completed % of database upgrade
::213254.219 completed % of database upgrade
::213256.229 completed % of database upgrade
::213256.810 completed % of database upgrade
::213257.205 completed % of database upgrade
::213259.141 completed % of database upgrade
::213259.148 completed % of database upgrade
::213300.869 completed % of database upgrade
::213300.875 completed % of database upgrade
::213300.888 completed % of database upgrade
::213300.913 completed % of database upgrade
::213300.919 completed % of database upgrade
::213300.931 completed % of database upgrade
::213300.943 completed % of database upgrade
::213300.954 completed % of database upgrade
::213300.974 completed % of database upgrade
::213300.986 completed % of database upgrade
::213300.997 completed % of database upgrade
::213301.007 completed % of database upgrade
::213301.018 completed % of database upgrade
::213301.029 completed % of database upgrade
::213301.041 completed % of database upgrade
::213301.052 completed % of database upgrade
::213301.057 completed % of database upgrade
::213301.065 completed % of database upgrade
::213301.082 completed % of database upgrade
::213301.323 completed % of database upgrade
::213301.392 completed % of database upgrade
::213301.424 completed % of database upgrade
::213301.438 completed % of database upgrade
::213301.445 completed % of database upgrade
::213301.459 completed % of database upgrade
::213301.466 completed % of database upgrade
::213301.480 completed % of database upgrade
::213301.486 completed % of database upgrade
::213301.496 completed % of database upgrade
::213301.503 completed % of database upgrade
::213301.510 completed % of database upgrade
::213301.517 completed % of database upgrade
::213301.536 completed % of database upgrade
::213301.556 completed % of database upgrade
::213301.585 completed % of database upgrade
::213301.590 completed % of database upgrade
::213301.640 completed % of database upgrade
::213301.699 completed % of database upgrade
::213301.718 completed % of database upgrade
::213301.918 completed % of database upgrade
::213302.407 completed % of database upgrade
::213302.422 completed % of database upgrade
::213302.425 completed % of database upgrade
::213302.428 completed % of database upgrade
::213302.431 completed % of database upgrade
::213302.434 completed % of database upgrade
::213302.437 completed % of database upgrade
::213302.440 completed % of database upgrade
::213302.455 completed % of database upgrade
::213302.496 completed % of database upgrade
::213302.501 completed % of database upgrade
::213302.501 database upgrade fully completed
::213303.154 server # started [main process]
::213303.155 server # started [configuration syncer #]
::213303.156 server # started [alerter #]
::213303.157 server # started [alerter #]
::213303.157 server # started [alerter #]
::213303.158 server # started [housekeeper #]
::213303.158 server # started [timer #]
::213303.159 server # started [http poller #]
::213303.159 server # started [discoverer #] .zabbix3.4升级到zabbix4.
参考:https://www.zabbix.com/documentation/4.0/zh/manual/installation/upgrade/sources 获取zabbix4..10源码
https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.0.10/zabbix-4.0.10.tar.gz # 编译安装zabbix4.0.10
./configure --prefix=/usr/local/zabbix4.0.10 --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --enable-java Zabbix server 升级步骤
.停止 Zabbix 进程
/etc/init.d/zabbix_server stop .备份当前的数据库
这是非常重要的步骤。升级前请确保备份了数据库。如果升级失败(因磁盘空间不足、断电或其他意外导致的升级失败),备份的数据库将大有帮助。 .备份配置文件、PHP 文件和 Zabbix 二进制文件
在升级前请确保备份了配置文件、PHP 文件和 Zabbix 二进制文件。 # 删除软连接
[root@zabbix4_clone:/usr/local]# ll zabbix
lrwxrwxrwx root root Jun : zabbix -> zabbix-3.4.
[root@zabbix4_clone:/usr/local]# rm -f zabbix .从源代码包安装新的 Zabbix server4.0.10 .检查 Zabbix server 配置文件的参数
在新版本中,Zabbix server 的配置文件发生了一些变化
[root@zabbix4_clone:/usr/local]# ln -s zabbix4.0.10 zabbix
[root@zabbix4_clone:/usr/local]# egrep -v '^#|^$' zabbix/etc/zabbix_server.conf
ListenPort=
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=
DBHost=192.168.254.200 # 此时连接的是zabbix3.4的数据库(即从3.2升级到3.4的数据库)
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix # 密码也是zabbix3.4的密码
DBSocket=/tmp/mysql.sock
DBPort=
StartPollers=
StartTrappers=
StartVMwareCollectors=
VMwareFrequency=
VMwarePerfFrequency=
VMwareCacheSize=64M
VMwareTimeout=
ListenIP=0.0.0.0
HousekeepingFrequency=
CacheSize=256M
Timeout=
AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts
ExternalScripts=/usr/local/zabbix/share/zabbix/externalscripts
LogSlowQueries=
StartProxyPollers= .启动新的 Zabbix 进程
启动新的 Zabbix 进程。检查日志文件以查看进程是否成功启动。 ::215155.763 Starting Zabbix Server. Zabbix 4.0. (revision cc25224816).
::215155.763 ****** Enabled features ******
::215155.763 SNMP monitoring: YES
::215155.763 IPMI monitoring: NO
::215155.763 Web monitoring: YES
::215155.763 VMware monitoring: YES
::215155.763 SMTP authentication: YES
::215155.764 Jabber notifications: NO
::215155.764 Ez Texting notifications: YES
::215155.764 ODBC: NO
::215155.764 SSH2 support: NO
::215155.764 IPv6 support: YES
::215155.764 TLS support: NO
::215155.764 ******************************
::215155.764 using configuration file: /usr/local/zabbix4.0.10/etc/zabbix_server.conf
::215155.776 current database version (mandatory/optional): /
::215155.776 required mandatory version:
::215155.776 optional patches were found
::215155.776 starting automatic database upgrade
::215155.823 completed % of database upgrade
::215155.825 completed % of database upgrade
::215155.958 completed % of database upgrade
::215155.971 completed % of database upgrade
::215155.991 completed % of database upgrade
::215156.002 completed % of database upgrade
::215156.016 completed % of database upgrade
::215156.022 completed % of database upgrade
::215156.036 completed % of database upgrade
::215156.048 completed % of database upgrade
::215156.056 completed % of database upgrade
::215156.058 completed % of database upgrade
::215156.060 completed % of database upgrade
::215156.065 completed % of database upgrade
::215156.070 completed % of database upgrade
::215156.076 completed % of database upgrade
::215156.108 completed % of database upgrade
::215156.111 completed % of database upgrade
::215156.116 completed % of database upgrade
::215156.119 completed % of database upgrade
::215156.121 completed % of database upgrade
::215156.126 completed % of database upgrade
::215156.133 completed % of database upgrade
::215156.145 completed % of database upgrade
::215156.152 completed % of database upgrade ::215201.414 completed % of database upgrade
::215201.456 completed % of database upgrade
::215201.456 database upgrade fully completed 自此,zabbix3.2升级到zabbix4.0成功
centos7.6环境zabbix3.2源码编译安装版升级到zabbix4.0长期支持版的更多相关文章
- Centos7源码编译安装PHP7.2(生产环境)
安装PHP依赖包,否则在编译的过程中可能会出现各种报错 # Centos 安装epel-release源并将系统包更新到最新版本 $ yum install epel-release-y $ yum ...
- centos7 源码编译安装TensorFlow CPU 版本
一.前言 我们都知道,普通使用pip安装的TensorFlow是万金油版本,当你运行的时候,会提示你不是当前电脑中最优的版本,特别是CPU版本,没有使用指令集优化会让TensorFlow用起来更慢. ...
- CentOS7.6源码编译安装PHP 7.3.8
安装步骤 PHP官网下载链接:https://www.php.net/downloads.php 1. 使用wget命令下载源码安装包 wget https://www.php.net/distrib ...
- centos7源码编译安装lamp/lnmp
centos7源码编译安装lamp/lnmp 进程:是包工头(相当于是个门,只管开门关门,不管门内的事儿) 线程:是各种工种(cpu调度的是线程) 进程 是一件事情, 线程 是 同一个时间范围内 同时 ...
- centos6.5环境源码编译安装mysql5.6.34
centos6.5环境源码编译安装mysql5.6.34 源码下载地址http://dev.mysql.com/downloads/mysql/5.6.html#downloads 选择Generic ...
- Linux环境PostgreSQL源码编译安装
Linux环境PostgreSQL源码编译安装 Linux版本: Red Hat 6.4 PostgreSQL版本: postgresql-9.3.2.tar.gz 数据存放目录: /var/post ...
- 源码编译安装lnmp环境
一.源码编译安装步骤 首先说明源码安装的好处 速度快,可自定义路径 主要有三步:1.配置 进入源码安装包 ./configure --prefix=/uer/local/nginx 可指定参数 ...
- 保姆级教程——Ubuntu16.04 Server下深度学习环境搭建:安装CUDA8.0,cuDNN6.0,Bazel0.5.4,源码编译安装TensorFlow1.4.0(GPU版)
写在前面 本文叙述了在Ubuntu16.04 Server下安装CUDA8.0,cuDNN6.0以及源码编译安装TensorFlow1.4.0(GPU版)的亲身经历,包括遇到的问题及解决办法,也有一些 ...
- CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境
CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境 什么是LNMP? LNMP(别名LEMP)是指由Linux, Nginx, MySQL/MariaDB, PHP/ ...
随机推荐
- MySQL5.7数据库的基本操作命令
MySQL5.7中添加用户,新建数据库,用户授权,删除用户,修改密码(注意每行后边都跟个;表示一个命令语句结束): 登录MySQL mysql -u root -p Enter password:密码 ...
- 零基础如何学好Python 之int 数字整型类型 定义int()范围大小转换
本文主题是讲python数字类型python int整型使用方法及技巧.它是不可变数据类型中的一种,它的一些性质和字符串是一样的,注意是整型不是整形哦. Python int有多种数字类型:整型int ...
- python制作的翻译器基于爬取百度翻译【笔记思路】
#!/usr/bin/python # -*- coding: cp936 -*- ################################################### #基于百度翻 ...
- LG4213 【模板】杜教筛(Sum)和 BZOJ4916 神犇和蒟蒻
P4213 [模板]杜教筛(Sum) 题目描述 给定一个正整数$N(N\le2^{31}-1)$ 求 $$ans_1=\sum_{i=1}^n\varphi(i)$$ $$ans_2=\sum_{i= ...
- SVM: 直观上理解大间距分类器
在SVM中,增加安全的间距因子 那么增加了这个间距因子后,会出现什么样的结果呢,我们将C设置为很大(C=100000) SVM决策边界 当我们将C设置得很大进,要想SVM的cost function最 ...
- [PKUSC2018]主斗地
暴搜 非常暴力的搜索,以至于我都不相信我能过. 方法是:暴力枚举所有牌型,然后暴力判断是否可行. 暴力枚举部分: 非常暴力: void dfs(int x,int l){ if(l==0){ flag ...
- Tensorflow细节-P80-深度神经网络
1.本节多为复习内容,从以下图片可见一般: 2.学会使用 from numpy.random import RandomState 然后 rdm = RandomState(1) dataset_si ...
- Oracle ACS 绑定变量窥视 条件
1. ACS简介 Oracle Database 11g提供了Adaptive Cursor Sharing (ACS)功能,以克服以往不该共享的游标被共享的可能性.ACS使用两个新指标:sensit ...
- 复旦高等代数 II(15级)每周一题
[问题2016S01] 设 $f(x)=x^n+a_{n-1}x^{n-1}+\cdots+a_1x+a_0$ 是整系数首一多项式, 满足: $|a_0|$ 是素数且 $$|a_0|>1+\s ...
- yii2.0简单使用elasticsearch
1.安装扩展 /c/phpStudy/PHPTutorial/php/php-5.5.38/php /c/ProgramData/ComposerSetup/bin/composer.phar req ...