集群监控——Zabbix部署

1 集群规划

在这里插入图片描述
2 准备工作

关闭防火墙(3台节点,已关闭)

 sudo service iptables stop
 sudo chkconfig iptables off

关闭SELinux(hadoop102)

  1. 修改配置文件/etc/selinux/config
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

2)重启服务器

sudo reboot

配置Zabbix yum源(3台节点)

执行以下命令安装yum源

sudo rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm

修改为阿里云镜像
1)查看原始zabbix.repo文件

sudo cat /etc/yum.repos.d/zabbix.repo

内容如下

 [zabbix]
 name=Zabbix Official Repository - $basearch
 baseurl=http://repo.zabbix.com/zabbix/4.4/rhel/7/$basearch/
 enabled=1
 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/4.4/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/4.4/rhel/7/$basearch/
 enabled=1
 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/4.4/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

安装Zabbix
在三台节点分别执行以下安装命令
hadoop101

 sudo yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

hadoop102

 sudo yum install zabbix-agent

hadoop103

 sudo yum install zabbix-agent

配置Zabbix

1 创建zabbix数据库

 mysql -uroot -p1qaz2wsx -e"create database zabbix character set utf8 collate utf8_bin"

2 导入Zabbix建表语句

 zcat /usr/share/doc/zabbix-server-mysql-4.4.10/create.sql.gz | mysql -uroot -p1qaz2wsx zabbix

3 配置Zabbix_Server(hadoop101)

修改zabbix-server配置文件

 sudo vim /etc/zabbix/zabbix_server.conf
 DBHost=hadoop101
 DBName=zabbix
 DBUser=root
 DBPassword=123456

4 配置Zabbix_Agent(三台节点)
修改zabbix-agent配置文件

 sudo vim /etc/zabbix/zabbix_agentd.conf
 Server=hadoop101
 #ServerActive=127.0.0.1
 #Hostname=Zabbix server

5 配置Zabbix_Web时区
修改/etc/httpd/conf.d/zabbix.conf文件

sudo vim /etc/httpd/conf.d/zabbix.conf
 #
 # Zabbix monitoring system php web frontend
 #
 Alias /zabbix /usr/share/zabbix
 <Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Require all granted

 <IfModule mod_php5.c>
    php_value max_execution_time 300
    php_value memory_limit 128M
    php_value post_max_size 16M
    php_value upload_max_filesize 2M
    php_value max_input_time 300
    php_value max_input_vars 10000
    php_value always_populate_raw_post_data -1
    php_value date.timezone Asia/Shanghai
 </IfModule>
</Directory>

6 启动Zabbix
hadoop101:

 sudo systemctl start zabbix-server zabbix-agent httpd
 sudo systemctl enable zabbix-server zabbix-agent httpd

hadoop102:

 sudo systemctl start zabbix-agent
 sudo systemctl enable zabbix-agent

hadoop103:

 sudo systemctl start zabbix-agent
 sudo systemctl enable zabbix-agent

7 配置Zabbix_Web数据库

1)浏览器访问http://hadoop101/zabbix
在这里插入图片描述
2)检查配置
在这里插入图片描述
3)配置数据库
在这里插入图片描述
4)配置zabbix-server
在这里插入图片描述

登录
Admin/zabbix

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值