@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

相关文章

Ubuntu 24.04启用root图形登录的操作流程

《Ubuntu24.04启用root图形登录的操作流程》Ubuntu默认禁用root账户的图形与SSH登录,这是为了安全,但在某些场景你可能需要直接用root登录GNOME桌面,本文以Ubuntu2... 目录一、前言二、准备工作三、设置 root 密码四、启用图形界面 root 登录1. 修改 GDM 配

MySQL 迁移至 Doris 最佳实践方案(最新整理)

《MySQL迁移至Doris最佳实践方案(最新整理)》本文将深入剖析三种经过实践验证的MySQL迁移至Doris的最佳方案,涵盖全量迁移、增量同步、混合迁移以及基于CDC(ChangeData... 目录一、China编程JDBC Catalog 联邦查询方案(适合跨库实时查询)1. 方案概述2. 环境要求3.

SpringBoot3.X 整合 MinIO 存储原生方案

《SpringBoot3.X整合MinIO存储原生方案》本文详细介绍了SpringBoot3.X整合MinIO的原生方案,从环境搭建到核心功能实现,涵盖了文件上传、下载、删除等常用操作,并补充了... 目录SpringBoot3.X整合MinIO存储原生方案:从环境搭建到实战开发一、前言:为什么选择MinI

golang程序打包成脚本部署到Linux系统方式

《golang程序打包成脚本部署到Linux系统方式》Golang程序通过本地编译(设置GOOS为linux生成无后缀二进制文件),上传至Linux服务器后赋权执行,使用nohup命令实现后台运行,完... 目录本地编译golang程序上传Golang二进制文件到linux服务器总结本地编译Golang程序

Jenkins分布式集群配置方式

《Jenkins分布式集群配置方式》:本文主要介绍Jenkins分布式集群配置方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1.安装jenkins2.配置集群总结Jenkins是一个开源项目,它提供了一个容易使用的持续集成系统,并且提供了大量的plugin满

如何在Ubuntu 24.04上部署Zabbix 7.0对服务器进行监控

《如何在Ubuntu24.04上部署Zabbix7.0对服务器进行监控》在Ubuntu24.04上部署Zabbix7.0监控阿里云ECS服务器,需配置MariaDB数据库、开放10050/1005... 目录软硬件信息部署步骤步骤 1:安装并配置mariadb步骤 2:安装Zabbix 7.0 Server

Ubuntu如何分配​​未使用的空间

《Ubuntu如何分配​​未使用的空间》Ubuntu磁盘空间不足,实际未分配空间8.2G因LVM卷组名称格式差异(双破折号误写)导致无法扩展,确认正确卷组名后,使用lvextend和resize2fs... 目录1:原因2:操作3:报错5:解决问题:确认卷组名称​6:再次操作7:验证扩展是否成功8:问题已解

Knife4j+Axios+Redis前后端分离架构下的 API 管理与会话方案(最新推荐)

《Knife4j+Axios+Redis前后端分离架构下的API管理与会话方案(最新推荐)》本文主要介绍了Swagger与Knife4j的配置要点、前后端对接方法以及分布式Session实现原理,... 目录一、Swagger 与 Knife4j 的深度理解及配置要点Knife4j 配置关键要点1.Spri

SQLite3 在嵌入式C环境中存储音频/视频文件的最优方案

《SQLite3在嵌入式C环境中存储音频/视频文件的最优方案》本文探讨了SQLite3在嵌入式C环境中存储音视频文件的优化方案,推荐采用文件路径存储结合元数据管理,兼顾效率与资源限制,小文件可使用B... 目录SQLite3 在嵌入式C环境中存储音频/视频文件的专业方案一、存储策略选择1. 直接存储 vs

Redis分片集群、数据读写规则问题小结

《Redis分片集群、数据读写规则问题小结》本文介绍了Redis分片集群的原理,通过数据分片和哈希槽机制解决单机内存限制与写瓶颈问题,实现分布式存储和高并发处理,但存在通信开销大、维护复杂及对事务支持... 目录一、分片集群解android决的问题二、分片集群图解 分片集群特征如何解决的上述问题?(与哨兵模