S3命令

S3用法 - 图1

创建用户

  1. root@dev:/# radosgw-admin user create --uid=mona --display-name="Monika Singh" --email=mona@example.com
  2. {
  3. "user_id": "mona",
  4. "display_name": "Monika Singh",
  5. "email": "mona@example.com",
  6. "suspended": 0,
  7. "max_buckets": 1000,
  8. "auid": 0,
  9. "subusers": [],
  10. "keys": [
  11. {
  12. "user": "mona",
  13. "access_key": "2196PJ0MA6FLHCVKVFDW",
  14. "secret_key": "eO1\/dmEOEU5LlooexlWwcqJYZrt3Gzp\/nBXsQCwz"
  15. }
  16. ],
  17. "swift_keys": [],
  18. "caps": [],
  19. "op_mask": "read, write, delete",
  20. "default_placement": "",
  21. "placement_tags": [],
  22. "bucket_quota": {
  23. "enabled": false,
  24. "max_size_kb": -1,
  25. "max_objects": -1
  26. },
  27. "user_quota": {
  28. "enabled": false,
  29. "max_size_kb": -1,
  30. "max_objects": -1
  31. },
  32. "temp_url_keys": []
  33. }

添加Capabilities

  1. radosgw-admin caps add --uid=mona --caps="users=*"
  2. radosgw-admin caps add --uid=mona --caps="buckets=*"
  3. radosgw-admin caps add --uid=mona --caps="metadata=*"
  4. radosgw-admin caps add --uid=mona --caps="zone=*"

安装s3cmd

  1. apt-get install python-setuptools
  2. git clone https://github.com/s3tools/s3cmd.git
  3. cd s3cmd/
  4. python setup.py install

使用s3cmd

必须提前设置.s3cfg文件。

  1. s3cmd ls