opencas配置方法

安装

wget https://github.com/Open-CAS/open-cas-linux/releases/download/v20.12.2/open-cas-linux-20.12.2.0444.release.zip
unzip open-cas-linux-20.12.2.0444.release.zip
cd open-cas-linux-20.12.2.0444.release/
./configure
make -j 2
make install
casadm -v

配置缓存的设备
[root@lab201 ~]# casadm -S -i 1 -d /dev/disk/by-id/wwn-0x6000c29bfd405712a2a8e6dac38ecaf8

Successfully added cache instance 1
新版本已经改成需要使用disk by id的方式了,直接使用设备路径不行

配置后端设备
casadm -A -d /dev/disk/by-id/scsi-36000c297c5f6e31aa5b610009d577552-part1 -i 1

调整缓存模式
casadm --set-cache-mode --cache-mode wb --cache-id 1

查询设备情况
[root@lab201 ~]# casadm -L
type id disk status write policy device
cache 1 /dev/sdc Running wb -
+core 1 /dev/sdb1 Active - /dev/cas1-1

停止缓存
casadm -T -i 1

重新加载缓存
casadm -S --load -d /dev/disk/by-id/wwn-0x6000c29bfd405712a2a8e6dac38ecaf8

内存大小需求
内存需要 1G+(2%4KIB/缓存行大小+0.05%)缓存设备大小
默认的大小就是4K的
内存需要1G+2.05%*缓存设备大小

RAM requirement is approximately 1GiB + (2% * 4KiB/ + 0.05%) * cache device capacity. For example, when using 4KiB (default) cache line size, RAM requirement is approximately 1GiB + 2.05% cache device capacity

上面的为手动配置的,建议操作配置文件
配置文件比较简单

[caches]

Cache ID Cache device Cache mode Extra fields (optional)

[cores]

Cache ID Core ID Core device Extra fields (optional)

指定缓存设备的id 指定设备路径 指定缓存模式
指定后端设备的缓存id 指定后端设备的设备id 指定后端设备路径

上面的一组配置,用配置文件这样写

[caches]

Cache ID Cache device Cache mode Extra fields (optional)

Uncomment and edit the below line for cache configuration

1 /dev/disk/by-id/scsi-36000c29bfd405712a2a8e6dac38ecaf8 WB

Core devices configuration

[cores]

Cache ID Core ID Core device Extra fields (optional)

Uncomment and edit the below line for core configuration

1 1 /dev/disk/by-id/wwn-0x6000c297c5f6e31aa5b610009d577552-part1

清理缓存设备上的元数据
casadm --zero-metadata -d /dev/sdc

casctl init
init的时候,缓存设备不能有元数据,这个是初始化
casctl start
start的时候,缓存设备上面不能没有元数据,否则无法加载

把后端设备从缓存里面删除
casadm --remove-core -i 1 -j 2

从core pool删除后端设备
casadm --remove-detached -d /dev/disk/by-id/wwn-0x6000c297c5f6e31aa5b610009d577552-part1

如果要还原设备的话
需要清理元数据
detach设备

删除的步骤是

先把后端设备清理 再删除缓存设备

如果先删除的缓存,那么要detach设备的(udev里面重载了?)
udevadm control --reload-rules && udevadm trigger
然后做上面的detach

上面为停止的一些操作

posted @ 2024-01-05 21:26  武汉-磨渣  阅读(172)  评论(0编辑  收藏  举报