首页 > 其他分享 >zabbix

zabbix

时间:2022-09-02 01:14:19浏览次数:41  
标签:opt root zabbix mysql local localhost

目录


zabbix部署

lamp已构建完成

解压mysql8.0

[root@localhost local]# tar xf mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz 

修改所属主和组

[root@localhost local]# chown -R mysql.mysql /usr/local/mysql
[root@localhost local]# ll /usr/local/mysql -d
lrwxrwxrwx. 1 mysql mysql 35 Sep  1 20:45 /usr/local/mysql -> mysql-8.0.28-linux-glibc2.12-x86_64

配置环境变量

[root@localhost local]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh 
[root@localhost local]# source /etc/profile.d/mysql.sh 

建立数据目录

[root@localhost local]# ll /opt/data/  
drwxr-xr-x. 2 mysql mysql        6 Sep  1 20:49 data

创建头文件

[root@localhost mysql]# ln -sv /usr/local/mysql/include/ /usr/include/mysql/

创建库文件

[root@localhost mysql]# echo "/usr/local/mysql/lib/"  >/etc/ld.so.conf.d/mysql.conf 

导入man帮助文档

[root@localhost mysql]# echo "MANDATORY_MANPATH  /usr/local/mysql/man" >> /etc/man_db.conf 

初始化服务

[root@localhost opt]# mysqld --initialize --user mysql --datadir /opt/da/
2022-09-01T13:06:41.825959Z 0 [System] [MY-013169] [Server] /usr/local/mysql-8.0.28-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.28) initializing of server in progress as process 26663
2022-09-01T13:06:41.838275Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-09-01T13:06:42.662468Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-09-01T13:06:44.008131Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 7Td+9aFqJFQc

编辑主配置文件

[root@localhost opt]# cat /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve

然后安装ncurses-compat-libs

[root@localhost opt]# dnf -y install ncurses-compat-libs 
Bad id for repo:  mariadb, byte =   0
Last metadata expiration check: 1:33:46 ago on Thu 01 Sep 2022 07:36:49 PM CST.
Package ncurses-compat-libs-6.1-9.20180224.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

配置服务启动脚本

[root@localhost ~]# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost ~]# sed -ri 's#^(basedir=).*#\1/usr/local/mysql#g' /etc/init.d/mysqld
[root@localhost ~]# sed -ri 's#^(datadir=).*#\1/opt/data#g' /etc/init.d/mysqld

启动mysql

[root@localhost ~]# /etc/init.d/mysqld start
Starting MySQL.Logging to '/opt/data/localhost.localdomain.err'.
 SUCCESS! 
 [root@localhost opt]# ss -antl
State    Recv-Q   Send-Q     Local Address:Port       Peer Address:Port   Process   
LISTEN   0        128            127.0.0.1:9000            0.0.0.0:*                
LISTEN   0        128              0.0.0.0:22              0.0.0.0:*                
LISTEN   0        70                     *:33060                 *:*                
LISTEN   0        128                    *:3306                  *:*                
LISTEN   0        128                    *:80                    *:*                
LISTEN   0        128                 [::]:22                 [::]:* 

修改密码

[root@localhost opt]# mysql -uroot -p
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 9
Server version: 8.0.28 MySQL Community Server - GPL

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 by 'liuyang123!' ;
Query OK, 0 rows affected (0.01 sec)

解压zabbix压缩包

[root@localhost opt]# tar xf zabbix-6.2.2.tar.gz 

配置zabbix数据库

[root@localhost opt]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected, 2 warnings (0.02 sec)
mysql> create user 'zabbix'@'localhost' identified by 'liuyang123!'
    -> ;
Query OK, 0 rows affected (0.03 sec)

mysql>  grant all privileges on zabbix.* to 'zabbix'@'localhost';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>  SET GLOBAL log_bin_trust_function_creators = 1;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

导入数据

[root@localhost mysql]# mysql -uzabbix -pliuyang123! zabbix < schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@localhost mysql]#  mysql -uzabbix -pliuyang123! zabbix < images.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@localhost mysql]#  mysql -uzabbix -pliuyang123! zabbix < data.sql
mysql: [Warning] Using a password on the command line interface can be insecure.

配置源代码

[root@localhost zabbix-6.2.2]# cd /opt/zabbix-6.2.2
[root@localhost zabbix-6.2.2]# ./configure --enable-server --enable-agent --with-mysql   --with-libcurl --with-libxml2 
  Enable agent:          yes
  Agent details:
    TLS:                   no
    Modbus:                no
    Linker flags:                -rdynamic    
    Libraries:              -lz -lpthread    -lcurl -lm -ldl  -lresolv  -lpcre  
    Configuration file:    /usr/local/etc/zabbix_agentd.conf
    Modules:               /usr/local/lib/modules

  Enable agent 2:        no

  Enable web service:    no

  Enable Java gateway:   no

  LDAP support:          no
  IPv6 support:          no

***********************************************************
*            Now run 'make install'                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              <http://www.zabbix.com>                    *
***********************************************************
make install

配置zabbix服务端

[root@localhost src]# cd /etc/zabbix/
[root@localhost zabbix]# ls
web  zabbix_agentd.conf  zabbix_agentd.d  zabbix_server.conf
[root@localhost zabbix]# vim zabbix_server.conf 
DBPassword=liuyang123!

标签:opt,root,zabbix,mysql,local,localhost
From: https://www.cnblogs.com/TQingS/p/16648362.html

相关文章

  • zabbix_server优化
    造成zabbix性能下降的因素如表所示zabbix性能低下的表现1.   zabbix队列有太多被延迟的item,可以通过administration-queue查看2.   zabbix绘图中经常出现断图,一些i......
  • zabbix4.0.5自动安装脚本
    拿包请在下方留言拿包请在下方留言环境:centos7服务器可以上外网即可 #自动化部署zabbix脚本#!/bin/bash#版本详情#1.zabbix-4.0.5.tar.gz#2.nginx-1.16.1.tar......
  • 记一次因网络变更导致zabbix连接es报400和404
    背景zabbix历史数据存储到es集群,正常工作中的时候,因网络变更导致zabbixserver连接不上es,zabbix日志首先报400错误,之后一直404,es那边报查询相关的错误。现象如下图:......
  • 安装Zabbix客户端zabbix-agent2
    Ubuntu系统:下载链接:http://mirrors.aliyun.com/zabbix/zabbix/6.0/ubuntu/pool/main/z/zabbix/?spm=a2c6h.25603864.0.0.5e804167HzHeoe以ubuntu20.04的64位系统为例:Inde......
  • 10,zabbix web 监控
    url正常返回的值1.创建Webscenarios2.创建zabbix触发器name:short_messagesendstatusisnot100Expression:{u04zbx01.yaya.corp:web.test.fail[short_messa......
  • 十二.zabbix自动化添加主机
    1.为什么需要自动化添加主机当有100台主机需要添加到监控系统,手动一个个添加很繁琐!可以使用zabbix的自动发现和自动注册功能2.主机自动发现2.1自动发现原理自动发现由......
  • Zabbix Server 安装 6.0
    先安装MySQL8.0,方法如下:https://www.cnblogs.com/Magiclala/p/16638781.html然后登录数据库,配置一个用户zabbix,设置密码为password,并配置本地登录权限sudomysql-uroot......
  • Centos 7 zabbix系统安装,超详细!
    1第一步打开官网下载地址,选择合适的版本,这边我用的是3A的服务器centos7.9,zabbix版本是5.0https://www.zabbix.com/cn/download2.安装配置zabbixa.InstallZabbixrepo......
  • install_zabbix_agentd.
    #!/bin/bash#description:zabbix_agentdinstall#set-xrpm-qa|grep-izabbixif["$?"-eq0];thenecho-e"\033[31mzabbixagentwasinstalld\03......
  • zabbix-监控windows日志
    [日志监控介绍]之前,我介绍过[Windows环境监控RMAN备份并发送邮件BAT脚本]的脚本监控方法。这次我们来说说Zabbix监控日志如何实现。日志文件监控,它最主要的是监控......