tuned\vdo\stratis总结和课堂案例

5 篇文章 0 订阅
1 篇文章 0 订阅

(1)tuned

作用:系统优化

在系统中,根据不同的应用场景,通过加载不同的配置,实现不同的优化操作

配置静态调优tuned守护进程会在服务启动时或选择新的调优配置文件时,应用系统配置。

配置动态调优 对于动态调优而言,tuned守护进程会监视系统活动,并根据运行时行为的变化来调整设置。

课堂案例:

[root@localhost ~]# yum install tuned -y    //安装程序(高版本的Linux默认已安装)

[root@localhost ~]# systemctl is-active tuned    //测试程序是否已开启
active

[root@localhost ~]# tuned-adm list    //将tuned支持的操作做一个列出

[root@localhost ~]# tuned-adm active    //查看当前的配置信息

[root@localhost ~]# tuned-adm profile balanced    //修改配置信息为balanced 

[root@localhost ~]# tuned-adm recommend    //对当前系统推荐配置

[root@localhost ~]# tuned-adm verify    //验证配置是否为推荐的最佳配置

先查看是否运行,然后查看系统推荐配置,验证是否为推荐配置,最后修改配置

(2)VDO---虚拟数据优化

对后期主机的数据进行压缩存储和删除,来优化存储空间的使用

在红帽企业Linux8包含虚拟数据优化器驱动程序,可以优化块设备上数据的空间占用。

VDO包括两个内核模块:kvdo模块用于以透明的方式控制数据压缩,uds则可用于重复数据删除。

VDO实施三个阶段的处理,减少存储设备上的空间占用:

1.零块消除将过滤掉仅包含零(0)的数据块,且仅在元数据中记录这些块信息。

2.删除重复的数据,去除冗余的数据块。

3.压缩。kvdo内核模块使用LZ4压缩,并以4KB块进行分组

课堂案例:

先添加硬盘设备

[root@localhost ~]# yum install vdo kmod-kvdo -y    //版本高的默认已安装

[root@localhost ~]# lsblk    //查看主机块设备

[root@localhost ~]# vdo create --name vdo1 --device /dev/nvme0n2 --vdoLogicalSize 15G
//创建一块名字是vdo1,虚拟大小为15G的vdo逻辑卷(虚拟大小也可不指定)
//逻辑卷默认映射到了/dev/mapper/vdo1下

[root@localhost ~]# vdo list    //查看创建的vdo逻辑卷

[root@localhost ~]# vdo status --name vdo1    //查看vdo1中的配置参数信息
 #Logical size: 15G
 #Physical size: 5G

[root@localhost ~]# vdo status --name vdo1 | grep Deduplication    //过滤逻辑卷删除重复信息
Deduplication: enabled

[root@localhost ~]# vdo status --name vdo1 | grep Compression    //过滤逻辑卷压缩
Compression: enabled

[root@localhost ~]# vdostats --human-readable    //显示逻辑卷的使用情况
Device                    Size      Used Available Use% Space saving%
/dev/mapper/vdo1          5.0G      3.0G      2.0G  60%           N/A

[root@localhost ~]# mkfs.xfs -K /dev/mapper/vdo1    //格式化逻辑卷vdo1

[root@localhost ~]# mkdir /d1
[root@localhost ~]# mount /dev/mapper/vdo1 /d1    //重新挂载到/d1下

[root@localhost ~]# cp /mnt/images/install.img /d1
[root@localhost ~]# vdostats --human-readable
Device                    Size      Used Available Use% Space saving%
/dev/mapper/vdo1          5.0G      3.7G      1.3G  73%            1%
[root@localhost ~]# cp /mnt/images/install.img /d1/install.img1
[root@localhost ~]# vdostats --human-readable
Device                    Size      Used Available Use% Space saving%
/dev/mapper/vdo1          5.0G      3.7G      1.3G  73%           50%
//去重很明显

[root@localhost ~]# umount /d1
[root@localhost ~]# vdo remove -n vdo1
Removing VDO vdo1
Stopping VDO vdo1    //移除vdo1

成果:

·使用虚拟数据优化器创建卷,将其格式化为相应的文件系统类型,并在上面挂载文件系统

·调查删除重复数据和压缩对虚拟数据优化器卷的影响

(3)stratis---管理分层存储

Stratis是一个卷管理文件系统,类似于ZFS和Btrfs,它使用了存储“池”的核心思想。

Stratis虚拟层不需要扩大,它的大小取决于存储在里面的文件的大小总和,上限是硬盘的总大小。

Stratis在它所创建的虚拟池中文件,默认是已格式化,不推荐再次格式化。

课堂案例:

[root@localhost ~]# yum install stratisd    //安装数据包(基本处于未安装状态)

[root@localhost ~]# systemctl enable stratisd --now    //当前主机现在启动服务(开机自启动)

[root@localhost ~]# yum install stratis-cli -y    //安装工具

[root@localhost ~]# stratis --version    //查看工具版本信息
2.4.2

[root@localhost ~]# stratis pool create pool1 /dev/nvme0n3    //创建虚拟池

[root@localhost ~]# stratis pool add-data pool1 /dev/nvme0n2    //扩大空间

[root@localhost ~]# stratis pool list                            //查看存储空间
Name                   Total Physical   Properties                                   UUID
pool1   10 GiB / 37.63 MiB / 9.96 GiB      ~Ca,~Cr   2837a4f7-8248-4351-b77d-c7098a465d97

[root@localhost ~]# stratis fs create pool1 fs1    //创建文件系统

[root@localhost ~]# stratis fs list                //列出查看
Pool Name   Name   Used      Created             Device                   UUID                                
pool1       fs1    546 MiB   Nov 08 2022 07:45   /dev/stratis/pool1/fs1   12b77d33-42ef-4a7b-aa6b-8dcb6941f31d

[root@localhost ~]# mkdir /fs1
[root@localhost ~]# mount /dev/stratis/pool1/fs1 /fs1        //挂载

//文件系统的自动扩大
[root@localhost ~]#  cp /mnt/images/install.img /fs1
[root@localhost ~]# stratis fs list
Pool Name   Name   Used       Created             Device                   UUID                                
pool1       fs1    1.19 GiB   Nov 08 2022 07:45   /dev/stratis/pool1/fs1   12b77d33-42ef-4a7b-aa6b-8dcb6941f31d
[root@localhost ~]#  cp /mnt/images/install.img /fs1/1
[root@localhost ~]# stratis fs list
Pool Name   Name   Used       Created             Device                   UUID                                
pool1       fs1    1.85 GiB   Nov 08 2022 07:45   /dev/stratis/pool1/fs1   12b77d33-42ef-4a7b-aa6b-8dcb6941f31d                          

[root@localhost ~]# stratis fs create pool1 fs2    //创建多个文件系统

[root@localhost ~]# stratis fs snapshot pool1 fs1 sn1    //创建快照

//快照
[root@localhost ~]# cd /fs1
[root@localhost fs1]# ll
total 1381320
-r--r--r--. 1 root root 707235840 Nov  8 08:00 1
-r--r--r--. 1 root root 707235840 Nov  8 07:59 install.img
[root@localhost fs1]# rm -rf *
[root@localhost fs1]# ll
total 0
[root@localhost fs1]# mount /dev/stratis/pool1/sn1 /fs1
[root@localhost fs1]# ll
total 1381320
-r--r--r--. 1 root root 707235840 Nov  8 08:00 1
-r--r--r--. 1 root root 707235840 Nov  8 07:59 install.img

//摧毁
[root@localhost ~]# umount /fs1
[root@localhost ~]# stratis fs destroy pool1 fs1
[root@localhost ~]# stratis fs destroy pool1 fs2
[root@localhost ~]# stratis fs destroy pool1 sn1
[root@localhost ~]# stratis pool destroy pool1



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

线粒体2.0

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值