前言
Zabbix是目前最为主流的开源监控方案之一,部署本身并不困难,难的是深入理解。根据在生产环境的实践从新版Zabbix 4.0 LTS开始全部使用Docker部署,我相信未来越来越多的开源组件都会以容器化的形式呈现在我们面前。
操作系统:
[root@mysql ~]# cat /etc/redhat-releaseCentOS Linux release 7.5.1804 (Core)
Mysql : 版本5.7.23 192.168.75.251
Zabbix Server:版本3.4.12 192.168.75.250
一、安装Mysql
1.1下载mysql
关闭防火墙
#systemctl stop firewalld# systemctl disable firewalldvi /etc/selinux/configSELINUX=enforcing 改为 SELINUX= disabled
Centos7 默认数据库为mariadb ,先卸载
rpm qa |grep mariadbmariadb-libs-5.5.56-2.el7.x86_64rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
这个版本需要boost 1.9,也要下载
[root@mysql soft]# lltotal 132444-rw-r--r-- 1 root root 83709983 Aug 10 10:26 boost_1_59_0.tar.gz-rw-r--r-- 1 root root 51907462 Aug 10 10:26 mysql-5.7.23.tar.gz
添加mysql用户,
groupadd mysqluseradd -g mysql -s /sbin/nologin mysql
1.2安装依赖包
yum install -y cmake bison bison-devel libaio-devel gcc gcc-c++ git ncurses-devel
1.3编译
解压mysql ,把boost的压缩版放到解压后的mysql目录内
tar xzvf mysql-5.7.23.tar.gzmv boost_1_59_0.tar.gz mysql-5.7.23
进入MySQL源文件目录,新建configure做为编译目录,并进入该目
cd mysql-5.7.23mkdir configurecd configure
使用cmake进行生成编译环境,
cmake .. -DBUILD_CONFIG=mysql_release /-DINSTALL_LAYOUT=STANDALONE /-DCMAKE_BUILD_TYPE=RelWithDebInfo /-DENABLE_DTRACE=OFF /-DWITH_EMBEDDED_SERVER=OFF /-DWITH_INNODB_MEMCACHED=ON /-DWITH_SSL=bundled /-DWITH_ZLIB=system /-DWITH_PAM=ON /-DCMAKE_INSTALL_PREFIX=/var/mysql/ /-DINSTALL_PLUGINDIR="/var/mysql/lib/plugin" /-DDEFAULT_CHARSET=utf8 /-DDEFAULT_COLLATION=utf8_general_ci /-DWITH_EDITLINE=bundled /-DFEATURE_SET=community /-DCOMPILATION_COMMENT="MySQL Server (GPL)" /-DWITH_DEBUG=OFF /-DWITH_BOOST=..
安装
make && make install
修改配置文件
vim /etc/my.cnf[mysqld]datadir=/var/lib/mysqlsocket=/var/mysql/mysql.sockport=3306log_error=/var/mysql/log/error.logbasedir=/var/mysql/[client]socket=/var/mysql/mysql.sockchown mysql.mysql /etc/my.cnf
创建日志文件
mkdir -p /var/mysql/logtouch /var/mysql/log/error.logtouch /var/mysql/mysql.sockchown -R mysql.mysql /var/mysql/
1.4初始化
#/var/mysql/bin/mysqld --initialize --user=mysql
查看数据文件是否生成
#ll /var/lib/mysqltotal 110628-rw-r----- 1 mysql mysql 56 Aug 10 11:06 auto.cnf-rw-r----- 1 mysql mysql 417 Aug 10 11:06 ib_buffer_pool-rw-r----- 1 mysql mysql 12582912 Aug 10 11:06 ibdata1-rw-r----- 1 mysql mysql 50331648 Aug 10 11:06 ib_logfile0-rw-r----- 1 mysql mysql 50331648 Aug 10 11:06 ib_logfile1drwxr-x--- 2 mysql mysql 4096 Aug 10 11:06 mysqldrwxr-x--- 2 mysql mysql 8192 Aug 10 11:06 performance_schemadrwxr-x--- 2 mysql mysql 8192 Aug 10 11:06 sys
新闻热点
疑难解答