이 장에서는 백업 사용자를 위해 OpenStack에서 스토리지 할당량을 설정하는 방법을 보여줍니다.
OpenStack을 처음 사용하는 경우 http://docs.openstack.org/에서 제공되는 일반 설정에 대한 문서를 확인해야 합니다.
실행 중인 OpenStack이 이미 있는 경우 다음 단계에 따라 스토리지 할당량을 설정할 수 있습니다.
다음 예제에서 사용된 OpenStack 버전은 다음과 같습니다:
다음 예에서 사용된 값은 다음과 같습니다:
참고: Keystone 관리 토큰의 값은 /etc/keystone/keystone.conf 의 keystone 구성 파일 내부에 정의된 변수 이름 "admin_token"에서 찾을 수 있습니다.
테넌트(프로젝트), 사용자, 역할 및 스토리지 할당량 등을 설정하기 전에 bash 프로필에서 다음 변수를 설정하고 proxy-server.conf에서 필터를 설정하십시오.
1단계: .bash_profile에 환경 변수 추가---------------------------------------------------------------------------------------------------- : : Trimmed : : export OS_USERNAME=admin export OS_PASSWORD=admin export OS_TENANT_NAME=mybackup export OS_AUTH_URL=http://10.7.54.7:5000/v2.0 export OS_SERVICE_ENDPOINT=http://10.7.54.7:35357/v2.0 export OS_SERVICE_TOKEN=7b05dab9722d44e7b9a82dc0d1ff74ea : : Trimmed : : ----------------------------------------------------------------------------------------------------
프로필을 적용하려면 다시 로그인하십시오.
참고: OS_SERVICE_TOKEN 값은 /etc/keystone/keystone.conf 의 keystone 구성 파일 내에 정의된 변수 이름 "admin_token"에서 찾을 수 있습니다.
proxy-server.conf 파일을 편집하고 아래 예에서 빨간색으로 강조 표시된 내용을 추가합니다.
예시 (/etc/swift/proxy-server.conf)---------------------------------------------------------------------------------------------------- : : : Trimmed : : : [pipeline:main] pipeline = healthcheck cache authtoken keystone container-quotas account-quotas proxy-server : : : Trimmed : : : [filter:keystone] use = egg:swift#keystoneauth operator_roles = admin, SwiftOperator, ResellerAdmin is_admin = true [filter:container-quotas] use = egg:swift#container_quotas [filter:account-quotas] use = egg:swift#account_quotas ----------------------------------------------------------------------------------------------------
구성 파일 /etc/swift/proxy-server.conf 를 수정한 후 프록시 서비스를 다시 시작합니다.
예시---------------------------------------------------------------------------------------------------- [root@os ~]# swift-init proxy restart Signal proxy-server pid: 13453 signal: 15 proxy-server (13453) appears to have stopped Starting proxy-server...(/etc/swift/proxy-server.conf) WARNING: SSL should only be enabled for testing purposes. Use external SSL termination for a production deployment. [root@os ~]# ----------------------------------------------------------------------------------------------------
계정의 할당량을 변경할 수 있는 사용자에 대해 ResellerAdmin이라는 역할을 만듭니다. keystone으로 역할을 생성하고 이를 관리자 사용자에게 추가해야 합니다.
사용법: keystone role-create --name <role-name>
예시---------------------------------------------------------------------------------------------------- [root@os ~]# keystone role-create --name ResellerAdmin WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored). +----------+----------------------------------+ | Property | Value | +----------+----------------------------------+ | id | 464e592192554bdd8201b367997886f1 | | name | ResellerAdmin | +----------+----------------------------------+ [root@os ~]# ----------------------------------------------------------------------------------------------------
다음 명령으로 역할 설정을 확인하십시오:
사용법: keystone role-list
예시---------------------------------------------------------------------------------------------------- [root@os ~]# keystone role-list WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored). +----------------------------------+-----------------+ | id | name | +----------------------------------+-----------------+ | 464e592192554bdd8201b367997886f1 | ResellerAdmin | | e34c3a339a924180b07e2099842c727f | SwiftOperator | | 9fe2ff9ee4384b1894a90878d3e92bab | _member_ | | 3e61686683c94fd9a24beab378dfef81 | admin | +----------------------------------+-----------------+ [root@os ~]# ----------------------------------------------------------------------------------------------------
역할을 제거하려는 경우:
사용법: keystone role-delete <role>
예시---------------------------------------------------------------------------------------------------- [root@os ~]# keystone role-delete ResellerAdmin WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored). [root@os ~]# ----------------------------------------------------------------------------------------------------
사용법: keystone user-role-add --user <user> --role <role> --tenant <tenant>
예시---------------------------------------------------------------------------------------------------- [root@os ~]# keystone user-role-add --user admin --role ResellerAdmin --tenant mybackup WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored). [root@os ~]# ----------------------------------------------------------------------------------------------------
다음 명령으로 설정을 확인하십시오:
사용법: keystone user-role-list --user <user> --tenant <tenant>
예시---------------------------------------------------------------------------------------------------- [root@os ~]# keystone user-role-list --user admin --tenant mybackup WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored). +----------------------------------+-----------------+----------------------------------+----------------------------------+ | id | name | user_id | tenant_id | +----------------------------------+-----------------+----------------------------------+----------------------------------+ | 464e592192554bdd8201b367997886f1 | ResellerAdmin | 70a0cf53001d4798b02aae61e935e5df | 49f2482ecff9431bae1d32fa2a004026 | | 3e61686683c94fd9a24beab378dfef81 | admin | 70a0cf53001d4798b02aae61e935e5df | 49f2482ecff9431bae1d32fa2a004026 | +----------------------------------+-----------------+----------------------------------+----------------------------------+ [root@os ~]# ----------------------------------------------------------------------------------------------------
할당된 역할을 제거하려는 경우:
사용법: keystone user-role-remove --user <user> --role <role> --tentant <tentant>
예시---------------------------------------------------------------------------------------------------- [root@os ~]# keystone user-role-remove --user admin --role ResellerAdmin --tenant mybackup WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored). [root@os ~]# ----------------------------------------------------------------------------------------------------
이 예에서는 이 테넌트(프로젝트)에 10GB를 적용합니다. 이 프로젝트 내의 모든 컨테이너는 이 할당량을 공유합니다.
사용법: swift post -m quota-bytes:<value>
예시---------------------------------------------------------------------------------------------------- [root@os ~]# swift post -m quota-bytes:10737418240 [root@os ~]# ----------------------------------------------------------------------------------------------------
다음 명령으로 스토리지 할당량 설정을 확인하십시오:
사용법: swift stat
예시
---------------------------------------------------------------------------------------------------- [root@os ~]# swift stat Account: AUTH_49f2482ecff9431bae1d32fa2a004026 Containers: 4 Objects: 260 Bytes: 694896 Meta Quota-Bytes: 10737418240 X-Timestamp: 1412574345.10669 Content-Type: text/plain; charset=utf-8 Accept-Ranges: bytes [root@os ~]# ----------------------------------------------------------------------------------------------------
이 테넌트(프로젝트)에 대한 스토리지 할당량을 제거하려는 경우:
사용법: swift post -m quota-bytes:
예시---------------------------------------------------------------------------------------------------- [root@os ~]# swift post -m quota-bytes: [root@os ~]# ----------------------------------------------------------------------------------------------------
이 사용자가 이 컨테이너를 사용할 수 있도록 스토리지 할당량을 설정하려면(예: user1에 2GB 적용)
사용법: swift post <container name> -H "X-Container-Meta-Quota-Bytes: <size in bytes>"
예시---------------------------------------------------------------------------------------------------- [root@os ~]# swift post user1 -H "X-Container-Meta-Quota-Bytes: 2147483648" [root@os ~]# ----------------------------------------------------------------------------------------------------
컨테이너 할당량 설정을 확인하세요:
사용법: swift stat <container name>
예시---------------------------------------------------------------------------------------------------- [root@os ~]# swift stat user1 Account: AUTH_49f2482ecff9431bae1d32fa2a004026 Container: user1 Objects: 0 Bytes: 0 Read ACL: mybackup:user1 Write ACL: mybackup:user1 Sync To: Sync Key: Meta Quota-Bytes: 2147483648 Accept-Ranges: bytes X-Timestamp: 1412578586.50844 Content-Type: text/plain; charset=utf-8 [root@os ~]# ----------------------------------------------------------------------------------------------------
사용자의 스토리지 할당량을 제거하려는 경우:
사용법: swift post <container name> -H "X-Container-Meta-Quota-Bytes:"
예시---------------------------------------------------------------------------------------------------- [root@os ~]# swift post user6 -H "X-Container-Meta-Quota-Bytes:" [root@os ~]# ----------------------------------------------------------------------------------------------------