TokuDB安裝

一:原因mysql

  1. 監控系統產生的數據相對普通業務數據,具備寫入需求佔絕對多數,讀取相對較少的特色。linux

  2. 以前使用的PMM監控系統,其docker版解決方案,內置的不只不是其自家的percona分支數據庫,並且使用的是較舊的5.5官方分支版本。監控了6個實例的庫和主機後。3周後就佔用了9GB的空間。sql

  3. 欣慰的是,Percona公司考慮到這個狀況,將會自動根據PMM服務器的硬盤可用容量大小自動按期刪除備份的歷史數據。docker

  4. 對一個DBA而言,須要關注到一個庫的歷史負載狀況,方便同比環比進行硬件擴容規劃。最起碼要2年的完整數據吧。數據庫

二:解決方法vim

        採用高壓縮的TokuDB引擎進行壓縮存儲歷史數據。bash

TokuDB is a highly scalable, zero-maintenance downtime MySQL storage engine that delivers indexing-based query acceleration, improved replication performance,     unparalleled compression, and live schema modification. The TokuDB storage 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.ide

三:安裝步驟工具

  1. tokudb既能夠在官方社區版本的MySQL上啓用,也能夠在percona分區上啓用,考慮到要見識下percona分支版本相對官方版本支持較多的監控特性, 此次使用percona-mysql-server版本

  2. 安裝前準備


#systemctl
stop firewalld  #停掉系統防火牆
#systemctl mask firewalld  #屏蔽防火牆自啓動
#setenforce 0              #關閉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-Release
YUM repository - x86_64
        baseurl = http://repo.percona.com/release/7Server/RPMS/x86_64
        enabled = 1
        gpgcheck = 1
        gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Percona
 
       [percona-release-noarch]
       name = Percona-Release
YUM repository - noarch
       baseurl = http://repo.percona.com/release/7Server/RPMS/noarch
       enabled = 1
       gpgcheck = 1
       gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Percona
 
       [percona-release-source]
       name = Percona-Release
YUM repository - Source packages
       baseurl = http://repo.percona.com/release/7Server/SRPMS
       enabled = 0
       gpgcheck = 1
       gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Percona
       EOF



       建立軟件源卻是有個哏,原本Cent7的系統能夠直接在網站上下載epel-release.rpm

       進行安裝。可是FedoraServer26的版本與repo的自判斷特性不太兼容。這裏我手動將

       系統變量判斷手動改爲了7Server,即與RHCE/Cent7使用一樣的源。

 3.開始安裝

   #安裝percona分支MySQL,和相關的備份與工具軟件

   

#yum -y install  percona-toolkit percona-xtrabackup
Percona-Server-server-57


   #安裝依賴庫,這也是坑,fedora源中jemalloc是4.5版本,不兼容。須要手動安裝4.0版本如下的

    你們若是用的CentOS/RHCE應該沒問題的。

   

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


    #安裝TokuDB引擎插件

   

#yum -y install Percona-Server-tokudb-57

    #啓用插件(mysqld進程須要在運行狀態)

   

#ps-admin --enable-tokudb -u root -p
#systemctl restart mysqld
#ps-admin --enable-tokudb -u root -p


 4. 到此爲止,安裝結束了,你們能夠在登入服務器查看

    wKiom1m9C22j-4lOAAEGaqz7aPM891.png-wh_50    


 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版本不對,會出下面錯誤,你們引覺得戒

        

Checking TokuDB engine plugin status...
INFO: TokuDB engine
plugin is not installed.
Installing TokuDB  engine...
ERROR: Failed to install TokuDB engine plugin. Please check error log.

    可是錯誤日誌中沒有記錄。

    嘗試經過手動添加的方式安裝插件:

         mysql>INSTALL PLUGIN tokudb SONAME 'ha_tokudb.so';

                    ERROR 1126 (HY000):

     退出MySQL客戶端查看錯誤代碼:

     

# perror 1126

    輸出以下

  

(ER_CANT_OPEN_LIBRARY): Can't open shared library '%-.192s'     (errno: %d %-.128s)

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

   

注意:

      vim /etc/sysconfig/mysql中應爲:

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

  (my.cnf中註釋掉basedir=/usr/local/mysql)

相關文章
相關標籤/搜索