11
2024
07
16:50:57

Stratis存储

Red Hat Enterprise Linux 8中,引入新的存储管理系统Stratis。其功能总结如下:


copy-on-write

磁盘空间的精简置备Thin Provision

支持RAID 0、RAID 1、RAID 10

支持全盘加密如LUKS

支持资源池,每池可创建 16,777,216( 2^24)个文件系统或文件夹

LZ4压缩

文件的消除重复功能

子卷

快照

数据损坏的自愈功能

热扩容、热减容

为提升性能而进行存储分区:数据区和缓存区(与VMWare VMFS 6相同,与Glusterfs的热区、冷区类似)

Stratis 与 ZFS 和 Btrfs 有哪些不同?


作为新项目,Stratis 可以从已有项目中吸取经验,我们将在第二部分深入介绍 Stratis 采用了 ZFS、Brtfs 和 LVM 的哪些设计。总结一下,Stratis 与其不同之处来自于对功能特性支持的观察,来自于个人使用及计算机自动化运行方式的改变,以及来自于底层硬件的改变。


首先,Stratis 强调易用性和安全性。对个人用户而言,这很重要,毕竟他们与 Stratis 交互的时间间隔可能很长。如果交互不那么友好,尤其是有丢数据的可能性,大部分人宁愿放弃使用新特性,继续使用功能比较基础的文件系统。


第二,当前 API 和 DevOps 式(Devops-style)自动化的重要性远高于早些年。Stratis 提供了支持自动化的一流 API,这样人们可以直接通过自动化工具使用 Stratis。


第三,SSD 的容量和市场份额都已经显著提升。早期的文件系统中很多代码用于优化机械介质访问速度慢的问题,但对于基于闪存的介质,这些优化变得不那么重要。即使当存储池过大而不适合使用 SSD 的情况,仍可以考虑使用 SSD 充当 缓存层(caching tier),可以提供不错的性能提升。考虑到 SSD 的优良性能,Stratis 主要聚焦存储池设计方面的 灵活性(flexibility)和 可靠性(reliability)。


最后,与 ZFS 和 Btrfs 相比,Stratis 具有明显不一样的 实现模型(implementation model)。这意味着对 Stratis 而言,虽然一些功能较难实现,但一些功能较容易实现。这也加快了 Stratis 的开发进度。


安装服务


# dnf install stratisd stratis-cli

 

启动服务并设置开机启动


# systemctl start stratisd

# systemctl enable stratisd

 

查看磁盘


# lsblk

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sda      8:0    0   28G  0 disk

├─sda1   8:1    0    1G  0 part /boot

├─sda2   8:2    0  2.8G  0 part [SWAP]

└─sda3   8:3    0   15G  0 part /

sdb      8:16   0    1T  0 disk

sdc      8:32   0    2T  0 disk

sdd      8:48   0    8G  0 disk

sde      8:64   0    8G  0 disk

sdf      8:80   0    8G  0 disk

sr0     11:0    1 1024M  0 rom

 

检查磁盘是否有分区,发现sda存在分区


# blkid -p /dev/sda

/dev/sda: PTUUID="b7168b63" PTTYPE="dos"

Not empty, it contains a partition table.

 

检查磁盘是否有分区,发现sdb无分区


# blkid -p /dev/sdb

 

检查磁盘是否有分区,发现sdc存在分区


# blkid -p /dev/sdc

/dev/sdc: UUID="770587cc-cfd3-44cb-82e2-756902cf458b" VERSION="1.0" TYPE="ext4" USAGE="filesystem"

 

清除分区


# wipefs -a /dev/sdc

/dev/sdc: 2 bytes were erased at offset 0x00000438 (ext4): 53 ef

Creating a pool

A pool with one block device.

 

创建存储池


# stratis pool create storage /dev/sdb

 

查看存储池


# stratis pool list

Name             Total Physical Size  Total Physical Used

storage                  1 TiB               52 MiB

A pool with 2 block devices (no redundancy).

 

创建2个磁盘的存储池


# stratis pool create storage_2disk /dev/sdd /dev/sdf

 

查看存储池


# stratis pool list

Name               Total Physical Size  Total Physical Used

storage                    1 TiB               52 MiB

storage_2disk                 16 GiB               56 MiB

Creating a filesystem from the pool

 

在存储池上存储一个文件系统


# stratis filesystem create storage wuyeliang


# stratis filesystem list

Pool Name      Name      Used     Created            Device

storage  wuyeliang  546 MiB  Nov 09 2018 11:08  /stratis/storage/wuyeliang

 

如果创建多个文件系统,重复上面的命令


# stratis filesystem create storage wuyeliang2


# stratis filesystem list

Pool Name      Name         Used     Created            Device

storage  wuyeliang     546 MiB  Nov 09 2018 11:08  /stratis/storage/wuyeliang

storage  wuyeliang2  546 MiB  Nov 09 2018 11:09  /stratis/storage/wuyeliang2

 

The file system is created on a thinly provisioned 1 TB block device. Stratis will take care of allocating blocks from the pool and re-sizing the XFS file system as needed during its lifetime.


您还可以通过包含池名称来限制文件系统列表输出


# stratis pool create olympic /dev/sdc


# stratis filesystem create olympic backstroke


# stratis filesystem

Pool Name      Name         Used     Created            Device

olympic        backstroke   546 MiB  Nov 09 2018 11:10  /stratis/olympic/backstroke

storage  wuyeliang     546 MiB  Nov 09 2018 11:08  /stratis/storage/wuyeliang

storage  wuyeliang2  546 MiB  Nov 09 2018 11:09  /stratis/storage/wuyeliang2


# stratis filesystem list storage

Pool Name      Name         Used     Created            Device

storage  wuyeliang     546 MiB  Nov 09 2018 11:08  /stratis/storage/wuyeliang

storage  wuyeliang2  546 MiB  Nov 09 2018 11:09  /stratis/storage/wuyeliang2

Mount the file system

 

挂载文件系统


# mount /stratis/storage/wuyeliang /mnt

 

查看文件系统的uuid


# blkid -p /stratis/storage/wuyeliang

/stratis/storage/wuyeliang: UUID="a38780e5-04e3-49da-8b95-2575d77e947c" TYPE="xfs" USAGE="filesystem"

 

设置开机挂载


# echo "UUID=a38780e5-04e3-49da-8b95-2575d77e947c /mnt xfs defaults 0 0" >> /etc/fstab

 

扩容存储池


# stratis pool add-data storage_2disk /dev/sdc


# stratis pool list

Name               Total Physical Size  Total Physical Used

storage                    1 TiB               52 MiB

storage_2disk               2.02 TiB               60 MiB

 

重命名存储池


# stratis pool rename storage_2disk 3_amigos


# stratis pool list

Name             Total Physical Size  Total Physical Used

3_amigos                    2.02 TiB               60 MiB

storage                  1 TiB               52 MiB

 

将ssd加入存储池,并作为缓存盘


# stratis pool init-cache 3_amigos /dev/sde

destroy: Destroy a pool, no file systems can exist in pool

 

删除存储池


# stratis pool destroy 3_amigos


# stratis pool list

Name             Total Physical Size  Total Physical Used

storage     

             1 TiB               52 MiB

Other useful file system operations

destroy: Remove a Stratis provided filesystem

To remove a Stratis provided filesystem, make sure that it’s not in use, and then destroy it.

 

此处要先移除文件系统


# stratis filesystem list

Pool Name      Name         Used     Created            Device

olympic        backstroke   546 MiB  Nov 09 2018 11:10  /stratis/olympic/backstroke

storage  wuyeliang     546 MiB  Nov 09 2018 11:08  /stratis/storage/wuyeliang

storage  wuyeliang2  546 MiB  Nov 09 2018 11:09  /stratis/storage/wuyeliang2

 

# stratis filesystem destroy storage wuyeliang2

 

# stratis filesystem list

Pool Name      Name        Used     Created            Device

olympic        backstroke  546 MiB  Nov 09 2018 11:10  /stratis/olympic/backstroke

storage  wuyeliang    546 MiB  Nov 09 2018 11:08  /stratis/storage/wuyeliang


 

rename: Rename a file system


# stratis filesystem rename olympic backstroke some_fs

snapshot: Create a snapshot

To create a snaphot, which is a read/writeable thinly provisioned point in time copy of the source FS.

 

创建快照


# stratis filesystem snapshot olympic some_fs some_fs_snapshot


# stratis filesystem list olympic

Pool Name  Name              Used     Created            Device

olympic    some_fs           546 MiB  Nov 09 2018 11:10  /stratis/olympic/some_fs

olympic    some_fs_snapshot  546 MiB  Nov 09 2018 11:26  /stratis/olympic/some_fs_snapshot

Misc. operations

Query which block devices belong to a pool or all of Stratis.


# stratis blockdev list olympic

Pool Name  Device Node    Physical Size   State  Tier

olympic    /dev/sdc            2.00 TiB  In-use  Data


# stratis blockdev list

Pool Name      Device Node    Physical Size   State  Tier

olympic        /dev/sdc            2.00 TiB  In-use  Data

storage  /dev/sdb               1 TiB  In-use  Data

Query redundancies that Stratis supports.


 

查看版本


# stratis daemon redundancy

NONE: 0

Query the Stratis daemon (stratisd) version.


# stratis daemon version

2.0.0

 

关于性能

4k随机写 50w IOPS的NVME盘组建成pool性能如下


8e3ddf9bbfce17622b3027e696e99b1a_12af97b01a644d8c8ae60863ce8a8942.png

参考


https://stratis-storage.github.io/howto/




推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

本文链接:https://hqyman.cn/post/7043.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:
打赏





休息一下~~


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

您的IP地址是: