前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >flashcache install(含fushio卡安装)

flashcache install(含fushio卡安装)

原创
作者头像
用户1168904
修改2021-05-24 17:57:13
7390
修改2021-05-24 17:57:13
举报
文章被收录于专栏:运维相关文档

fushio卡安装及磁盘IO测试工具fio的安装和使用

安装fushio isdriver卡到机器中:

拷贝三个文件:

fio-util-3.2.4.1086-1.0.el6.x86_64.rpm

iomemory-vsl-3.2.4.1086-1.0.el6.src.rpm

fio-2.1.tar.bz2

安装:

rpmbuild --rebuild iomemory-vsl-3.2.4.1086-1.0.el6.src.rpm

rpm -ivh /root/rpmbuild/RPMS/x86_64/iomemory-vsl-2.6.32-358.el6.x86_64-3.2.4.1086-1.0.el6.x86_64.rpm

rpm -ivh fio-util-3.2.4.1086-1.0.el6.x86_64.rpm

modprobe iomemory-vsl

fio-status

增加卡的sector,对flashcache应用,优化的效果是什么?

原因:

1、由于flashcache要在内存中生成索引metadata

Flashcache metadata will use 4020MB of your 32095MB main memory

2、fushio卡的driver也占用内存

如果加大sector,将减少内存占用量。

建议把卡的sector(扇区) size设成4k(默认为512B)

用以下几个命令格式化一下卡:

fio-detach /dev/fct0; fio-format -b 4k /dev/fct0; fio-attach /dev/fct0

注意:参数为-b,硬件设备里的block size,实际是sector size;而象用ext4分区后的block size默认为4K,如果磁盘(硬件设备)sector默认仍然是512B,即:1个block用到8个sector;修改磁盘的sector为4K后,则1对1。

#rpm -qa |grep gtk2-devel

#yum -y install gtk2-devel

yum install -y libaio-devel

yum -y install gnuplot

git clone git://git.kernel.dk/fio.git

cd fio

./configure --enable-gfio

#make fio

#make gfio

make

make install

fio测试使用示例(只是介绍,不在真实测试环境使用,相关测试在后面加入flashcache后进行)

vi block-test.config

--------------------------------------------------------

[global]

ioengine=libaio

#include: sync,mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio

direct=1

thread=0

rw=rw

#rw include: randread,randwrite,read,write,randrw,rw

rwmixread=80

group_reporting=1

write_bw_log=b

write_iops_log=b

iodepth=32

iodepth_batch=16

iodepth_batch_complete=16

norandommap=1

time_based=1

runtime=120

randrepeat=0

numjobs=16

bs=1M

size=50%

#directory=/zsdata

filename=/dev/fioa

[test]

---------------------------------------------------------

详细的配置文件设置,请参考《Fio使用小结》一文

本地测试命令:

fio block-test.config

形成性能图形报告:

上述配置文件通过write_bw_log/write_iops_log 生成了名叫 b_bw.log和b_iops.log的日志文件;

新版本用fio2gnuplot命令生成IO性能图片:

fio2gnuplot -g -b

fio2gnuplot -g -i

以前的老版本运行fio的作图工具fio_generate_plots 可以直接生成IO性能图片:

fio_generate_plots b_bw.log

假如运行于c/s模式且带图形,则:

服务端执行:

fio -S

fio: server listening on 0.0.0.0,8765

客户端执行:

gfio

Flashcache服务安装(cache设备使用fushio卡)

注:帮助文件,在源码目录里--- flashcache/doc/flashcache-sa-guide.txt

yum -y update

rpm -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-mappe

yum -y install unifdef.x86_64

git clone https://github.com/facebook/flashcache.git

cd flashcache/

make KERNEL_TREE=/usr/src/kernels/`uname -r`/

make install

#modinfo /lib/modules/`uname -r`/extra/flashcache/flashcache.ko

#insmod /lib/modules/`uname -r`/extra/flashcache/flashcache.ko

modprobe flashcache

dmesg |tail

/* 设置自动加载模块(本步骤不需要,跳过,自动挂载通过后面的自启动文件来实现):

/* vi /etc/sysconfig/modules/flashcache.modules

/* -------------------------------------------------------

/* #!/bin/sh

/*

/* /sbin/modinfo -F filename flashcache > /dev/null 2>&1

/* if [ $? -eq 0 ]; then

/* exec /sbin/modprobe flashcache >/dev/null 2>&1

/* fi

/* -------------------------------------------------------

/* chmod 755 /etc/sysconfig/modules/flashcache.modules

/* 重启系统并查看是否自动加载模块:

/* reboot

/* lsmod |grep flashcache

分区(如果原有存储磁盘已分区,这步可跳过):

parted /dev/sdb

(parted) mklabel gpt # 将MBR磁盘格式化为GPT

(parted) mkpart primary 0 -1 # 全部容量做一个主分区

(parted) print #打印当前分区

(parted) quit 退出

分区完成,开始格式化:

mkfs.ext4 /dev/sdb1

注:默认的inode size为8k,而ext4系统的默认block size为4k,相当于默认情况下,inode数=1/2的block数,如果是小文件存储,请设置小点的inode size,以免inode数最终耗尽。

例如,假如设置为4K,则使得inode数与block数一致,则命令为:

mkfs.ext4 -i 4096 /dev/sdb1

建立虚拟mapper设备命令(注意,这里用的cache设备是fushio设备fioa,实际环境中可用SSD盘替换):

flashcache_create -p back -b 4k cachedev /dev/fioa /dev/sdb1

注:-p后可选参数分别为back/through/around,将写入操作模式定义为:先写cache的writeback方式、同时写cache和disk的writethrough方式、或绕过cache直接写disk的writearound方式

-b 4k: block size设置为4k.

注:删除虚拟mapper设备的命令:

dmsetup remove cachedev

flashcache_destroy /dev/fioa

挂载:

mkdir /zsdata

mount -t ext4 -o noatime,nobarrier,discard /dev/mapper/cachedev /zsdata

设置自动挂载cachedev:

参考:flashcache-sa-guide.txt文档里这一节:Using Flashcache sysVinit script

1. Copy 'utils/flashcache' from the repo to '/etc/init.d/flashcache'

2. Make sure this file has execute permissions,

'sudo chmod +x /etc/init.d/flashcache'.

3. Edit this file and specify the values for the following variables

SSD_DISK, BACKEND_DISK, CACHEDEV_NAME, MOUNTPOINT, FLASHCACHE_NAME

4. Modify the headers in the file if necessary.

By default, it starts in runlevel 3, with start-stop priority 90-10

5. Register this file using chkconfig

'chkconfig --add /etc/init.d/flashcache'

即:

cp ~/flashcache/utils/flashcache /etc/init.d/flashcache

sudo chmod +x /etc/init.d/flashcache

vi /etc/init.d/flashcache

修改: SSD_DISK=/dev/fioa

BACKEND_DISK=/dev/sdb1

CACHEDEV_NAME=cachedev

MOUNTPOINT=/zsdata

FLASHCACHE_NAME=fioa+sdb1

参数FLASHCACHE_NAME应该设置为ssd盘符+硬盘盘符,例如/dev/fioa为ssd硬盘(fushio闪存卡),/dev/sdb1为SAS硬盘,则应设置为FLASHCACHE_NAME=fioa+sdb1

chkconfig --add /etc/init.d/flashcache

备注:如果重启系统后,flashcache模块无法装入,请重新执行一次编译,即可。

使用和测试:

1、flashcache的参数调整,参考:《Flashcache参数配置》 一文

主要是修改sysctl.conf,并sysctl -p使之生效

参考如下,增加:

dev.flashcache.fioa+sdb1.dirty_thresh_pct = 90

dev.flashcache.fioa+sdb1.fast_remove = 1

dev.flashcache.fioa+sdb1.cache_all = 1

dev.flashcache.fioa+sdb1.max_clean_ios_total = 4

dev.flashcache.fioa+sdb1.max_clean_ios_set = 2

dev.flashcache.fioa+sdb1.reclaim_policy = 1

其中,参数中的所有"fioa+sdb1",根据实际情况下FLASHCACHE_NAME的配置,做相应的更改。

2、利用fio工具测试混合存储的读写:

配置文件参考:《fio测试工具配置文件》 目录里三个文件

3、查看磁盘读写:

方法一:

cd ~/flashcache/utils/

./flashstat -d /dev/mapper/cachedev -C 1

方法二:

安装dstat,然后执行:

dstat -a -D fioa,sdb

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
文件存储
文件存储(Cloud File Storage,CFS)为您提供安全可靠、可扩展的共享文件存储服务。文件存储可与腾讯云服务器、容器服务、批量计算等服务搭配使用,为多个计算节点提供容量和性能可弹性扩展的高性能共享存储。腾讯云文件存储的管理界面简单、易使用,可实现对现有应用的无缝集成;按实际用量付费,为您节约成本,简化 IT 运维工作。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档