swift 命令行

也是先source用户和租间

1、查看容器和存储的对象

[root@localhost ~(keystone_admin)]# swift list
[root@localhost ~(keystone_admin)]# swift list --lh
    0    0

$ swift list $container #显示某个容器的对象信息
2、查看状态信息

[root@localhost ~(keystone_admin)]# swift stat
   Account: AUTH_9387b24331da4daebac32a8ccd52dd4b
Containers: 0
   Objects: 0
     Bytes: 0
Content-Type: text/plain; charset=utf-8
X-Timestamp: 1384944092.11535
X-Put-Timestamp: 1384944092.11535
3、创建容器

[root@localhost ~(keystone_admin)]# swift post test
[root@localhost ~(keystone_admin)]# swift list --lh
    0    0 2013-11-20 10:42:16 test
    0    0

4、删除容器

[root@localhost ~(keystone_admin)]# swift delete test
[root@localhost ~(keystone_admin)]# swift list --lh
    0    0

$swift delete $container $object#删除某个容器里的某个对象


5、上传对象a、先创建个文件500M的

[root@localhost ~(keystone_admin)]# dd if=/dev/zero of=/tmp/example-500Mb bs=1M count=500
记录了500+0 的读入
记录了500+0 的写出
524288000字节(524 MB)已复制,0.258867 秒,2.0 GB/秒


b、上传到刚才创建的容器”test“中

[root@localhost ~(keystone_admin)]# swift upload test /tmp/example-500Mb 
tmp/example-500Mb


支持目录和多个文件

swift upload  $container $dir
swift upload $container file1 file2 ..


6、上传大文件时,可以用-S来分片(s for segment)

[root@localhost ~(keystone_admin)]# swift upload test -S 102400000 /tmp/example-500Mb 
tmp/example-500Mb segment 5
tmp/example-500Mb segment 0
tmp/example-500Mb segment 2
tmp/example-500Mb segment 1
tmp/example-500Mb segment 4
tmp/example-500Mb segment 3
tmp/example-500Mb


最终,文件对象会上传到"test"容器中,但也会增加一个“test_segments”的容器,里面放的就是文件分片时产生的各个小分片文件。

[root@localhost ~(keystone_admin)]# swift list --lh
    2   43 2013-11-20 10:42:16 test
    6 500M 2013-11-21 02:31:52 test_segments


[root@localhost ~(keystone_admin)]# swift list test --lh
   0 2013-11-21 02:41:32 tmp/example-500Mb
  43 2013-11-20 11:02:37 tmp/test.txt
  43

[root@localhost ~(keystone_admin)]# swift list test_segments --lh
 97M 2013-11-21 02:41:30 tmp/example-500Mb/1384944751.119769/524288000/102400000/00000000
 97M 2013-11-21 02:41:30 tmp/example-500Mb/1384944751.119769/524288000/102400000/00000001
 97M 2013-11-21 02:41:30 tmp/example-500Mb/1384944751.119769/524288000/102400000/00000002
 97M 2013-11-21 02:41:30 tmp/example-500Mb/1384944751.119769/524288000/102400000/00000003
 97M 2013-11-21 02:41:30 tmp/example-500Mb/1384944751.119769/524288000/102400000/00000004
 11M 2013-11-21 02:41:30 tmp/example-500Mb/1384944751.119769/524288000/102400000/00000005
500M



  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值