首页 > 其他分享 >zabbix5.0安装

zabbix5.0安装

时间:2024-08-05 16:51:29浏览次数:15  
标签:bin zabbix5.0 mnt server zabbix mysql 安装 rhd

zabbix

简介
zabbix_server版本: 5.0.12
linux系统版本:      centos7
安装包路径:         https://www.zabbix.com/cn/

yum安装
# install zabbix repository
	rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
	yum clean all
	
# install zabbix-server web前端 agent
	yum install zabbix-server-mysql zabbix-agent
	
# install zabbix frontend
    # 编辑仓库配置文件 开启zabbix-frontend
    	[zabbix-frontend]
    	...
    	enabled=1
    	...
    # 命令行开启
	yum-config-manager --enable rhel-server-rhscl-7-rpms
	# 安装
	yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
安装数据库
version:  mysql_5.7.22_二进制包
安装包位置: https:/downloads.mysql.com/archives/community/

# 下载安装包
wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

# 删除centos7中自带的mariadb-libs
rpm -e mariadb-libs --nodeps

# 创建用户和组并赋予文件夹权限
groupadd -r mysql
useradd -r -g mysql -M -s /bin/false mysql
tar -zxf /root/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

# 将二进制包移动到/usr/local/mysql
mv mysql-5.722-linux-glibc2.12-x86_64 /mnt/rhd/mysql

# 做服务的软链接
ln -s /mnt/rhd/mysql/bin/* /usr/local/bin/

# 创建所需目录
mkdir /mnt/rhd/mysql/conf
mkdir /mnt/rhd/mysql/data
mkdir /mnt/rhd/mysql/dbbak
mkdir /mnt/rhd/mysql/logs
mkdir /mnt/rhd/mysql/redo
mkdir /mnt/rhd/mysql/undo
chown  -R mysql.mysql /mnt/rhd/mysql

# 创建systemctl管理mysql
cat /usr/lib/systemd/system/mysqld.service <<EOF
[Unit]
Description=MySQL Server
After=network.target
[Install]
WantedBy=multi-user.target

[Service]
Type=simple
PrivateNetwork=false
User=mysql
Group=mysql
CapabilityBoundingSet=CAP_IPC_LOCK
ProtectSystem=full
PrivateDevices=true
ProtectHome=true
PermissionsStartOnly=true
PIDFile=/mnt/rhd/mysql/data/mysql.pid
ExecStart=/mnt/rhd/mysql/bin/mysqld_safe --defaults-file=/mnt/rhd/mysql/conf/my.cnf --user=mysql
ExecStop=/bin/kill -9 $MAINPID
KillSignal=SIGTERM
SendSIGKILL=no
Restart=on-abort
RestartSec=5s
UMask=007
PrivateTmp=false
TimeoutStartSec=900
TimeoutStopSec=900
LimitNOFILE=16384
EOF


# 加载配置
systemctl daemon-reload

# 编辑my.cnf配置文件
cat>/mnt/rhd/mysql/conf/my.cnf <<EOF
[client]
port            = 3316
socket          = /mnt/rhd/mysql/logs/mysql.sock

[mysqld]
explicit_defaults_for_timestamp=true
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER 

port             = 3316
basedir          = /mnt/rhd/mysql
datadir          = /mnt/rhd/mysql/data
server_id        = 803316
socket           = /mnt/rhd/mysql/logs/mysql.sock
back_log         = 350
connect_timeout  = 20
event_scheduler  = off
local_infile     = off
secure_file_priv = /mnt/rhd/mysql/dbbak
pid-file         = /mnt/rhd/mysql/data/mysql.pid
wait_timeout     = 1800
interactive_timeout  =1800
character_set_server = utf8mb4
skip_name_resolve
log_timestamps=system
skip-ssl
disable-partition-engine-check
#skip_grant_tables

#########  bin log      ####################
binlog_format                = row
binlog_row_image             = full
binlog_cache_size            = 2M
max_binlog_size              = 1G
max_binlog_cache_size        = 4G
binlog_rows_query_log_events = 0
master_verify_checksum       = 1
slave_allow_batching         = 1
expire_logs_days             = 7
log-bin                      =/mnt/rhd/mysql/logs/mysql_bin

######### error log    ####################
#log_warnings     = 2
log_error        = /mnt/rhd/mysql/logs/error.log
log_syslog
log_syslog_tag   = 3316
########## general_log ####################
#general_log_file = /mnt/rhd/mysql/logs/general.log


########## slow log    ####################
long_query_time               = 1 
slow_query_log                = on 
log_queries_not_using_indexes = off
#log_slow_admin_statements     = on
slow_query_log_file = /mnt/rhd/mysql/logs/slow.log

skip_slave_start
read_only                 = off
slave_parallel_type       = logical_clock
slave_parallel_workers    = 4
relay_log_info_repository = TABLE
master_info_repository    = TABLE
relay_log_recovery        = on
sync_master_info          = 10000
slave_compressed_protocol = off
slave_net_timeout         = 10
log_slave_updates
relay_log=/mnt/rhd/mysql/logs/relay_bin
#auto-increment-increment = 2
#auto-increment-offset = 2
#slave_skip_errors = all
#slave-skip-errors=1064 1146 1062
#rpl_semi_sync_master_enabled = ON
#rpl_semi_sync_slave_enabled = ON
#rpl_semi_sync_master_timeout = 10000
gtid_mode                = ON
enforce_gtid_consistency = ON
relay_log_purge=0

#replicate_wild_ignore_table =mysql.%
#replicate_wild_ignore_table =information_schema.%
#replicate_wild_ignore_table =performance_scheme.%
#replicate_wild_ignore_table =sys.%
#replicate_wild_ignore_table =percona.%



########### innodb ####################
default_storage_engine          = InnoDB
innodb_buffer_pool_size         = 12G
innodb_buffer_pool_instances    = 6
innodb_data_home_dir            = /mnt/rhd/mysql/data/
#innodb_data_file_path           = ibdata1:1000M;ibdata2:100M:autoextend
innodb_log_group_home_dir       = /mnt/rhd/mysql/redo/
innodb_log_files_in_group       = 3
innodb_log_file_size            = 256M
innodb_log_buffer_size          = 8M
innodb_lock_wait_timeout        = 40
innodb_file_per_table           = 1
innodb_stats_on_metadata        = OFF
lower_case_table_names          = 1
innodb_flush_method             = O_DIRECT
innodb_flush_log_at_trx_commit  = 1
log_bin_trust_function_creators = 1
sync_binlog			= 1
innodb_open_files               = 1024
innodb_thread_concurrency       = 0
innodb_print_all_deadlocks      = ON
performance_schema              = ON
innodb_undo_log_truncate        = 1
innodb_undo_tablespaces         = 0
innodb_rollback_segments        = 128
innodb_max_undo_log_size        = 1073741824
innodb_undo_directory           = /mnt/rhd/mysql/undo/

#innodb_purge_threads           = 1
##innodb_write_io_threads       = 4
##innodb_read_io_threads        = 4

#thread_pool
#thread_handling                =pool-of-threads
#thread_pool_stall_limit        =10



#########for SSD ###################
innodb_io_capacity       = 2000 
innodb_adaptive_flushing = OFF
innodb_flush_neighbors   = 2

#########per_thread_buffers####################
max_connections           = 3000
max_connect_errors        = 2048
max_allowed_packet        = 32M
max_heap_table_size       = 256M
tmp_table_size            = 256M
max_prepared_stmt_count   = 1M
query_alloc_block_size    = 128K
query_cache_limit         = 0
query_cache_size          = 0
join_buffer_size          = 512k
key_buffer_size           = 1M
query_cache_type          = 0
query_prealloc_size       = 64K
read_buffer_size          = 1M
read_rnd_buffer_size      = 512K
sort_buffer_size          = 2M
table_open_cache          = 2048
table_open_cache_instances= 8
thread_cache_size         = 128
group_concat_max_len      = 2048
skip-external-locking

#myisam
#myisam_recover_options=BACKUP,FORCE
#key_buffer_size=2G

[mysqldump]
max_allowed_packet = 32M
EOF


# 初始化mysql,记住初始密码
mysqld --initialize --user=mysql --basedir=/mnt/rhd/mysql/ --datadir=/mnt/rhd/mysql/data


# 修改密码
systemctl restart mysqld
mysqlpwd=刚才初始化是自动生成的密码
mysql -uroot -p${mysqlpwd} -e 'alter user root@localhost identified by"123.com"' --connect-expired-password


# 创建zabbix数据库
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;


# 导入数据库
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

# 禁用 log_bin_trust_function_creators选项
# mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
配置zabbix_server配置文件
# /etc/zabbix/zabbix_server.conf
DBPassword=password
配置php文件
# /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai
启动服务
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
访问

http:IP/zabbix

检查所有组件ok -----------------> 填写mysql数据库的连接信息 -----------------> 其他直接点击下一步 ---------> successfully-------finish

测试
# 网页端添加主机,查看是否有监控值


# 服务命令行端测试
zabbix_get -s 127.0.0.1 -p 10050 -k system.cpu.load[all,avg1]

问题
# 问题一: 显示中文乱码解决方法
  ### zabbix-server 服务器上安装如下文件字符集
      yum install wqy-microhei-fonts
  ### 然后替换linux上默认的字符集
  	  cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
  ### 重启
  		systemctl restart zabbix-server

标签:bin,zabbix5.0,mnt,server,zabbix,mysql,安装,rhd
From: https://www.cnblogs.com/kkit/p/18343577

相关文章

  • Centos7 安装 Imc
    centos7安装imc注意:安装的时候必须选择图形化安装。即安装系统的时候,“软件选择”那块选择“带GUI的服务器”。关闭selinux和防火墙systemctlstopfirewalldsystemctldisablefirewalldsetenforce0sed-i"s/^SELINUX=enforcing/SELINUX=disabled/g"/etc/sysco......
  • 如何在linux系统上安装tomcat应用程序?
    1)首先查看安装包信息yuminfotomcatyuminfotomcat2)安装yum-yinstalltomcatyum-yinstalltomcat3)查看安装是否成功rpm-qtomcatrpm-qtomcat4)如果输出一下内容则代表安装成功tomcat-7.0.76-16.el7_9.noarch5)执行vi/etc/profile添加下列内容vi/etc......
  • centos下使用阿里云镜像安装docker
    环境:OS:Centos7步骤1:[[email protected]]#yuminstall-yyum-utilsdevice-mapper-persistent-datalvm2Loadedplugins:fastestmirror,langpacksLoadingmirrorspeedsfromcachedhostfileCouldnotretrievemirrorlisthttp://mirrorlist.centos.org/?......
  • Typecho在Ubuntu 22.04上的安装部署
    安装Nginx并配置访问安装PHP并输出脚本结果配置typechoNginx安装并验证aptinstallnginxsystemctlstartnginx正常情况应该可以看到Nginx的欢迎页面了,如果看不到就是防火墙的问题,设置下防火墙放通即可。安装PHP并使用Nginx代理aptinstallphp-fpmphp-curlphp-gd......
  • mysql8安装和部署
    mysql8.0详细安装教程参考文章 一、拉取mysql8.0数据库镜像dockerpullmysql:8.0二、创建配置、数据、日志挂载目录mkdir-p/data/mysql/confmkdir-p/data/mysql/datamkdir-p/data/mysql/logs三、新建my.cnf配置文件1、进入配置文件夹cd/data/mysql/conf2......
  • 如何判断反射内存卡是否安装成功
    要判断反射内存卡是否安装成功,可以通过以下几种方法:在操作系统中查看设备管理器:Windows系统:1.按下Win+X组合键,选择“设备管理器”。在设备管理器中,查找“网络适配器”、“存储控制器”或相关的类别,看是否有与反射内存卡对应的设备显示,且没有黄色感叹号或问号等异常标......
  • 安装CPU版本的TensorFlow教程
    在这篇博客中,我将详细介绍如何在Conda虚拟环境中安装CPU版本的TensorFlow。第一步,首先在安装前你需要检查你的电脑中是否安装VisualStudio,在应用中搜索visual,如下图,如果有就跳到下一步,没有的话就跟着下面步骤安装。 VisualStudio安装,复制链接到浏览器打开,选择适合你电脑......
  • Python,volcengine-python-sdk,安装失败,提示which is required to install pyproject.to
    问题描述:我是安装截止20240804发布的最新版本,volcengine-python-sdk-1.0.94.tar.gz报错一报错最后提示:whichisrequiredtoinstallpyproject.toml-basedprojects...note:Thiserrororiginatesfromasubprocess,andislikelynotaproblemwithpip.ERROR:Fai......
  • 华为欧拉系统离线安装MySQL5.7步骤
    一、需要准备的软件1、mysql官网下载地址:https://dev.mysql.com/downloads/mysql/下载mysql-5.7.24-linux-glibc2.12-x86_64.tar二、下面开始部署安装mysql1、创建新的用户组和新的用户,用来管理mysql,提高安全性#创建新数组mysqlgroupaddmysql#创建用户mysql,指......
  • centos安装maven
    1.下载maven去官网选择自己需要的版本  Maven–DownloadApacheMaven复制链接2.使用wget下载先切换到opt文件夹再将复制的链接使用wget下载因为wget下载速度很慢,所以这里使用https://mirrors.tuna.tsinghua.edu.cn镜像cd/optwgethttps://mirrors.tuna.tsingh......