swift 命令行

来源:互联网 发布:淘宝少儿坎肩演出服装 编辑:程序博客网 时间:2024/05/16 10:15

也是先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_9387b24331da4daebac32a8ccd52dd4bContainers: 0   Objects: 0     Bytes: 0Content-Type: text/plain; charset=utf-8X-Timestamp: 1384944092.11535X-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 $dirswift 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 5tmp/example-500Mb segment 0tmp/example-500Mb segment 2tmp/example-500Mb segment 1tmp/example-500Mb segment 4tmp/example-500Mb segment 3tmp/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/00000005500M



原创粉丝点击