Openstack swift支持s3 api

Openstack swift支持s3 api

[root@swift1 swift]# cd /usr/local/src/;ls
client  keystone  pip-1.3.1  pip-1.3.1.tar.gz  swift
[root@swift1 src]#  git clone https://github.com/fujita/swift3.git
Initialized empty Git repository in /usr/local/src/swift3/.git/
remote: Counting objects: 233, done.
remote: Compressing objects: 100% (137/137), done.
remote: Total 233 (delta 87), reused 221 (delta 75)
Receiving objects: 100% (233/233), 120.87 KiB | 103 KiB/s, done.
Resolving deltas: 100% (87/87), done.
[root@swift1 src]# cd swift3/
[root@swift1 swift3]# ls
AUTHORS  CHANGELOG  doc  LICENSE  README.md  setup.py  swift3
[root@swift1 swift3]# python setup.py install

[root@swift1 swift]# more proxy-server.conf 
[pipeline:main]
pipeline = catch_errors healthcheck cache swift3 s3token ratelimit authtoken keystone proxy-server

[filter:swift3]
use = egg:swift3#swift3

[filter:s3token]
paste.filter_factory = keystone.middleware.s3_token:filter_factory
auth_host = 192.168.0.147
auth_port = 35357
auth_protocol = http
admin_token = ADMIN
admin_user = admin
admin_password = openstack
admin_tenant_name = adminTenant

[root@swift1 swift]# swift-init stop all 
[root@swift1 swift]# swift-init start all 


[root@swift1 swift]# keystone tenant-list
+----------------------------------+-------------+---------+
|                id                |     name    | enabled |
+----------------------------------+-------------+---------+
| ef3a32e1e12b4c64b9c1882272b7b9d1 | adminTenant |   True  |
+----------------------------------+-------------+---------+
[root@swift1 swift]# keystone user-list
+----------------------------------+-------+---------+-------+
|                id                |  name | enabled | email |
+----------------------------------+-------+---------+-------+
| 3bef4f5d20574a54ae09be3a9ca742ff | admin |   True  |       |
+----------------------------------+-------+---------+-------+
[root@swift1 swift]# keystone
keystone         keystone-all     keystone-manage  
[root@swift1 swift]# keystone ec2-credentials-create --user 3bef4f5d20574a54ae09be3a9ca742ff --tenant_id ef3a32e1e12b4c64b9c1882272b7b9d1
usage: keystone ec2-credentials-create [--user-id <user-id>]
                                       [--tenant-id <tenant-id>]
keystone ec2-credentials-create: error: ambiguous option: --user could match --user-id, --user_id
[root@swift1 swift]# keystone ec2-credentials-create --user-id 3bef4f5d20574a54ae09be3a9ca742ff --tenant-id ef3a32e1e12b4c64b9c1882272b7b9d1 
+-----------+----------------------------------+
|  Property |              Value               |
+-----------+----------------------------------+
|   access  | 1502a4247dbf4ef690c0db14773d7aa4 |
|   secret  | 0c10426af6e6491aa1d622e36d6d07cb |
| tenant_id | ef3a32e1e12b4c64b9c1882272b7b9d1 |
|  user_id  | 3bef4f5d20574a54ae09be3a9ca742ff |
+-----------+----------------------------------+

[root@swift1 swift]# keystone ec2-credentials-list --user-id 3bef4f5d20574a54ae09be3a9ca742ff
+-------------+----------------------------------+----------------------------------+
|    tenant   |              access              |              secret              |
+-------------+----------------------------------+----------------------------------+
| adminTenant | 1502a4247dbf4ef690c0db14773d7aa4 | 0c10426af6e6491aa1d622e36d6d07cb |
+-------------+----------------------------------+----------------------------------+

[root@swift1 s3-curl]# vi /root/.s3curl 
%awsSecretAccessKeys = (
    # personal account
    personal => {
        id => '1502a4247dbf4ef690c0db14773d7aa4',
        key => '0c10426af6e6491aa1d622e36d6d07cb',
    },

    # corporate account
#    company => {
#        id => '1ATXQ3HHA59CYF1CVS02',
#        key => 'WQY4SrSS95pJUT95V6zWea01gBKBCL6PI0cdxeH8',
);

[root@swift1 s3-curl]# ls
LICENSE.txt  NOTICE.txt  README  s3curl.pl
[root@swift1 s3-curl]# pwd
/usr/local/src/s3-curl
[root@swift1 s3-curl]# ./s3curl.pl --head  --id 'personal' -- http://192.168.0.147:8080/myfiles/sk2

Message from syslogd@swift1 at Apr 15 03:15:10 ...
 5>swift Connecting with tenant: ef3a32e1e12b4c64b9c1882272b7b9d1 (txn: tx8f8178f17c4e4e188896c8eaa7a32922)
HTTP/1.1 200 OK
Last-Modified: Mon, 15 Apr 2013 03:07:00 GMT
Content-Length: 4
Etag: 3c6c36a652d7d89cb0a5519969f0c5e6
Content-Type: application/octet-stream
X-Amz-Meta-Mtime: 1365995216.664732
X-Trans-Id: tx8f8178f17c4e4e188896c8eaa7a32922
Date: Mon, 15 Apr 2013 07:15:10 GMT

你可能感兴趣的:(swift,keystone,S3)