Swift


  • OpenStack Object Storage(Swift)是OpenStack开源云计算项目的子项目之一。Swift的目的是使用普通硬件来构建冗余的、可扩展的分布式对象存储集群,存储容量可达PB级

  • Swift并不是文件系统或者实时的数据存储系统,它是对象存储,用于永久类型的静态数据的长期存储,这些数据可以检索、调整,必要时进行更新。最适合存储的数据类型的例子是虚拟机镜像、图片存储、邮件存储和存档备份

  • Swift无需采用RAID(磁盘冗余阵列),也没有中心单元或主控结点。Swift通过在软件层面引入一致性哈希技术和数据冗余性,牺牲一定程度的数据一致性来达到高可用性(High Availability,简称HA)和可伸缩性,支持多租户模式、容器和对象读写操作,适合解决互联网的应用场景下非结构化数据存储问题

 

存储桶的基本使用

查看容器列表和详细信息

[root@controller ~]# swift list 

[root@controller ~]# openstack container list 

 

查看对象存储的状态

[root@controller ~]# swift stat 
               Account: AUTH_246ec13db06d40519a1815067897ced2
            Containers: 0
               Objects: 0
                 Bytes: 0
       X-Put-Timestamp: 1633161683.88879
           X-Timestamp: 1633161683.88879
            X-Trans-Id: txec40b1bde6bd494dac38d-00615811d3
          Content-Type: text/plain; charset=utf-8
X-Openstack-Request-Id: txec40b1bde6bd494dac38d-00615811d3

 

创建对象存储的桶

[root@controller ~]# openstack contianer create test

[root@controller ~]# swift post test

 

删除一个对象存储的桶

[root@controller ~]# openstack container delete test

[root@controller ~]# swift delete test

 

对象管理

 

查看对象列表信息

[root@controller ~]# openstack object list test 
+-------+
| Name  |
+-------+
| file/ |
+-------+

 

创建对象

[root@controller ~]# mkdir file
[root@controller ~]# openstack object create test file/
file/

[root@controller ~]# mkdir file
[root@controller ~]# swift upload test file/

 

上传文件

[root@controller ~]# swift upload test file/ a.txt 
file/
a.txt

[root@controller ~]# swift upload test file/ b.txt 
file/
b.txt

[root@controller ~]# openstack object list test 
+-------+
| Name  |
+-------+
| a.txt |
| b.txt |
| file  |
| file/ |
+-------+

 

下载文件

[root@controller ~]# swift download test file/ a.txt 
file/ [auth 6.255s, headers 7.499s, total 7.500s, 0.000 MB/s]
a.txt [auth 6.187s, headers 7.489s, total 7.489s, 0.000 MB/s]

 

swift存储

swift分片存储

# cd /etc/swift 
# swift-ring-builder object.builder   
# swift post chinaskill 
# swift upload chinaskill -S 10000000 cirros-0.3.4-x86_64-disk.img

 

查看

查看cirros镜像存储路径
# swift start chinaskill cirros-0.3.4-x86_64-disk.img

查看存储路径中的数据片
# swift list chinaskill_segments

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM