swift日常命令

本文主要介绍了OpenStack Swift存储容器的相关操作。包括通过命令行查看存储容器、容器状态,创建容器,上传本地文件至容器,创建大文件并指定分片大小上传,以及查看容器和文件属性、分片情况等内容,为使用OpenStack Swift存储提供了操作参考。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[root@openstack1 ~]# source keystonerc_admin   
[root@openstack1 ~(keystone_admin)]# swift list       #查看存储容器
[root@openstack1 ~(keystone_admin)]# swift stat      #查看容器状态
               Account: AUTH_f310702c6c3d43fba127d1c3b66eaae6
            Containers: 0
               Objects: 0
                 Bytes: 0
     Transfer-Encoding: chunked
       X-Put-Timestamp: 1562900997.18262
           X-Timestamp: 1562900997.18262
            X-Trans-Id: txe03b1f8b3ef044a5ac4dd-005d27fa04
          Content-Type: text/plain; charset=utf-8
X-Openstack-Request-Id: txe03b1f8b3ef044a5ac4dd-005d27fa04

[root@openstack1 ~(keystone_admin)]# swift post zg-swift    #通过命令行创建容器
[root@openstack1 ~(keystone_admin)]# swift list   #查看容器
zg-swift
[root@openstack1 ~(keystone_admin)]# swift list --lh    #查看容器详细信息
    0    0 2019-07-12 03:10:48 zg-swift
    0    0
[root@openstack1 ~(keystone_admin)]# swift post test    #通过命令行创建容器
[root@openstack1 ~(keystone_admin)]# swift list --lh  #查看容器详细信息
    0    0 2019-07-12 03:11:37 test
    0    0 2019-07-12 03:10:48 zg-swift
    0    0

[root@openstack1 ~(keystone_admin)]# ll
total 132
-rw-------. 1 root root  5098 Aug 15  2018 anaconda-ks.cfg
-rw-------. 1 root root 51728 Jul  8 02:03 answer.txt
-rw-------. 1 root root 51728 Jul  8 02:02 answer.txt.bak
-rw-r--r--. 1 root root     0 Jul  8 01:52 blue
-rwxr-xr-x. 1 root root   266 Jul 11 03:50 colour.sh
-rw-------. 1 root root   332 Jul  8 02:10 keystonerc_admin
-rw-------. 1 root root   313 Jul  8 02:10 keystonerc_demo
-rw-------. 1 root root  5073 Aug 15  2018 original-ks.cfg
-rw-r--r--. 1 root root     0 Jul  8 01:52 tset


[root@openstack1 ~(keystone_admin)]# swift upload test colour.sh   #本地上传文件至test容器
colour.sh

[root@openstack1 ~(keystone_admin)]# swift list test    #容器中查看文件
colour.sh
[root@openstack1 ~(keystone_admin)]# dd if=/dev/zero of=/tmp/example-500Mb bs=1M count=500   #创建500M的文件
500+0 records in 
500+0 records out
524288000 bytes (524 MB) copied, 0.310914 s, 1.7 GB/s
[root@openstack1 ~(keystone_admin)]# swift upload test -S 102400000 /tmp/example-500Mb    #-S指定分片的大小
tmp/example-500Mb segment 5
tmp/example-500Mb segment 4
tmp/example-500Mb segment 2
tmp/example-500Mb segment 0
tmp/example-500Mb segment 3
tmp/example-500Mb segment 1
tmp/example-500Mb


[root@openstack1 ~(keystone_admin)]# swift list test   #查看容器情况
colour.sh
tmp/example-500Mb


[root@openstack1 ~(keystone_admin)]# swift list test --lh    #查看文件属性
 266 2019-07-12 03:12:58         application/x-sh colour.sh
 0 2019-07-12 03:15:32 application/octet-stream tmp/example-500Mb
 266
[root@openstack1 ~(keystone_admin)]# swift list test_segments --lh    #查看分片情况
 97M 2019-07-12 03:15:29 application/swiftclient-segment tmp/example-500Mb/1562901244.531578/524288000/102400000/00000000
 97M 2019-07-12 03:15:29 application/swiftclient-segment tmp/example-500Mb/1562901244.531578/524288000/102400000/00000001
 97M 2019-07-12 03:15:29 application/swiftclient-segment tmp/example-500Mb/1562901244.531578/524288000/102400000/00000002
 97M 2019-07-12 03:15:30 application/swiftclient-segment tmp/example-500Mb/1562901244.531578/524288000/102400000/00000003
 97M 2019-07-12 03:15:29 application/swiftclient-segment tmp/example-500Mb/1562901244.531578/524288000/102400000/00000004
 11M 2019-07-12 03:15:29 application/swiftclient-segment tmp/example-500Mb/1562901244.531578/524288000/102400000/00000005
500M

[root@openstack1 ~(keystone_admin)]# 
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值