• ADADADADAD

    如何进行TokuDB的安装[ mysql数据库 ]

    mysql数据库 时间:2024-11-28 13:01:12

    作者:文/会员上传

    简介:

    一:缘由监控系统产生的数据相对普通业务数据,具有写入需求占绝对多数,读取相对较少的特点。之前使用的PMM监控系统,其docker版解决方案,内置的不仅不是其自家的percona分支数据库

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    一:缘由

      监控系统产生的数据相对普通业务数据,具有写入需求占绝对多数,读取相对较少的特点。

      之前使用的PMM监控系统,其docker版解决方案,内置的不仅不是其自家的percona分支数据库,而且使用的是较旧的5.5官方分支版本。监控了6个实例的库和主机后。3周后就占用了9GB的空间。

      欣慰的是,Percona公司考虑到这个情况,将会自动根据PMM服务器的硬盘可用容量大小自动定期删除备份的历史数据。

      对一个DBA而言,需要关注到一个库的历史负载情况,方便同比环比进行硬件扩容规划。最起码要2年的完整数据吧。

    二:解决方法,

    采用高压缩的TokuDB引擎进行压缩存储历史数据。

    TokuDBis a highly scalable, zero-maintenance downtime MySQL storage engine that delivers indexing-based query acceleration, improved replication performance, unparalleled compression, and live schema modification. TheTokuDBstorage engine is a scalable, ACID and MVCC compliant storage engine that provides indexing-based query improvements, offers online schema modifications, and reduces slave lag for both hard disk drives and flash memory.

    This storage engine is specifically designed for high performance on write-intensive workloads which is achieved with Fractal Tree indexing.

    三:安装步骤

      tokudb既可以在官方社区版本的MySQL上启用,也可以在percona分区上启用,考虑到要见识下percona分支版本相对官方版本支持较多的监控特性, 这次使用percona-mysql-server版本

      安装前准备

    #systemctlstopfirewalld#停掉系统防火墙#systemctlmaskfirewalld#屏蔽防火墙自启动#setenforce0#关闭SELinux#sed-i's/Enforcing/Permissive/g'/etc/selinux/config#永久关闭SELinux#创建percona软件源#cat>/etc/yum.repos.d/percona-release.repo<<EOF[percona-release-x86_64]name=Percona-ReleaseYUMrepository-x86_64baseurl=http://repo.percona.com/release/7Server/RPMS/x86_64enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Percona[percona-release-noarch]name=Percona-ReleaseYUMrepository-noarchbaseurl=http://repo.percona.com/release/7Server/RPMS/noarchenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Percona[percona-release-source]name=Percona-ReleaseYUMrepository-Sourcepackagesbaseurl=http://repo.percona.com/release/7Server/SRPMSenabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PerconaEOF

    创建软件源倒是有个哏,本来Cent7的系统可以直接在网站上下载epel-release.rpm

    进行安装。但是FedoraServer26的版本与repo的自判断特性不太兼容。这里我手动将

    系统变量判断手动改成了7Server,即与RHCE/Cent7使用同样的源。

    3.开始安装

    #安装percona分支MySQL,和相关的备份与工具软件

    #yum-yinstallpercona-toolkitpercona-xtrabackupPercona-Server-server-57

    #安装依赖库,这也是坑,fedora源中jemalloc是4.5版本,不兼容。需要手动安装4.0版本以下的

    大家如果用的CentOS/RHCE应该没问题的。

    #yum-yinstallftp://rpmfind.net/linux/fedora/linux/releases/23/Everything/x86_64/os/Packages/j/jemalloc-3.6.0-9.fc23.x86_64.rpm

    #安装TokuDB引擎插件

    #yum-yinstallPercona-Server-tokudb-57

    #启用插件(mysqld进程需要在运行状态)

    #ps-admin--enable-tokudb-uroot-p#systemctlrestartmysqld#ps-admin--enable-tokudb-uroot-p

    4. 到此为止,安装结束了,大家可以在登入服务器查看

    4.5:更改zabbix的建表语句,设置默认引擎为tokuDB,同时更改MySQL默认的引擎

    #更改默认引擎:

    #在my.cnf中添加

    default_storage_engine=TokuDB

    并重启mysqld服务

    #更改zabbix建表语句,设置默认引擎为tokuDB

    #sed-i 's/InnoDB/TokuDB/g' /usr/share/zabbix-mysql/schema.sql

    5.付:若jemalloc版本不对,会出下面错误,大家引以为戒

    CheckingTokuDBenginepluginstatus...INFO:TokuDBenginepluginisnotinstalled.InstallingTokuDBengine...ERROR:FailedtoinstallTokuDBengineplugin.Pleasecheckerrorlog.

    但是错误日志中没有记录。

    尝试通过手动添加的方式安装插件:

    mysql>INSTALLPLUGIN tokudb SONAME 'ha_tokudb.so';

    ERROR 1126(HY000):

    退出MySQL客户端查看错误代码:

    #perror1126

    输出如下

    (ER_CANT_OPEN_LIBRARY):Can'topensharedlibrary'%-.192s'(errno:%d%-.128s)

    就是找不到库文件,回去安装3.6版本的jemalloc

    注意:

    vim /etc/sysconfig/mysql中应为:

    LD_PRELOAD=/usr/lib64/libjemalloc.so.1THP_SETTING=never

    (my.cnf中注释掉basedir=/usr/local/mysql)

    如何进行TokuDB的安装.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: tokudb