@Zabbix6.0 HA原生高可用集群部署方案(Ubuntu 20.04)

2024-01-26 09:40

本文主要是介绍@Zabbix6.0 HA原生高可用集群部署方案(Ubuntu 20.04),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

    • 1.基础系统优化
    • 2.zabbix6.0支持配置
      • 1)系统支持
      • 2)软件支持
    • 3.服务器准备
    • 4.zabbix6.0部署
    • 5.数据库部署
      • 1)数据库安装
      • 2)数据库配置
    • 6.zabbix配置及web配置
    • 7.zabbix web配置
    • 6.zabbix web中文字符安装

在这里插入图片描述

1.基础系统优化

【ubuntu基本优化】

2.zabbix6.0支持配置

1)系统支持

【zabbix官网】

在这里插入图片描述

2)软件支持

【DB支持】

在这里插入图片描述

web前端支持

在这里插入图片描述

3.服务器准备

主机IPoszabbix节点
zabbix server192.168.1.220Ubuntu server 20.04v6.0zabbix01
zabbix server192.168.1.221Ubuntu server 20.04v6.0zabbix02
mysql192.168.1.222Ubuntu server 20.04v8.0DB01
mysql192.168.1.223Ubuntu server 20.04v8.0DB02
proxy192.168.1.224Ubuntu server 20.04v6.0proxy

4.zabbix6.0部署

#版本查看
root@zabbix01:~# cat /etc/issue
Ubuntu 20.04.4 LTS \n \l#下载zabbix安装源仓库
root@zabbix01:~# wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1%2Bubuntu20.04_all.deb#安装zabbix官方仓库源
root@zabbix01:~# dpkg -i zabbix-release_6.0-1+ubuntu20.04_all.deb
root@zabbix02:~# dpkg -i zabbix-release_6.0-1+ubuntu20.04_all.deb#更新仓库
root@zabbix01:~# apt update
root@zabbix02:~# apt update#zabbix相关组件安装
root@zabbix01:~# apt install zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts  zabbix-agent2
root@zabbix02:~# apt install zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts  zabbix-agent2#nginx组件(web可选择其一即可)
root@zabbix01:~# apt install  zabbix-nginx-conf
root@zabbix01:~# apt install  zabbix-apache-conf#查看安装相关软件包
root@zabbix01:~# dpkg -l |grep zabbix
ii  zabbix-agent2                         1:6.0.5-1+ubuntu20.04             amd64        Zabbix network monitoring solution - agent
ii  zabbix-apache-conf                    1:6.0.5-1+ubuntu20.04             all          Zabbix network monitoring solution - apache configuration for front-end
ii  zabbix-frontend-php                   1:6.0.5-1+ubuntu20.04             all          Zabbix network monitoring solution - PHP front-end
ii  zabbix-release                        1:6.0-1+ubuntu20.04               all          Zabbix official repository configuration
ii  zabbix-server-mysql                   1:6.0.5-1+ubuntu20.04             amd64        Zabbix network monitoring solution - server (MySQL)

5.数据库部署

1)数据库安装

#更新安装源(默认阿里云源就可以)
root@DB01:~# apt-get update
root@DB02:~# apt-get update#安装mysql server
root@DB01:~# apt install -y mysql-server
root@DB02:~# apt install -y mysql-server#查看版本
root@DB01:~# mysql -V
mysql  Ver 8.0.29-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu)
root@DB02:~# mysql -V
mysql  Ver 8.0.29-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))

2)数据库配置

#进入数据库(mysql8.0之上,新安装的数据库进入不需要密码,我们可直接进入数据库重设)
root@DB02:~# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.29-0ubuntu0.20.04.3 (Ubuntu)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> select  version();
+-------------------------+
| version()               |
+-------------------------+
| 8.0.29-0ubuntu0.20.04.3 |
+-------------------------+
1 row in set (0.00 sec)mysql>#初始化配置root用户密码
root@DB01:~# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.29-0ubuntu0.20.04.3 (Ubuntu)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY "zeny";
Query OK, 0 rows affected (0.08 sec)mysql> flush privileges;mysql> exit#测试root登录mysql
root@DB01:~# mysql -uroot -pzeny
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.29-0ubuntu0.20.04.3 (Ubuntu)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>#配置zabbix数据库账户及密码
root@DB01:~# mysql -uroot -pzeny
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.29-0ubuntu0.20.04.3 (Ubuntu)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected, 2 warnings (0.01 sec)mysql> create user zabbix@"%" identified by 'Zabbix@2022';
Query OK, 0 rows affected (0.11 sec)mysql> grant all privileges on zabbix.* to zabbix@"%";
Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)mysql> quit
Bye
root@DB01:~##测试zabbix用户(如下表示zabbix用户正常使用)
root@DB01:~# mysql -uzabbix -pZabbix@2022
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.29-0ubuntu0.20.04.3 (Ubuntu)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>#测试zabbix用户远程连接
root@DB01:~# mysql -h127.0.0.1 -uzabbix -pZabbix@2022
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 8.0.29-0ubuntu0.20.04.3 (Ubuntu)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>#修改监听的地址
root@DB01:~# egrep "^[^#]" /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
user            = mysql
bind-address            = 0.0.0.0
mysqlx-bind-address     = 127.0.0.1
key_buffer_size         = 16M
myisam-recover-options  = BACKUP
log_error = /var/log/mysql/error.log
max_binlog_size   = 100M#重启mysql,并加入开机自启
root@DB01:~# systemctl restart  mysql.service
root@DB01:~# systemctl enable  mysql.service
Synchronizing state of mysql.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mysql#查看服务状态
root@DB01:~# netstat -lntp |grep mysql
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      15208/mysqld
tcp        0      0 127.0.0.1:33060         0.0.0.0:*               LISTEN      15208/mysqld#远程测试
root@DB02:~# mysql -uzabbix -h192.168.1.222 -p"Zabbix@2022"
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.29-0ubuntu0.20.04.3 (Ubuntu)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> ^DBye
root@DB02:~#

6.zabbix配置及web配置

#zabbix架构数据导入mysql
root@zabbix01:~# zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz  | mysql -uzabbix -h192.168.1.222  -p"Zabbix@2022" zabbix
mysql: [Warning] Using a password on the command line interface can be insecure.
root@zabbix01:~# #配置zabbix_server
root@zabbix01:~# egrep "^[^#]" /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/run/zabbix/zabbix_server.pid
SocketDir=/run/zabbix
DBHost=192.168.1.222
DBName=zabbix
DBUser=zabbix
DBPassword=Zabbix@2022
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
FpingLocation=/usr/bin/fping
Fping6Location=/usr/bin/fping6
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1
#HA配置
HANodeName=zabbix01
NodeAddress=192.168.1.220:10051root@zabbix02:~# egrep "^[^#]" /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/run/zabbix/zabbix_server.pid
SocketDir=/run/zabbix
DBHost=192.168.1.222
DBName=zabbix
DBUser=zabbix
DBPassword=Zabbix@2022
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
FpingLocation=/usr/bin/fping
Fping6Location=/usr/bin/fping6
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1
#HA配置
HANodeName=zabbix02
NodeAddress=192.168.1.221:10051
root@zabbix02:~##配置zabbix_agent2
root@zabbix01:~# egrep "^[^#]" /etc/zabbix/zabbix_agent2.conf
PidFile=/var/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log
LogFileSize=0
Server=192.168.1.220,192.168.1.221
ServerActive=192.168.1.220,192.168.1.221
Hostname=zabbix01
Include=/etc/zabbix/zabbix_agent2.d/*.conf
ControlSocket=/tmp/agent.sock
Include=./zabbix_agent2.d/plugins.d/*.conf
root@zabbix02:~# egrep "^[^#]" /etc/zabbix/zabbix_agent2.conf
PidFile=/var/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log
LogFileSize=0
Server=192.168.1.220,192.168.1.221
ServerActive=192.168.1.220,192.168.1.221
Hostname=zabbix02
Include=/etc/zabbix/zabbix_agent2.d/*.conf
ControlSocket=/tmp/agent.sock
Include=./zabbix_agent2.d/plugins.d/*.conf
root@zabbix02:~##编辑web配置文件,nginx服务(去掉以下两行内容注释即可)
root@zabbix01:~# egrep "^[^#]" /etc/nginx/conf.d/zabbix.conf
server {listen          80;              #打开监听端口server_name     192.168.1.220;   #web访问server的地址root    /usr/share/zabbix;index   index.php;location = /favicon.ico {log_not_found   off;}location / {try_files       $uri $uri/ =404;}location /assets {access_log      off;expires         10d;}location ~ /\.ht {deny            all;}location ~ /(api\/|conf[^\.]|include|locale) {deny            all;return          404;}location /vendor {deny            all;return          404;}location ~ [^/]\.php(/|$) {fastcgi_pass    unix:/var/run/php/zabbix.sock;fastcgi_split_path_info ^(.+\.php)(/.+)$;fastcgi_index   index.php;fastcgi_param   DOCUMENT_ROOT   /usr/share/zabbix;fastcgi_param   SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;fastcgi_param   PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;include fastcgi_params;fastcgi_param   QUERY_STRING    $query_string;fastcgi_param   REQUEST_METHOD  $request_method;fastcgi_param   CONTENT_TYPE    $content_type;fastcgi_param   CONTENT_LENGTH  $content_length;fastcgi_intercept_errors        on;fastcgi_ignore_client_abort     off;fastcgi_connect_timeout         60;fastcgi_send_timeout            180;fastcgi_read_timeout            180;fastcgi_buffer_size             128k;fastcgi_buffers                 4 256k;fastcgi_busy_buffers_size       256k;fastcgi_temp_file_write_size    256k;}
}root@zabbix02:~# vim /etc/zabbix/nginx.conf
server {listen          80;              #打开监听端口server_name     192.168.1.221;   #web访问server的地址#启动所有zabbix相关服务(两个sercer节点执行)
root@zabbix01:~# systemctl enable  zabbix-server zabbix-agent2.service nginx.service php7.4-fpm.service
Synchronizing state of zabbix-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable zabbix-server
Synchronizing state of zabbix-agent2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable zabbix-agent2
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx
Synchronizing state of php7.4-fpm.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable php7.4-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /lib/systemd/system/zabbix-server.service.
root@zabbix01:~# #服务状态查看确认
root@zabbix01:~# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      34001/nginx: master
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      852/systemd-resolve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      922/sshd: /usr/sbin
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      25847/sshd: root@pt
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      34016/zabbix_server
tcp6       0      0 :::80                   :::*                    LISTEN      34001/nginx: master
tcp6       0      0 :::22                   :::*                    LISTEN      922/sshd: /usr/sbin
tcp6       0      0 ::1:6010                :::*                    LISTEN      25847/sshd: root@pt
tcp6       0      0 :::10050                :::*                    LISTEN      33973/zabbix_agent2
tcp6       0      0 :::10051                :::*                    LISTEN      34016/zabbix_server

7.zabbix web配置

web访问:
http://server_ip/setup.php

在这里插入图片描述

检查php配置是否ok

在这里插入图片描述

web配置数据库

在这里插入图片描述

配置zabbix server name
配置web主题

在这里插入图片描述

查看全部配置信息

在这里插入图片描述
在这里插入图片描述

用户登录
Admin:zabbix

在这里插入图片描述

现在我们就成功登录web监控平台了

在这里插入图片描述

系统节点查看:可以看到当前已运行一个节点,有一个备用节点

在这里插入图片描述

6.zabbix web中文字符安装

#安装中文语言包
root@zabbix01:~# sudo apt install language-pack-zh-hans#system使用中文语言包(打开中文配置项:zh_CN.UTF-8 UTF-8)
root@zabbix01:~# sudo vim /etc/locale.gen
zh_CN.UTF-8 UTF-8#重启php服务即可(语言包即生效)
root@zabbix02:~# systemctl restart php7.4-fpm.service

选择配置中文语言:

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

这篇关于@Zabbix6.0 HA原生高可用集群部署方案(Ubuntu 20.04)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/646392

相关文章

闲置电脑也能活出第二春?鲁大师AiNAS让你动动手指就能轻松部署

对于大多数人而言,在这个“数据爆炸”的时代或多或少都遇到过存储告急的情况,这使得“存储焦虑”不再是个别现象,而将会是随着软件的不断臃肿而越来越普遍的情况。从不少手机厂商都开始将存储上限提升至1TB可以见得,我们似乎正处在互联网信息飞速增长的阶段,对于存储的需求也将会不断扩大。对于苹果用户而言,这一问题愈发严峻,毕竟512GB和1TB版本的iPhone可不是人人都消费得起的,因此成熟的外置存储方案开

服务器集群同步时间手记

1.时间服务器配置(必须root用户) (1)检查ntp是否安装 [root@node1 桌面]# rpm -qa|grep ntpntp-4.2.6p5-10.el6.centos.x86_64fontpackages-filesystem-1.41-1.1.el6.noarchntpdate-4.2.6p5-10.el6.centos.x86_64 (2)修改ntp配置文件 [r

无人叉车3d激光slam多房间建图定位异常处理方案-墙体画线地图切分方案

墙体画线地图切分方案 针对问题:墙体两侧特征混淆误匹配,导致建图和定位偏差,表现为过门跳变、外月台走歪等 ·解决思路:预期的根治方案IGICP需要较长时间完成上线,先使用切分地图的工程化方案,即墙体两侧切分为不同地图,在某一侧只使用该侧地图进行定位 方案思路 切分原理:切分地图基于关键帧位置,而非点云。 理论基础:光照是直线的,一帧点云必定只能照射到墙的一侧,无法同时照到两侧实践考虑:关

HDFS—集群扩容及缩容

白名单:表示在白名单的主机IP地址可以,用来存储数据。 配置白名单步骤如下: 1)在NameNode节点的/opt/module/hadoop-3.1.4/etc/hadoop目录下分别创建whitelist 和blacklist文件 (1)创建白名单 [lytfly@hadoop102 hadoop]$ vim whitelist 在whitelist中添加如下主机名称,假如集群正常工作的节

Hadoop集群数据均衡之磁盘间数据均衡

生产环境,由于硬盘空间不足,往往需要增加一块硬盘。刚加载的硬盘没有数据时,可以执行磁盘数据均衡命令。(Hadoop3.x新特性) plan后面带的节点的名字必须是已经存在的,并且是需要均衡的节点。 如果节点不存在,会报如下错误: 如果节点只有一个硬盘的话,不会创建均衡计划: (1)生成均衡计划 hdfs diskbalancer -plan hadoop102 (2)执行均衡计划 hd

高效+灵活,万博智云全球发布AWS无代理跨云容灾方案!

摘要 近日,万博智云推出了基于AWS的无代理跨云容灾解决方案,并与拉丁美洲,中东,亚洲的合作伙伴面向全球开展了联合发布。这一方案以AWS应用环境为基础,将HyperBDR平台的高效、灵活和成本效益优势与无代理功能相结合,为全球企业带来实现了更便捷、经济的数据保护。 一、全球联合发布 9月2日,万博智云CEO Michael Wong在线上平台发布AWS无代理跨云容灾解决方案的阐述视频,介绍了

阿里开源语音识别SenseVoiceWindows环境部署

SenseVoice介绍 SenseVoice 专注于高精度多语言语音识别、情感辨识和音频事件检测多语言识别: 采用超过 40 万小时数据训练,支持超过 50 种语言,识别效果上优于 Whisper 模型。富文本识别:具备优秀的情感识别,能够在测试数据上达到和超过目前最佳情感识别模型的效果。支持声音事件检测能力,支持音乐、掌声、笑声、哭声、咳嗽、喷嚏等多种常见人机交互事件进行检测。高效推

Android平台播放RTSP流的几种方案探究(VLC VS ExoPlayer VS SmartPlayer)

技术背景 好多开发者需要遴选Android平台RTSP直播播放器的时候,不知道如何选的好,本文针对常用的方案,做个大概的说明: 1. 使用VLC for Android VLC Media Player(VLC多媒体播放器),最初命名为VideoLAN客户端,是VideoLAN品牌产品,是VideoLAN计划的多媒体播放器。它支持众多音频与视频解码器及文件格式,并支持DVD影音光盘,VCD影

搭建Kafka+zookeeper集群调度

前言 硬件环境 172.18.0.5        kafkazk1        Kafka+zookeeper                Kafka Broker集群 172.18.0.6        kafkazk2        Kafka+zookeeper                Kafka Broker集群 172.18.0.7        kafkazk3

pico2 开发环境搭建-基于ubuntu

pico2 开发环境搭建-基于ubuntu 安装编译工具链下载sdk 和example编译example 安装编译工具链 sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib 注意cmake的版本,需要在3.17 以上 下载sdk 和ex