@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

相关文章

mysql_mcp_server部署及应用实践案例

《mysql_mcp_server部署及应用实践案例》文章介绍了在CentOS7.5环境下部署MySQL_mcp_server的步骤,包括服务安装、配置和启动,还提供了一个基于Dify工作流的应用案例... 目录mysql_mcp_server部署及应用案例1. 服务安装1.1. 下载源码1.2. 创建独立

C#高效实现在Word文档中自动化创建图表的可视化方案

《C#高效实现在Word文档中自动化创建图表的可视化方案》本文将深入探讨如何利用C#,结合一款功能强大的第三方库,实现在Word文档中自动化创建图表,为你的数据呈现和报告生成提供一套实用且高效的解决方... 目录Word文档图表自动化:为什么选择C#?从零开始:C#实现Word文档图表的基本步骤深度优化:C

Nginx服务器部署详细代码实例

《Nginx服务器部署详细代码实例》Nginx是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务,:本文主要介绍Nginx服务器部署的相关资料,文中通过代码... 目录Nginx 服务器SSL/TLS 配置动态脚本反向代理总结Nginx 服务器Nginx是一个‌高性

JavaWeb项目创建、部署、连接数据库保姆级教程(tomcat)

《JavaWeb项目创建、部署、连接数据库保姆级教程(tomcat)》:本文主要介绍如何在IntelliJIDEA2020.1中创建和部署一个JavaWeb项目,包括创建项目、配置Tomcat服务... 目录简介:一、创建项目二、tomcat部署1、将tomcat解压在一个自己找得到路径2、在idea中添加

Python + Streamlit项目部署方案超详细教程(非Docker版)

《Python+Streamlit项目部署方案超详细教程(非Docker版)》Streamlit是一款强大的Python框架,专为机器学习及数据可视化打造,:本文主要介绍Python+St... 目录一、针对 Alibaba Cloud linux/Centos 系统的完整部署方案1. 服务器基础配置(阿里

MySQL MHA集群详解(数据库高可用)

《MySQLMHA集群详解(数据库高可用)》MHA(MasterHighAvailability)是开源MySQL高可用管理工具,用于自动故障检测与转移,支持异步或半同步复制的MySQL主从架构,本... 目录mysql 高可用方案:MHA 详解与实战1. MHA 简介2. MHA 的组件组成(1)MHA

SpringSecurity中的跨域问题处理方案

《SpringSecurity中的跨域问题处理方案》本文介绍了跨域资源共享(CORS)技术在JavaEE开发中的应用,详细讲解了CORS的工作原理,包括简单请求和非简单请求的处理方式,本文结合实例代码... 目录1.什么是CORS2.简单请求3.非简单请求4.Spring跨域解决方案4.1.@CrossOr

使用MyBatis TypeHandler实现数据加密与解密的具体方案

《使用MyBatisTypeHandler实现数据加密与解密的具体方案》在我们日常的开发工作中,经常会遇到一些敏感数据需要存储,比如用户的手机号、身份证号、银行卡号等,为了保障数据安全,我们通常会对... 目录1. 核心概念:什么是 TypeHandler?2. 实战场景3. 代码实现步骤步骤 1:定义 E

Python实现繁体转简体功能的三种方案

《Python实现繁体转简体功能的三种方案》在中文信息处理中,繁体字与简体字的转换是一个常见需求,无论是处理港澳台地区的文本数据,还是开发面向不同中文用户群体的应用,繁简转换都是不可或缺的功能,本文将... 目录前言为什么需要繁简转换?python实现方案方案一:使用opencc库方案二:使用zhconv库

MongoDB搭建过程及单机版部署方法

《MongoDB搭建过程及单机版部署方法》MongoDB是一个灵活、高性能的NoSQL数据库,特别适合快速开发和大规模分布式系统,本文给大家介绍MongoDB搭建过程及单机版部署方法,感兴趣的朋友跟随... 目录前言1️⃣ 核心特点1、文档存储2、无模式(Schema-less)3、高性能4、水平扩展(Sh