5.3. 为用户设置对象存储配额

对象存储配额可分为以下类别:

  • 容器配额 - 限制单个容器中可以存储的总大小(以字节为单位)或对象数量。
  • 帐户配额 - 限制用户在对象存储服务中可用的总大小(以字节为单位)。

要设置容器配额或帐户配额,对象存储代理服务器必须具有添加到 proxy-server.conf 文件的 [pipeline:main] 部分的参数 container_quotasaccount_quotas (或两者):

[pipeline:main]
pipeline = catch_errors [...] tempauth container-quotas \
account-quotas slo dlo proxy-logging proxy-server

[filter:account_quotas]
use = egg:swift#account_quotas

[filter:container_quotas]
use = egg:swift#container_quotas

使用以下命令查看和更新对象存储配额。项目中包含的所有用户都可以查看项目中放置的配额。要更新项目中的 Object Storage 配额,您必须在项目中具有 ResellerAdmin 角色。

查看帐户配额:

# swift stat

Account: AUTH_b36ed2d326034beba0a9dd1fb19b70f9
Containers: 0
Objects: 0
Bytes: 0
Meta Quota-Bytes: 214748364800
X-Timestamp: 1351050521.29419
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes

更新配额:

# swift post -m quota-bytes:<BYTES>

例如,将 5 GB 配额放在帐户中:

# swift post -m quota-bytes:5368709120