011 RGW的SwiftAPi支持
一、 Swift简介
openstack swift是openstack开源云计算项目开源的对象存储,提供了强大的扩展性、冗余和持久性
1.1 swift特性
极高的数据持久性
完全对称的系统架构
无限的可扩展性
无单点故障
1.2 对象存储在容器中
Openstack Swift API的用户模型与Amazon S3 API稍有不同。若要使用swift api通过rados网关的身份验证,需要rados网关用户帐户配置子用户
Amazon S3 API授权和身份验证模型具有单层设计。一个用户可以有多个access key和secret key,用于在同一帐户中提供不同类型的访问
而swift有租户概念,rados网关用户对应swift的租户,而子帐号则对应swift的api用户
RADOS网关支持Swift v1.0以及OpenStack keystone v2.0身份验证
二、swift 用户管理
2.1 创建Swift的子用户
[root@ceph5 ~]# radosgw-admin user info --uid joy
{
"user_id": "joy",
"display_name": "Joy Ning",
"email": "",
"suspended": ,
"max_buckets": ,
"auid": ,
"subusers": [],
"keys": [
{
"user": "joy",
"access_key": "5XCV68WUQJFFJPVM3UHK",
"secret_key": "xhaA2YB1CA3xH54xLbmwPcglqjDyuFez36F8XGuG"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": ,
"max_size_kb": ,
"max_objects": -
},
"user_quota": {
"enabled": true,
"check_on_raw": false,
"max_size": -,
"max_size_kb": ,
"max_objects": -
},
"temp_url_keys": [],
"type": "rgw"
}
2.2 创建一个子账号
[root@ceph5 ~]# radosgw-admin subuser create --uid joy --subuser joy:swift --access=full
{
"user_id": "joy",
"display_name": "Joy Ning",
"email": "",
"suspended": ,
"max_buckets": ,
"auid": ,
"subusers": [
{
"id": "joy:swift",
"permissions": "full-control"
}
],
"keys": [
{
"user": "joy",
"access_key": "5XCV68WUQJFFJPVM3UHK",
"secret_key": "xhaA2YB1CA3xH54xLbmwPcglqjDyuFez36F8XGuG"
}
],
"swift_keys": [
{
"user": "joy:swift",
"secret_key": "6Ea8Cu94ea37ESj7mJWFV1TmoL9ffMjVHJ5D0vKK"
}
],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": ,
"max_size_kb": ,
"max_objects": -
},
"user_quota": {
"enabled": true,
"check_on_raw": false,
"max_size": -,
"max_size_kb": ,
"max_objects": -
},
"temp_url_keys": [],
"type": "rgw"
}
创建另一个子账号
[root@ceph5 ~]# radosgw-admin subuser create --uid joy --subuser joy:swift2 --access=full
{
"user_id": "joy",
"display_name": "Joy Ning",
"email": "",
"suspended": ,
"max_buckets": ,
"auid": ,
"subusers": [
{
"id": "joy:swift",
"permissions": "full-control"
},
{
"id": "joy:swift2",
"permissions": "full-control"
}
],
"keys": [
{
"user": "joy",
"access_key": "5XCV68WUQJFFJPVM3UHK",
"secret_key": "xhaA2YB1CA3xH54xLbmwPcglqjDyuFez36F8XGuG"
}
],
"swift_keys": [
{
"user": "joy:swift",
"secret_key": "6Ea8Cu94ea37ESj7mJWFV1TmoL9ffMjVHJ5D0vKK"
},
{
"user": "joy:swift2",
"secret_key": "kJl6k4dVfqbOlZxdIX1Apmu5VFkL0KmSb5B8MkXz"
}
],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": ,
"max_size_kb": ,
"max_objects": -
},
"user_quota": {
"enabled": true,
"check_on_raw": false,
"max_size": -,
"max_size_kb": ,
"max_objects": -
},
"temp_url_keys": [],
"type": "rgw"
}
2.3 删除一个子账号
[root@ceph5 ~]# radosgw-admin subuser rm --uid joy --subuser joy:swift2
{
"user_id": "joy",
"display_name": "Joy Ning",
"email": "",
"suspended": ,
"max_buckets": ,
"auid": ,
"subusers": [
{
"id": "joy:swift",
"permissions": "full-control"
}
],
"keys": [
{
"user": "joy",
"access_key": "5XCV68WUQJFFJPVM3UHK",
"secret_key": "xhaA2YB1CA3xH54xLbmwPcglqjDyuFez36F8XGuG"
}
],
"swift_keys": [
{
"user": "joy:swift",
"secret_key": "6Ea8Cu94ea37ESj7mJWFV1TmoL9ffMjVHJ5D0vKK"
}
],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": ,
"max_size_kb": ,
"max_objects": -
},
"user_quota": {
"enabled": true,
"check_on_raw": false,
"max_size": -,
"max_size_kb": ,
"max_objects": -
},
"temp_url_keys": [],
"type": "rgw"
}
2.4 修改子用户秘钥
[root@ceph5 ~]# radosgw-admin key create --subuser joy:swift --gen-secret
{
"user_id": "joy",
"display_name": "Joy Ning",
"email": "",
"suspended": ,
"max_buckets": ,
"auid": ,
"subusers": [
{
"id": "joy:swift",
"permissions": "full-control"
}
],
"keys": [
{
"user": "joy",
"access_key": "5XCV68WUQJFFJPVM3UHK",
"secret_key": "xhaA2YB1CA3xH54xLbmwPcglqjDyuFez36F8XGuG"
}
],
"swift_keys": [
{
"user": "joy:swift",
"secret_key": "RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq"
}
],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": ,
"max_size_kb": ,
"max_objects": -
},
"user_quota": {
"enabled": true,
"check_on_raw": false,
"max_size": -,
"max_size_kb": ,
"max_objects": -
},
"temp_url_keys": [],
"type": "rgw"
}
三、使用swift客户端
3.1 安装swift客户端
[root@ceph1 ceph]# yum -y install python-swiftclient
3.2 创建一个容器
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq post swiftbk
3.3 向容器上传一个文件
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq upload swiftbk /etc/ceph/ceph.conf
3.4 服务器端查看
[root@ceph5 ~]# rados -p default.rgw.buckets.data ls --cluster backup
3.5 列出容器中的文件
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq list swiftbk
3.6 查看容器状态
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq stat swiftbk
Account: v1
Container: swiftbk
Objects:
Bytes:
Read ACL:
Write ACL:
Sync To:
Sync Key:
Accept-Ranges: bytes
X-Storage-Policy: default-placement
X-Container-Bytes-Used-Actual:
X-Timestamp: 1553059437.79870
X-Trans-Id: tx000000000000000000017-005c91cf25--default
Content-Type: text/plain; charset=utf-
X-Openstack-Request-Id: tx000000000000000000017-005c91cf25--default
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq stat
Account: v1
Containers:
Objects:
Bytes:
Objects in policy "default-placement-bytes":
Bytes in policy "default-placement-bytes":
Containers in policy "default-placement":
Objects in policy "default-placement":
Bytes in policy "default-placement":
Accept-Ranges: bytes
X-Timestamp: 1553059632.46208
X-Account-Bytes-Used-Actual:
X-Trans-Id: tx000000000000000000019-005c91cf30--default
Content-Type: text/plain; charset=utf-
X-Openstack-Request-Id: tx000000000000000000019-005c91cf30--default
3.7 重复操作
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq upload test /etc/ceph/rbdmap
etc/ceph/rbdmap
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq list
swiftbk
test
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq list test
ceph
demoobject
etc/ceph/rbdmap
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq post swifttest
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq post list
[root@ceph1 ceph]# swift -A http://ceph5.lab.example.com/auth/v1.0 -U joy:swift -K RB5SfO54XqgPl7TkfEjobfz9GP63dLIG1tZ9MQiq list
list
swiftbk
swifttest
test
博主声明:本文的内容来源主要来自誉天教育晏威老师,由本人实验完成操作验证,需要的博友请联系誉天教育(http://www.yutianedu.com/),获得官方同意或者晏老师(https://www.cnblogs.com/breezey/)本人同意即可转载,谢谢!
011 RGW的SwiftAPi支持的更多相关文章
- ceph版本号
概述 第一个 Ceph 版本是 0.1 ,要回溯到 2008 年 1 月.多年来,版本号方案一直没变,直到 2015 年 4 月 0.94.1 ( Hammer 的第一个修正版)发布后,为了避免 0. ...
- Cosbench测试 RGW S3 path_style_access=true模式支持
使用Ceph RGW Cosbench 测试时,文档中没有写如何使用 path_style_access 模式的方法. 查看了一下cosbench源码发现已经支持,只是文档没有写. 提交了一个iss ...
- s3cmd : Add a config parameter to enable path-style bucket access 当ceph rgw使用域名时,需要支持 path-style bucket特性
s3cmd 要是1.6.1 之后的版本 增加配置项: vi .s3cfg use_path_mode = True 源码参考: cat /usr/local/lib/python2.7/dist- ...
- RGW 负载均衡和高可用的几个方案对比
注:在RGW网关主机网卡已经是10Gb的情况下,如下三个方案没有引入LVS:如果RGW是Gb网卡,可以考虑引入LVS做流量负载均衡. RGW部署采用 fastcgi+nginx 扩展性和可配置性更强. ...
- 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数011,ocr,字符识别
<zw版·Halcon-delphi系列原创教程> Halcon分类函数011,ocr,字符识别 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换:“p ...
- Auty自动化测试框架第六篇——垃圾代码回收、添加suite支持
[本文出自天外归云的博客园] 垃圾代码回收 添加脚本恢复机制,因为框架会自动生成一些代码,如果代码生成后出现问题导致代码没有正常删除掉,则会造成代码垃圾,在auty目录添加recovery.py文件: ...
- OpenWrt镜像编译和ipv6支持
离成功实现路由器刷OpenWrt.接入校园网差不多一年了.路由工作比较稳定,还是很满意的. 这次回来有个新发现:学校有原生ipv6支持,在win7和ubuntu下什么都不用设置,自动获取global ...
- 阿里云 RDS for MySQL支持什么引擎
问题:我们的服务器是买的是阿里云,mysql版本5.011 ,本地和服务器配置一样,在本地可以安装discuzX3.4,但是在服务器上却报错了,如下图: 找了半天,才知道阿里云RDS 支持的mysql ...
- mac环境下支持PHP调试工具xdebug,phpstorm监听
先让php支持xdebug 方式一: https://xdebug.org/download.php 下载相应的xdebug 可以到http://xdebug.org/wizard.php 把php ...
随机推荐
- Java 调用restful webservice & jackson
package com.bullshit.webcrawler.client.impl; import java.io.BufferedReader; import java.io.IOExcepti ...
- python常量和变量
1.1 常量 常量是内存中用于保存固定值的单元,在程序中常量的值不能发生改变:python并没有命名常量,也就是说不能像C语言那样给常量起一个名字. python常量包括:数字.字符串.布尔值.空值: ...
- oracle 和 mysql 遍历当前月份每一天
获取当前月份的每一天的数据 oracle SELECT TO_DATE(TO_CHAR(SYSDATE, 'YYYYMM'), 'YYYYMM') + (ROWNUM - 1) DAY_ID FROM ...
- Hbase API: 读Bigtable
- uda 4.C++面向对象编程
Python vs C++ 对比课 在本课中,你将学习如何用 C++ 编写类.像以前的课程一样,你需要比较 Python 的编程方式和 C++ 中编程方式的不同. 我们直接看例子.下面是一个名为 ...
- 2018-8-10-win10-uwp-如何打包Nuget给其他人
title author date CreateTime categories win10 uwp 如何打包Nuget给其他人 lindexi 2018-08-10 19:16:50 +0800 20 ...
- eclipse maven项目导出所使用的jar包
在eclipse中定位到maven项目的pom.xml文件右击pom.xml文件,选择Run As-->Maven build…在打开的页面中,GOLAS栏输入“dependency:copy- ...
- Python--day69--单表查询之神奇的双下划线
单表查询之神奇的双下划线: 单表查询之神奇的双下划线 models.Tb1.objects.filter(id__lt=10, id__gt=1) # 获取id大于1 且 小于10的值 models. ...
- UVa11400 - Lighting System Design——[动态规划]
题干略. 题意分析: 很容易理解一类灯泡要么全部换要么全不换,其实费用节省的主要原因是由于替换灯泡类型而排除了低压电压源,于是我们就可以推断出灯泡类型替换的原则: 对于两类灯泡a1和a2,a1可以被a ...
- javascript和jquery 移除事件 和 改变样式
javascript移除事件: document.getElementById("word").onmouseover = null; javascript改变样式: docume ...