关闭集群
关闭防火墙
关闭SELinux
sudo vim /etc/selinux/config
修改文件内容
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
重启服务器
sudo reboot
配置Zabbix yum源(3台节点)
1)安装zabbix的yum仓库
sudo rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
2)安装Software Collections仓库
sudo yum install -y centos-release-scl
修改zabbix仓库配置文件
1)修改为阿里云镜像
1)查看原始zabbix.repo文件
sudo cat /etc/yum.repos.d/zabbix.repo
查看内容如下
[zabbix] name=Zabbix Official Repository - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-frontend] name=Zabbix Official Repository frontend - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-debuginfo] name=Zabbix Official Repository debuginfo - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/debuginfo/ enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 gpgcheck=1 [zabbix-non-supported] name=Zabbix Official Repository non-supported - $basearch baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1
(2)执行以下命令完成全局替换
sudo sed -i 's/http://repo.zabbix.com/https://mirrors.aliyun.com/zabbix/g' /etc/yum.repos.d/zabbix.repo
(3)查看修改之后的zabbix.repo文件
sudo cat /etc/yum.repos.d/zabbix.repo
查看内容如下
[zabbix] name=Zabbix Official Repository - $basearch baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-frontend] name=Zabbix Official Repository frontend - $basearch baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-debuginfo] name=Zabbix Official Repository debuginfo - $basearch baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/debuginfo/ enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 gpgcheck=1 [zabbix-non-supported] name=Zabbix Official Repository non-supported - $basearch baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1
2)启用zabbix-web仓库
打开/etc/yum.repos.d/zabbix.repo文件,做如下修改
[zabbix-frontend] name=Zabbix Official Repository frontend - $basearch baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591安装Zabbix
在hadoop102、hadoop103、hadoop104三台节点分别执行以下安装命令
102:
sudo yum install -y zabbix-server-mysql zabbix-agent zabbix-web-mysql-scl zabbix-apache-conf-scl
103:
sudo yum install -y zabbix-agent
104:
sudo yum install -y zabbix-agent
配置Zabbix
创建zabbix数据库
mysql -uroot -p000000 -e"create database zabbix character set utf8 collate utf8_bin"导入Zabbix建表语句
建表语句在/usr/share/doc/zabbix-server-mysql-5.0.18/目录下的create.sql.gz文件中
zcat /usr/share/doc/zabbix-server-mysql-5.0.18/create.sql.gz | mysql -uroot -p000000 zabbix配置Zabbix_Server(hadoop102)
修改zabbix-server配置文件
sudo vim /etc/zabbix/zabbix_server.conf
DBHost=hadoop102 DBName=zabbix DBUser=root DBPassword=000000
修改zabbix-agent配置文件
sudo vim /etc/zabbix/zabbix_agentd.conf
修改如下内容:
Server=hadoop102 #ServerActive=127.0.0.1 #Hostname=Zabbix server配置Zabbix_Web时区
修改/etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf文件
sudo vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
修改如下内容:
php_value[date.timezone] = Asia/Shanghai启动停止Zabbix
启动Zabbix
102:
sudo systemctl start zabbix-server zabbix-agent httpd rh-php72-php-fpm sudo systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
103:
sudo systemctl start zabbix-agent sudo systemctl enable zabbix-agent
104:
sudo systemctl start zabbix-agent sudo systemctl enable zabbix-agent
停止Zabbix
102:
sudo systemctl stop zabbix-server zabbix-agent httpd rh-php72-php-fpm sudo systemctl disable zabbix-server zabbix-agent httpd rh-php72-php-fpm
103:
sudo systemctl stop zabbix-agent sudo systemctl disable zabbix-agent
104:
sudo systemctl stop zabbix-agent sudo systemctl disable zabbix-agent连接Zabbix_Web数据库
1)浏览器访问http://hadoop102/zabbix/
2)检查配置
3)数据库的连接
4)配置Zabbix Server
5)最终确定
用户名:Admin 密码:zabbix
进入主页



