centos6.4 installation Flashcache

Source: Internet
Author: User

Flashcache is another masterpiece of Facebook's technical team, originally designed to speed up MySQL.
Flashcache is at the Linux level, so any software or application that is trapped by disk IO is easy to use.
Why is it used to speed up MySQL, this involves database expertise, the traditional disk random write random reading efficiency is quite low, need to carry out mechanized seek to read, although many academic papers on the database optimization has been in these aspects. So the existence of SSD seems to solve the problem of random read and write, because SSD is solid state memory, that is, there is no mechanical seek and magnetization problems, but through the potential of 01, random reading and writing efficiency is very good.
But SSD has a congenital flaw, that is to write the data must be erased before, this is why, this and the principle of SSD, potential conversion problem, is the first space all set, in the power to change the correct potential of each cell, then will inevitably affect the life of the SSD, Equivalent to one write conversion in order to write two times. If the use of SSDs has not been well optimized, then the life of the SSD will be limited, so the loss equalization algorithm is also the focus of SSD research, it seems that should now have a mature solution.
Although SSD devices are well-balanced, the user is familiar with the SSD's flaws, so it has to be handled with care, so the location of the SSD in storage, usually as a read cache, is used to improve the system's IO performance. Flashcache is the use of SSD devices for this purpose.

Flashcache is a module of Linux that can be loaded dynamically in Linux.
Flashcache caches the hotspot data by adding a cache layer between the file system (VFS) and the device driver. Use SSDs as a cache to speed up the system by caching popular data on a traditional hard drive onto SSDs and then leveraging SSD's excellent read performance. This method is faster than memory cache, but the space can be much larger than memory. (SSD price is higher than disk, less than memory)

Icon:

/DEV/SDB is an SSD device,/DEV/SDA is a traditional disk device, and after loading the Flashcache, the two devices are virtualized into a block device with a cache/dev/mapper/cachedev

Well, the crap is over, and we're starting to actually do it.

1. Environment preparation and installation of required packages

# cat/etc/6.4  (Final) Kernel \ r on an \m
Yum--IVH http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm Yum-y install dkms gcc make yum-utils kernel kernel-devel git make gcc-c++ device-mapper
Yum-y Install unifdef.x86_64

At the same time, Flashcache needs the entire source tree to see

[Email protected] ~]# ll/usr/src/kernels/2.6. +-431.29.2. el6.x86_64/Total Dosage3288drwxr-xr-x. -Root root4096October A  the: toARCHDRWXR-xr-x.2Root root4096October A  the: toBLOCKDRWXR-xr-x.5Root root4096October A  the: toCRYPTODRWXR-xr-x. theRoot root4096October A  the: toDRIVERSDRWXR-xr-x.3Root root4096October A  the: toFIRMWAREDRWXR-xr-x. inRoot root4096October A  the: toFSDRWXR-xr-x. +Root root4096October A  the: toINCLUDEDRWXR-xr-x.2Root root4096October A  the: toINITDRWXR-xr-x.2Root root4096October A  the: toIPCDRWXR-xr-x.8Root root4096October A  the: toKERNELDRWXR-xr-x.7Root root4096October A  the: toLib-rw-r--r--.1Root root57000SeptemberTen  .: GenevaMakefile-rw-r--r--.1Root root1152SeptemberTen  .: GenevaMAKEFILE.COMMONDRWXR-xr-x.2Root root4096October A  the: tomm-rw-r--r--.1Root root697350SeptemberTen  .: GenevaMODULE.SYMVERSDRWXR-xr-x. theRoot root4096October A  the: toNETDRWXR-xr-x.6Root root4096October A  the: toSAMPLESDRWXR-xr-x. ARoot root4096October A  the: toSCRIPTSDRWXR-xr-x.7Root root4096October A  the: toSECURITYDRWXR-xr-x. +Root root4096October A  the: to Sound-rw-r--r--.1Root root2519815SeptemberTen  .: GenevaSYSTEM.MAPDRWXR-xr-x.7Root root4096October A  the: toTOOLSDRWXR-xr-x.2Root root4096October A  the: toUSRDRWXR-xr-x.3Root root4096October A  the: toVirt

If not, the download is placed in the specified location

wget http://ftp.redhat.com/pub/redhat/linux/enterprise/6server/en/os/srpms/kernel-2.6.32-358.el6.src.rpm

Enter Flashcache Directory compilation

# CD Flashcache
# Make kernel_tree=/usr/src/kernels/2.6.32-431.29.2.el6.x86_64/

Go ahead without an error.

Make install

Error occurred:

[email protected] flashcache]# make Installmake-C src kernel_tree=/lib/modules/2.6. +-358. El6.x86_64/build pwd=/root/flashcache/src installmake[1]: Entering directory '/root/flashcache/src'Make-c/lib/modules/2.6. +-358. el6.x86_64/build M=/ROOT/FLASHCACHE/SRC Modules v=0make:entering An unknown Directorymake:/lib/modules/2.6. +-358. el6.x86_64/Build: There is no file or directory. Stop it. Make:leaving an unknown directorymake[1]: * * * [modules] Error2make[1]: Leaving directory '/root/flashcache/src'Make: * * [Install] Error2

Build is a linked file and the address pointed to does not exist.

I found the/usr/src/kernels/directory below is the beginning is no content, for CentOS, the kernel source code is placed in the/usr/src/kernels directory; If you upgrade the kernel online, it is also placed in this directory; if the/usr/src/in your system There is no content in kernels/, indicating that there is no kernel-installed source package Kernel-devel software package;

Through the online installation of the kernel source package, such as through apt+synaptic or Yum installed, the kernel source will be placed in the directory under/usr/src/kernel, you want to enter the corresponding directory to compile; Here I am installed through Yum.

Yum-y install Kernel-devel

Because I have installed the source package, all appears:

 [[email protected] ~]# yum-y install kernel-develloaded plugins: Fastestmirror, refresh -packagekit, securityloading mirror speeds  from   cached Hostfile  * base  : mirrors.hustunique.com  * epel:mirrors.hustunique.com  * extras:mirrors.hustunique.com  * updates:mirrors.hustunique.comSetting up Install processpackage kernel -devel-2.6 . 32 -431.29 . 2  .el6.x86_64 already installed and latest versionnothing to  do 
[Email protected] ~]# cd/lib/modules/2.6. -358. el6.x86_64/2.6. -358. el6.x86_64]# ln-s/usr/src/kernels/2.6. -431.29. 2. el6.x86_64/"build": File already exists

To make the build point to the source package just installed in/usr/src/kernels, an error occurred

You must delete before you can add a new link

# Rm-rf/lib/modules/2.6.32-358.el6.x86_64/build

To re-establish symbolic Links:

2.6. -358. el6.x86_64]# ln-s/usr/src/kernels/2.6. -431.29. 2. el6.x86_64//lib/modules/2.6. -358. El6.x86_64/build

You can then enter the Flashcache directory

[[email protected] flashcache]# make install
[email protected] flashcache]# make Installmake-C src kernel_tree=/lib/modules/2.6. +-358. El6.x86_64/build pwd=/root/flashcache/src installmake[1]: Entering directory '/root/lashcache/src'Make-c/lib/modules/2.6. +-358. el6.x86_64/build M=/ROOT/FLASHCACHE/SRC Modules v=0make[2]: Entering directory '/usr/src/kernels/2.6. +-431.29.2. el6.x86_64'CC [M]/root/flashcache/src/FLASHCACHE_CONF.O CC [M]/root/flashcache/src/FLASHCACHE_MAIN.O CC [M]/root/flashcache/src/flashcache_subr.o CC [M]/root/flashcache/src/FLASHCACHE_IOCTL.O CC [M]/root/flashcache/src/FLASHCACHE_PROCFS.O CC [M]/root/flashcache/src/FLASHCACHE_RECLAIM.O CC [M]/root/flashcache/src/flashcache_kcopy.o LD [M]/root/flashcache/src/FLASHCACHE.O Building modules, stage2. Modpost1Modules CC/root/flashcache/src/FLASHCACHE.MOD.O LD [M]/root/flashcache/src/flashcache.ko.unsigned NO sign [M]/root/flashcache/src/flashcache.komake[2]: Leaving directory '/usr/src/kernels/2.6. +-431.29.2. el6.x86_64'Install-o root-g root-m0755-d/lib/modules/2.6. +-358. el6.x86_64/extra/flashcache/Install-O root-g root-m0755flashcache.ko/lib/modules/2.6. +-358. el6.x86_64/extra/flashcache/Depmod-A2.6. +-358. El6.x86_64make-C utils allmake[2]: Entering directory '/root/flashcache/src/utils'make[2]: Nothing to being done for' All'.make[2]: Leaving directory '/root/flashcache/src/utils'Make-C utils installmake[2]: Entering directory '/root/flashcache/src/utils'Install-d-M755/sbin/Install-M755Flashcache_create Flashcache_destroy flashcache_load Flashcache_setioctl get_agsize/sbin/make[2]: Leaving directory '/root/flashcache/src/utils'Make-C OCF installmake[2]: Entering directory '/ROOT/FLASHCACHE/SRC/OCF'Install-d-M755/usr/lib/ocf/resource.d/Flashcacheinstall-M755flashcache/usr/lib/ocf/resource.d/flashcachemake[2]: Leaving directory '/ROOT/FLASHCACHE/SRC/OCF'make[1]: Leaving directory '/rootflashcache/src'

Loading modules

Modprobe Flashcache


centos6.4 installation Flashcache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.