基于AnolisOS8.6+GreatSQL部署ZABBIX6.0

测试环境

AnolisOS-8.6-x86_64-minimal.iso

基于Virtual Box创建虚拟机,2 vCPU, 4G RAM, 40 vDisk

GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64

ZABBIX 6.0 LTS

注:安装过程须联网

安装依赖

yum install -y pkg-config perl libaio-devel numactl-devel numactl-libs net-tools openssl openssl-devel perl-Data-Dumper perl-Digest-MD5 compat-openssl10

安装jemalloc

yum install epel-release -y

yum install -y jemalloc jemalloc-devel

注:安装后建议删除epel-release,yum remove epel-release -y

安装GreatSQL单机版

软件包下载

https://gitee.com/GreatSQL/GreatSQL/releases

软件包安装

xz -d GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64.tar.xz

mv GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64.tar /usr/local/

cd /usr/local/

tar xf GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64.tar

注:不要轻易修改解压后的目录名字,GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64。如果改了,需要修改mysqld_pre_systemd文件中引用的目录。

编辑systemd系统服务

vi /usr/lib/systemd/system/greatsql.service

[Unit]
Description=GreatSQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]

LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=65535
LimitNPROC=65535
LimitMEMLOCK=infinity
TasksMax=infinity
TasksAccounting=false

User=mysql
Group=mysql
Type=notify
TimeoutSec=0
PermissionsStartOnly=true
ExecStartPre=/usr/local/GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64/bin/mysqld_pre_systemd
ExecStart=/usr/local/GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64/bin/mysqld $MYSQLD_OPTS
EnvironmentFile=-/etc/sysconfig/mysql
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
Environment=MYSQLD_PARENT_PID=1
PrivateTmp=false

加载systemd

systemctl daemon-reload

编辑GreatSQL全局配置文件/etc/my.cnf

vi /etc/my.cnf

[mysql]
socket=/var/lib/mysql/mysql.sock

[mysqld]
user=mysql
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
default_authentication_plugin=mysql_native_password

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

创建用户并设置权限

groupadd mysql

useradd -g mysql mysql -d /dev/null -s /sbin/nologin

mkdir /var/run/mysqld/ /var/lib/mysql-files/ /var/lib/mysql/

chown -R mysql:mysql /var/run/mysqld/ /var/lib/mysql-files/ /var/lib/mysql/ /usr/local/GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64/

touch /var/log/mysqld.log

chown mysql:mysql /var/log/mysqld.log

编辑mysqld_pre_systemd脚本文件 [可选]

cd /usr/local/GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64/bin

将文件中的 /usr/local/GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64/bin/改为实际安装目录。

设置软连接

cd /usr/local/GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64/lib/private/

rm -f libcrypto.so.10

rm -f libssl.so.10

ln -s /lib64/libcrypto.so.1.0.2o libcrypto.so.10

ln -s /lib64/libssl.so.1.0.2o libssl.so.10

cd /lib64/

rm -f libcrypto.so

rm -f libssl.so

ln -s libcrypto.so.1.0.2o libcrypto.so

ln -s libssl.so.1.0.2o libssl.so

ll | grep libssl

ll | grep libcrypto.so

启动服务

systemctl start greatsql

systemctl status greatsql

systemctl enable greatsql

ps -ef | grep mysqld

ll /var/lib/mysql

获取默认密码

cat /var/log/mysqld.log|grep password

2024-05-23T01:49:42.664134Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: -Rf?gDe.o4y2

修改密码

/usr/local/GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64/bin/mysql -uroot -p

ALTER USER CURRENT_USER() IDENTIFIED BY ‘GreatSql@2024!’;

安装Zabbix 6.0

https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-4.el8.noarch.rpm

rpm -ivh zabbix-release-6.0-4.el8.noarch.rpm

yum clean all

yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent

创建数据库

/usr/local/GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64/bin/mysql -uroot -p

create database zabbix character set utf8mb4 collate utf8mb4_bin;

create user ‘zabbix’@‘192.168.31.0/255.255.255.0’ identified WITH mysql_native_password by ‘GreatSql@2024!’;

grant all on zabbix.* to ‘zabbix’@‘192.168.31.0/255.255.255.0’;

set global log_bin_trust_function_creators=1;

quit

导入数据库

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | /usr/local/GreatSQL-8.0.32-25-Linux-glibc2.17-x86_64/bin/mysql -h 192.168.31.69 --default-character-set=utf8mb4 -uzabbix -p zabbix

编辑zabbix配置文件

vi /etc/zabbix/zabbix_server.conf

DBHost=192.168.31.69

DBUser=zabbix

DBPassword=GreatSql@2024!

DBPort=3306

grep -v “^$|#” /etc/zabbix/zabbix_server.conf

vi /etc/httpd/conf/httpd.conf

ServerName 192.168.31.69:80

vi /etc/php-fpm.d/zabbix.conf,在末尾添加下面内容

php_value[date.timezone] = Asia/Shanghai

启动zabbix服务

systemctl restart zabbix-server zabbix-agent httpd php-fpm

systemctl enable zabbix-server zabbix-agent httpd php-fpm

systemctl status zabbix-server zabbix-agent httpd php-fpm

访问zabbix WEB,注意修改数据库配置

http://192.168.31.69/zabbix

注:初始帐号和密码,Admin / zabbix

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值