下载open cas linux source
git clone https://github.com/Open-CAS/open-cas-linux
获取子模块
cd open-cas-linux
git submodule update –init
配置和安装
./configure
make
make install
检查和验证
cas_disk.ko //open cas 磁盘内核模块
cas_cache.ko //open cas 缓存内核模块
casadm //open cas 管理员工具
casadm -V //install 检验
配置文件在utils/opencas.conf中,包括cache的配置和core devices的配置
1.cache id:everycore device的Cache id,视频,取值范围0~4095 2.core id:everycore devices的id 3.path:core device的路径 //everycache和core devices执行已经存储在hdd和ssd,核心设备应该引用wwn的标识,缓存设备必须顺序数据。
1.cache id:执行设备的启动实例ID,整形取值范围在1~16384
2.path:指向ssd的磁盘路径
3.desired mode:预期模式,一共有5中模式,分别是write-through/write-back/write-only/pass-through
4.extra fields:用户自定义IO配置
4.1 ioclass_file:允许用户加载自定义IO策略
4.2 cleaning_policy :允许用户缓存清理的策略,包括了acp/alru/nop
4.3 promotion_policy :允许用户使用缓存的推进策略,包括了always/nhit
配置样例
## Caches configuration section
[caches]
## Cache ID Cache device Cache mode Extra fields (optional)
1 /dev/disk/by-id/nvme-INTEL_SSD WT ioclass_file=/etc/opencas/ioclass-config.csv
## Core devices configuration
[cores]
## Cache ID Core ID Core device
1 1 /dev/disk/by-id/wwn-0x50014ee0aed22393
1 2 /dev/disk/by-id/wwn-0x50014ee0042769ef
1 3 /dev/disk/by-id/wwn-0x50014ee00429bf94
1 4 /dev/disk/by-id/wwn-0x50014ee0aed45a6d
1 5 /dev/disk/by-id/wwn-0x50014ee6b11be556
1 6 /dev/disk/by-id/wwn-0x50014ee0aed229a4
1 7 /dev/disk/by-id/wwn-0x50014ee004276c68
cas管理工具
casadm -S -i 1 -d /dev/sdc -c wb
casadm -A -i 1 -d /dev/sdb //匹配/dev/sdb到cache
casadm -S -i 1 -d /dev/sdc //创建id=1的cache
casadm -A -i 1 -d /dev/sdb //匹配/dev/sdb到cache
casadm -S -i 1 -d /dev/sdc -c wa
casadm -S -i 1 -d /dev/sdc -c pt
casadm -S -i 1 -d /dev/sdc -c wo