• RHCE——实施高级存储功能(CSA)


    一、tuned:调整调优配置文件

    调优系统:

            系统管理员1可以基于多种用例工作负载来调整各种设备设置,依此优化系统性能。tuned守护进程会利用反应特定工作负载要求的调优配置文件,以静态和动态两种方法应用调优调整。

            配置动态调优:对于动态调优而言,tuned守护进程会监视系统活动,并根据运行时行为的变化来调整设置,从所选调优配置文件中声明的初始设置开始,动态调优会不断进行调整以适应当前工作负载。

    默认情况下要手动并启用安装包

    1. [root@localhost ~]# yum install tuned -y
    2. 正在更新 Subscription Management 软件仓库。
    3. baseos 2.0 MB/s | 2.8 kB 00:00
    4. AppStream 1.3 MB/s | 3.2 kB 00:00
    5. Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 3.0 kB/s | 4.5 kB 00:01
    6. Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 3.9 kB/s | 4.1 kB 00:01
    7. 软件包 tuned-2.18.0-2.el8.noarch 已安装。
    8. 依赖关系解决。
    9. ========================================================================================================
    10. 软件包 架构 版本 仓库 大小
    11. ========================================================================================================
    12. 升级:
    13. tuned noarch 2.18.0-2.el8_6.1 rhel-8-for-x86_64-baseos-rpms 316 k
    14. 事务概要
    15. ========================================================================================================
    16. 升级 1 软件包
    17. 总下载:316 k
    18. 下载软件包:
    19. tuned-2.18.0-2.el8_6.1.noarch.rpm 117 kB/s | 316 kB 00:02
    20. --------------------------------------------------------------------------------------------------------
    21. 总计 117 kB/s | 316 kB 00:02
    22. 运行事务检查
    23. 事务检查成功。
    24. 运行事务测试
    25. 事务测试成功。
    26. 运行事务
    27. 准备中 : 1/1
    28. 运行脚本: tuned-2.18.0-2.el8_6.1.noarch 1/1
    29. 升级 : tuned-2.18.0-2.el8_6.1.noarch 1/2
    30. 运行脚本: tuned-2.18.0-2.el8_6.1.noarch 1/2
    31. 运行脚本: tuned-2.18.0-2.el8.noarch 2/2
    32. 清理 : tuned-2.18.0-2.el8.noarch 2/2
    33. 运行脚本: tuned-2.18.0-2.el8.noarch 2/2
    34. 运行脚本: tuned-2.18.0-2.el8_6.1.noarch 2/2
    35. 运行脚本: tuned-2.18.0-2.el8.noarch 2/2
    36. 验证 : tuned-2.18.0-2.el8_6.1.noarch 1/2
    37. 验证 : tuned-2.18.0-2.el8.noarch 2/2
    38. 已更新安装的产品。
    39. 已升级:
    40. tuned-2.18.0-2.el8_6.1.noarch
    41. 完毕!
    42. [root@localhost ~]# systemctl is-active tuned
    43. active

     

    1、选择调优配置文件:

            Tuned应用提供的配置文件分为以下几个类别:

                    节能型配置文件

                    性能提升型配置文件

                    性能提升型配置文件中包括侧重于以下的配置文件:

                            存储和网络的低延迟

                            存储和网络的高吞吐量

                            虚拟机性能

                            虚拟化主机性能

    随红帽企业Linux 8 分发的调优配置文件

    调优配置文件

    用途

    均衡

    非常适合需要在节能和性能之间进行折衷的系统

    desktop

    从balanced配置文件衍生而来。加快交互式应用响应速度

    throughput-performance

    调优系统,以获得最大吞吐量

    latency-performance

    非常适合需要牺牲能耗来获取延迟的服务器系统

    网络延迟

    从latency-performance配置文件衍生而来。它可以启用额外的网络调优参数,以提供低网络延迟。

    网络吞吐量

    从throughput-performance配置文件衍生而来。应用其他网络调优参数,以获得最大网络吞吐量

    节能

    调优系统,以最大程度实现节能

    Oracle

    基于throughput-performance配置文件,针对Oracle数据库负载进行优化

    virtual-guest

    当系统在虚拟机上运行时,调优系统以获得最高性能

    virtual-host

    当系统充当虚拟机的主机时,调优系统以获得最高性能

    2、从命令行管理配置文件

            tuned-adm命令可用于更改tuned守护进程的设置。tuned-adm命令可以查询当前设置,列出可用的配置文件,为系统推荐调优配置文件,直接更改配置文件或关闭调优。

    系统管理员可以使用tuned-adm active来确定当前活动的调优配置文件

    tuned-adm list命令列出所有可用的调优配置1文件,包括内容的配置文件和系统管理员的创建的自定义的文件

     使用tuned-adm profile profilename可以将活动的配置文件切换为更符合系统当前调优要求的其他配置文件

    tuned-adm recommend的输出基于各种系统特征,包括系统是否为虚拟机以及在系统安装期间选择的其他预定义类别

     

     二、Stratis管理分层存储

            通过Stratis,便捷的使用精简配置(thin provisioning),快照(snapshots)和基于池(pool-based )的管理和监控等高级存储功能;

     

            Stratis 是一个卷管理文件系统 volume-managing filesystem VMF ),类似于 ZFS Btrfs 。它使用了 存储“ 的核心思想,该思想被各种 VMF 和 形如 LVM 的独立卷管理器采用。使用一个或多个硬盘(或分区)创建存储池,然后在存储池中创建卷volume 。与使用 fdisk GParted 执行的传统硬盘分区不 同,存储池中的卷分布无需用户指定。
            VMF 更进一步与文件系统层结合起来。用户无需在卷上部署选取的文件系统,因为文件系统和卷已经被 合并在一起,成为一个概念上的文件树(ZFS 称之为数据集 dataset Brtfs 称之为子卷 subvolume , Stratis 称之为文件系统),文件数据位于存储池中,但文件大小仅受存储池整体容量限制。 换一个角度来看:正如文件系统对其中单个文件的真实存储块的实际位置做了一层抽象abstract ,而 VMF 对存储池中单个文件系统的真实存储块的实际位置做了一层抽象。 基于存储池,我们可以启用其它有用的特性。特性中的一部分理所当然地来自典型的 VMF 实现
    implementation ,例如文件系统快照,毕竟存储池中的多个文件系统可以共享物理数据块 physical data block;冗余 redundancy ,分层,完整性 integrity 等其它特性也很符合逻辑,因为存储池是操作系统中管理所有文件系统上述特性的重要场所。

    案例

    1、配置yum源,安装软件包

    1. [root@localhost ~]# yum install stratisd -y
    2. [root@localhost ~]# yum install stratis-cli

    2、启动stratisd服务

    [root@localhost ~]# systemctl enable  stratisd --now
    
    3、创建池并扩容
    1. [root@localhost ~]# stratis --version
    2. 2.4.2
    3. [root@localhost ~]# stratis pool create pool1 /dev/nvme0n2
    4. [root@kongd ~]# stratis filesystem list
    5. [root@kongd ~]# stratis pool add-data pool1 /dev/nvme0n3
    6. [root@kongd ~]# stratis pool list

    4、永久挂载

    [root@localhost ~]# tail -l /etc/fstab 

    5、快照

    [root@localhost ~]# stratis filesystem snapshot redhat rhce snap01

    三、VDO压缩存储和删除重复数据

    VDO Virtual Data Optimize 虚拟数据优化):通过压缩或删除存储设备上的数据来优化存储空间
            1、压缩和去重是为了能够更好的提供存储空间的利用率
            2、需要加载两个内核模块
                    kvdo: 用于压缩
                    uds: 用于去重的
            3、 vdo 设备位于现有的存储的顶部:
                    比如块设备:/dev/nvme0n5,也可以构建在 LV 上。 但是能够在stratis 管理分层存储上使 VDO 吗?不能。 在什么样的场景下,重复数据率高
                    比如:
                            虚拟化场景或者云场景: 10VM 全是RHEL8 系统 .....
            4、实现的过程就 3 个步骤
                    1): 消除0块
                    2): 去重
                    3): 压缩

    案例:

    1 、配置 yum 源,安装软件包

     

    1. [root@localhost ~]# mount /dev/sr0 /mnt/
    2. mount: /mnt: WARNING: device write-protected, mounted read-only.
    3. [root@localhost ~]# yum install ydo kmod-kvdo -y
    4. 正在更新 Subscription Management 软件仓库。
    5. 上次元数据过期检查:0:47:16 前,执行于 20221107日 星期一 193143秒。
    6. 未找到匹配的参数: ydo
    7. 软件包 kmod-kvdo-6.2.6.14-84.el8.x86_64 已安装。
    8. 错误:没有任何匹配: ydo

    2、创建VOD卷

     3、分析一个VDO卷(deduplication重复删除数据compression压缩)

    1. [root@localhost ~]# vdo status --name vdo1
    2. VDO status:
    3. Date: '2022-11-07 20:26:50-08:00'
    4. Node: localhost.localdomain
    5. Kernel module:
    6. Loaded: true
    7. Name: kvdo
    8. Version information:
    9. kvdo version: 6.2.6.14
    10. Configuration:
    11. File: /etc/vdoconf.yml
    12. Last modified: '2022-11-07 20:21:54'
    13. VDOs:
    14. vdo1:
    15. Acknowledgement threads: 1
    16. Activate: enabled
    17. Bio rotation interval: 64
    18. Bio submission threads: 4
    19. Block map cache size: 128M
    20. Block map period: 16380
    21. Block size: 4096
    22. CPU-work threads: 2
    23. Compression: enabled
    24. Configured write policy: auto
    25. Deduplication: enabled
    26. Device mapper status: 0 31457280 vdo /dev/nvme0n3 normal - online online 786786 1310720
    27. Emulate 512 byte: disabled
    28. Hash zone threads: 1
    29. Index checkpoint frequency: 0
    30. Index memory setting: 0.25
    31. Index parallel factor: 0
    32. Index sparse: disabled
    33. Index status: online
    34. Logical size: 15G
    35. Logical threads: 1
    36. Max discard size: 4K
    37. Physical size: 5G
    38. Physical threads: 1
    39. Slab size: 2G
    40. Storage device: /dev/disk/by-id/nvme-VMware_Virtual_NVMe_Disk_VMware_NVME_0000
    41. UUID: VDO-ee8d5d29-da00-43f9-8019-70794c38b39d
    42. VDO statistics:
    43. /dev/mapper/vdo1:
    44. 1K-blocks: 5242880
    45. 1K-blocks available: 2095736
    46. 1K-blocks used: 3147144
    47. 512 byte emulation: false
    48. KVDO module bytes used: 408542976
    49. KVDO module peak bytes used: 408542976
    50. bios acknowledged discard: 0
    51. bios acknowledged flush: 0
    52. bios acknowledged fua: 0
    53. bios acknowledged partial discard: 0
    54. bios acknowledged partial flush: 0
    55. bios acknowledged partial fua: 0
    56. bios acknowledged partial read: 0
    57. bios acknowledged partial write: 0
    58. bios acknowledged read: 261
    59. bios acknowledged write: 0
    60. bios in discard: 0
    61. bios in flush: 0
    62. bios in fua: 0
    63. bios in partial discard: 0
    64. bios in partial flush: 0
    65. bios in partial fua: 0
    66. bios in partial read: 0
    67. bios in partial write: 0
    68. bios in progress discard: 0
    69. bios in progress flush: 0
    70. bios in progress fua: 0
    71. bios in progress read: 0
    72. bios in progress write: 0
    73. bios in read: 261
    74. bios in write: 0
    75. bios journal completed discard: 0
    76. bios journal completed flush: 0
    77. bios journal completed fua: 0
    78. bios journal completed read: 0
    79. bios journal completed write: 0
    80. bios journal discard: 0
    81. bios journal flush: 0
    82. bios journal fua: 0
    83. bios journal read: 0
    84. bios journal write: 0
    85. bios meta completed discard: 0
    86. bios meta completed flush: 0
    87. bios meta completed fua: 0
    88. bios meta completed read: 4
    89. bios meta completed write: 65
    90. bios meta discard: 0
    91. bios meta flush: 1
    92. bios meta fua: 1
    93. bios meta read: 4
    94. bios meta write: 65
    95. bios out completed discard: 0
    96. bios out completed flush: 0
    97. bios out completed fua: 0
    98. bios out completed read: 0
    99. bios out completed write: 0
    100. bios out discard: 0
    101. bios out flush: 0
    102. bios out fua: 0
    103. bios out read: 0
    104. bios out write: 0
    105. bios page cache completed discard: 0
    106. bios page cache completed flush: 0
    107. bios page cache completed fua: 0
    108. bios page cache completed read: 0
    109. bios page cache completed write: 0
    110. bios page cache discard: 0
    111. bios page cache flush: 0
    112. bios page cache fua: 0
    113. bios page cache read: 0
    114. bios page cache write: 0
    115. block map cache pressure: 0
    116. block map cache size: 134217728
    117. block map clean pages: 0
    118. block map dirty pages: 0
    119. block map discard required: 0
    120. block map failed pages: 0
    121. block map failed reads: 0
    122. block map failed writes: 0
    123. block map fetch required: 0
    124. block map flush count: 0
    125. block map found in cache: 0
    126. block map free pages: 32768
    127. block map incoming pages: 0
    128. block map outgoing pages: 0
    129. block map pages loaded: 0
    130. block map pages saved: 0
    131. block map read count: 0
    132. block map read outgoing: 0
    133. block map reclaimed: 0
    134. block map wait for page: 0
    135. block map write count: 0
    136. block size: 4096
    137. completed recovery count: 0
    138. compressed blocks written: 0
    139. compressed fragments in packer: 0
    140. compressed fragments written: 0
    141. concurrent data matches: 0
    142. concurrent hash collisions: 0
    143. current VDO IO requests in progress: 0
    144. current dedupe queries: 0
    145. data blocks used: 0
    146. dedupe advice stale: 0
    147. dedupe advice timeouts: 0
    148. dedupe advice valid: 0
    149. entries indexed: 0
    150. flush out: 0
    151. instance: 0
    152. invalid advice PBN count: 0
    153. journal blocks batching: 0
    154. journal blocks committed: 0
    155. journal blocks started: 0
    156. journal blocks writing: 0
    157. journal blocks written: 0
    158. journal commits requested count: 0
    159. journal disk full count: 0
    160. journal entries batching: 0
    161. journal entries committed: 0
    162. journal entries started: 0
    163. journal entries writing: 0
    164. journal entries written: 0
    165. logical blocks: 3932160
    166. logical blocks used: 0
    167. maximum VDO IO requests in progress: 63
    168. maximum dedupe queries: 0
    169. no space error count: 0
    170. operating mode: normal
    171. overhead blocks used: 786786
    172. physical blocks: 1310720
    173. posts found: 0
    174. posts not found: 0
    175. queries found: 0
    176. queries not found: 0
    177. read only error count: 0
    178. read-only recovery count: 0
    179. recovery progress (%): N/A
    180. reference blocks written: 0
    181. release version: 133524
    182. saving percent: N/A
    183. slab count: 1
    184. slab journal blocked count: 0
    185. slab journal blocks written: 0
    186. slab journal disk full count: 0
    187. slab journal flush count: 0
    188. slab journal tail busy count: 0
    189. slab summary blocks written: 0
    190. slabs opened: 0
    191. slabs reopened: 0
    192. updates found: 0
    193. updates not found: 0
    194. used percent: 60
    195. version: 31
    196. write amplification ratio: 0.0
    197. write policy: sync

    4、给vdo1一个xfs文件系统,之后挂载到/mnt/vdo1上

    1. [root@localhost ~]# mkfs.xfs -k /dev/mapper/vdo1
    2. mkfs.xfs: invalid option -- 'k'
    3. unknown option -k
    4. Usage: mkfs.xfs
    5. /* blocksize */ [-b size=num]
    6. /* metadata */ [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,
    7. inobtcount=0|1,bigtime=0|1]
    8. /* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,
    9. (sunit=value,swidth=value|su=num,sw=num|noalign),
    10. sectsize=num
    11. /* force overwrite */ [-f]
    12. /* inode size */ [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2,
    13. projid32bit=0|1,sparse=0|1]
    14. /* no discard */ [-K]
    15. /* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n
    16. sunit=value|su=num,sectsize=num,lazy-count=0|1]
    17. /* label */ [-L label (maximum 12 characters)]
    18. /* naming */ [-n size=num,version=2|ci,ftype=0|1]
    19. /* no-op info only */ [-N]
    20. /* prototype file */ [-p fname]
    21. /* quiet */ [-q]
    22. /* realtime subvol */ [-r extsize=num,size=num,rtdev=xxx]
    23. /* sectorsize */ [-s size=num]
    24. /* version */ [-V]
    25. devicename
    26. <devicename> is required unless -d name=xxx is given.
    27. <num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),
    28. xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).
    29. <value> is xxx (512 byte blocks).
    30. [root@localhost ~]#
    31. -K选项可防止立即查看文件系统中未使用的块,从而使命令返回更快

            格式化结束:

    [root@localhost ~]# mkdir /d1

    5、使用vdostats命令查看卷的初始统计信息和状态

    [root@localhost ~]# vdostats --human-readable 
    Device                    Size      Used Available Use% Space saving%
    /dev/mapper/vdo1          5.0G      3.0G      2.0G  60%           N/A
     

    6、创建文件,移动文件到挂载点,然后看一下结果

    1. [root@localhost ~]# mount /dev/mapper/vdo1 /d1
    2. [root@localhost ~]# cd /d1
    3. [root@localhost d1]# ll
    4. 总用量 0
    5. [root@localhost d1]# cd
    6. [root@localhost ~]# ll /mnt/images/
    7. 总用量 763861
    8. -r--r--r--. 1 root root 10078208 628 00:19 efiboot.img
    9. -r--r--r--. 1 root root 772112384 628 00:09 install.img
    10. dr-xr-xr-x. 2 root root 2048 628 00:50 pxeboot
    11. -r--r--r--. 1 root root 446 628 00:50 TRANS.TBL
    12. [root@localhost ~]# cp /mnt/images/install.img /d1
    13. [root@localhost ~]# vdostats --human-readable
    14. Device Size Used Available Use% Space saving%
    15. /dev/mapper/vdo1 5.0G 3.7G 1.3G 74% 1%

     7、重新复制一遍

    1. [root@localhost ~]# cp /mnt/images/install.img /d1/install.img
    2. cp:是否覆盖'/d1/install.img'? y
    3. [root@localhost ~]# vdostats --human-readable
    4. Device Size Used Available Use% Space saving%
    5. /dev/mapper/vdo1 5.0G 3.7G 1.3G 74% 45%

  • 相关阅读:
    基于Java毕业设计在线图书超市源码+系统+mysql+lw文档+部署软件
    性能测试常见问题总结
    Android GPU版本和占用
    [React] react-hooks如何使用
    armbian 安裝配置教程
    后台管理系统SQL注入漏洞
    [Java]源码角度深入理解哈希表,手撕常见面试题
    RocketMQ实战之Consumer
    LLC谐振变换器变频移相混合控制MATLAB仿真
    【SpringBoot】SpringBoot整合Mybatis、druid
  • 原文地址:https://blog.csdn.net/wzpny/article/details/127747582