您好,登錄后才能下訂單哦!
本篇文章為大家展示了如何進(jìn)行TokuDB的安裝,內(nèi)容簡(jiǎn)明扼要并且容易理解,絕對(duì)能使你眼前一亮,通過(guò)這篇文章的詳細(xì)介紹希望你能有所收獲。
一:緣由
監(jiān)控系統(tǒng)產(chǎn)生的數(shù)據(jù)相對(duì)普通業(yè)務(wù)數(shù)據(jù),具有寫(xiě)入需求占絕對(duì)多數(shù),讀取相對(duì)較少的特點(diǎn)。
之前使用的PMM監(jiān)控系統(tǒng),其docker版解決方案,內(nèi)置的不僅不是其自家的percona分支數(shù)據(jù)庫(kù),而且使用的是較舊的5.5官方分支版本。監(jiān)控了6個(gè)實(shí)例的庫(kù)和主機(jī)后。3周后就占用了9GB的空間。
欣慰的是,Percona公司考慮到這個(gè)情況,將會(huì)自動(dòng)根據(jù)PMM服務(wù)器的硬盤(pán)可用容量大小自動(dòng)定期刪除備份的歷史數(shù)據(jù)。
對(duì)一個(gè)DBA而言,需要關(guān)注到一個(gè)庫(kù)的歷史負(fù)載情況,方便同比環(huán)比進(jìn)行硬件擴(kuò)容規(guī)劃。最起碼要2年的完整數(shù)據(jù)吧。
二:解決方法,
采用高壓縮的TokuDB引擎進(jìn)行壓縮存儲(chǔ)歷史數(shù)據(jù)。
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.
三:安裝步驟
tokudb既可以在官方社區(qū)版本的MySQL上啟用,也可以在percona分區(qū)上啟用,考慮到要見(jiàn)識(shí)下percona分支版本相對(duì)官方版本支持較多的監(jiān)控特性, 這次使用percona-mysql-server版本
安裝前準(zhǔn)備
#systemctl stop firewalld #停掉系統(tǒng)防火墻 #systemctl mask firewalld #屏蔽防火墻自啟動(dòng) #setenforce 0 #關(guān)閉SELinux #sed -i 's/Enforcing/Permissive/g' /etc/selinux/config #永久關(guān)閉SELinux #創(chuàng)建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
創(chuàng)建軟件源倒是有個(gè)哏,本來(lái)Cent7的系統(tǒng)可以直接在網(wǎng)站上下載epel-release.rpm
進(jìn)行安裝。但是FedoraServer26的版本與repo的自判斷特性不太兼容。這里我手動(dòng)將
系統(tǒng)變量判斷手動(dòng)改成了7Server,即與RHCE/Cent7使用同樣的源。
3.開(kāi)始安裝
#安裝percona分支MySQL,和相關(guān)的備份與工具軟件
#yum -y install percona-toolkit percona-xtrabackup Percona-Server-server-57
#安裝依賴(lài)庫(kù),這也是坑,fedora源中jemalloc是4.5版本,不兼容。需要手動(dòng)安裝4.0版本以下的
大家如果用的CentOS/RHCE應(yīng)該沒(méi)問(wèn)題的。
#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進(jìn)程需要在運(yùn)行狀態(tài))
#ps-admin --enable-tokudb -u root -p #systemctl restart mysqld #ps-admin --enable-tokudb -u root -p
4. 到此為止,安裝結(jié)束了,大家可以在登入服務(wù)器查看
4.5:更改zabbix的建表語(yǔ)句,設(shè)置默認(rèn)引擎為tokuDB,同時(shí)更改MySQL默認(rèn)的引擎
#更改默認(rèn)引擎:
#在my.cnf中添加
default_storage_engine=TokuDB
并重啟mysqld服務(wù)
#更改zabbix建表語(yǔ)句,設(shè)置默認(rèn)引擎為tokuDB
#sed -i 's/InnoDB/TokuDB/g' /usr/share/zabbix-mysql/schema.sql
5.付:若jemalloc版本不對(duì),會(huì)出下面錯(cuò)誤,大家引以為戒
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.
但是錯(cuò)誤日志中沒(méi)有記錄。
嘗試通過(guò)手動(dòng)添加的方式安裝插件:
mysql>INSTALL PLUGIN tokudb SONAME 'ha_tokudb.so';
ERROR 1126 (HY000):
退出MySQL客戶(hù)端查看錯(cuò)誤代碼:
# perror 1126
輸出如下
(ER_CANT_OPEN_LIBRARY): Can't open shared library '%-.192s' (errno: %d %-.128s)
就是找不到庫(kù)文件,回去安裝3.6版本的jemalloc
注意:
vim /etc/sysconfig/mysql中應(yīng)為:
LD_PRELOAD=/usr/lib64/libjemalloc.so.1 THP_SETTING=never
(my.cnf中注釋掉basedir=/usr/local/mysql)
上述內(nèi)容就是如何進(jìn)行TokuDB的安裝,你們學(xué)到知識(shí)或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識(shí)儲(chǔ)備,歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。