백업 사용자를 위해 OpenStack 스토리지를 설정하는 방법은 무엇입니까?

소개:

이 장에서는 백업 사용자가 OpenStack 스토리지 컨테이너에서 백업할 수 있도록 OpenStack에서 스토리지를 설정하는 방법을 보여줍니다.

OpenStack을 처음 사용하는 경우 http://docs.openstack.org/에서 제공되는 일반 설정에 대한 문서를 확인해야 합니다.

실행 중인 OpenStack이 이미 있는 경우 다음 단계에 따라 백업 사용자를 위한 스토리지를 설정할 수 있습니다. 다음 단계를 완료하도록 안내해 드립니다:

이 단계를 완료하면 백업 클라이언트가 컨테이너를 자동으로 사용할 수 있습니다.



가정:

다음 예제에서 사용된 OpenStack 버전은 다음과 같습니다.:


다음 예에서 사용된 값은 다음과 같습니다:


참고: Keystone 관리 토큰의 값은 /etc/keystone/keystone.conf 의 keystone 구성 파일 내부에 정의된 변수 이름 "admin_token"에서 찾을 수 있습니다 .



요구 사항 및 준비:

테넌트(프로젝트), 사용자, 역할 및 스토리지 할당량 등을 설정하기 전에 bash 프로필에 다음 변수를 설정하십시오.

.bash_profile에 환경 변수 추가

예시 (/root/.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"에서 찾을 수 있습니다.



설정:

1단계: "mybackup"에 대한 테넌트(프로젝트) 생성

사용법: keystone tenant-create --name <tenant-name> --description <tenant-description>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone tenant-create --name mybackup --description 'mybackup Project'
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |        mybackup Project          |
|   enabled   |               True               |
|      id     | b769bfb2de75490088d8af7b7483e8f8 |
|     name    |             mybackup             |
+-------------+----------------------------------+
[root@os ~]#
----------------------------------------------------------------------------------------------------


다음 명령으로 테넌트(프로젝트) 설정을 확인하십시오:

사용법: keystone tenant-list

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone tenant-list
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+----------------------------------+--------------------+---------+
|                id                |        name        | enabled |
+----------------------------------+--------------------+---------+
| 6fe9e9d101df4b69944f7d4c40d15116 |       admin        |   True  |
| 3880c8dbf75040e9b78a44b6becdcd78 |      alt_demo      |   True  |
| b769bfb2de75490088d8af7b7483e8f8 |      mybackup      |   True  |
| e43182f5ad57464e9d08052d872adf34 |        demo        |   True  |
| ca35c74d6ec54dfabb0a1f9946d43da6 |      services      |   True  |
+----------------------------------+--------------------+---------+
[root@os ~]#
----------------------------------------------------------------------------------------------------


테넌트(프로젝트)를 제거하려는 경우:

사용법: keystone tenant-delete <tenant>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone tenant-delete mybackup
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
[root@os ~]#
----------------------------------------------------------------------------------------------------

경고: 이 테넌트(프로젝트)에서 생성된 모든 객체는 제거됩니다. 사용자, 역할, 컨테이너 스토리지를 포함합니다. 명령줄에 확인이 없으므로 이 명령을 주의해서 다루십시오.





2단계: 사용자 역할 만들기

"mybackup" 테넌트를 사용하는 모든 사용자에 대해 mybackup-role이라는 역할을 생성합니다.

사용법: keystone role-create --name <role-name>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone role-create --name mybackup-role 
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|    id    | 5973dc8f56b34c0ebc748c969b5ea20b |
|   name   |          mybackup-role           |
+----------+----------------------------------+
[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      |
| 5973dc8f56b34c0ebc748c969b5ea20b |  mybackup-role  |
+----------------------------------+-----------------+
[root@os ~]#
----------------------------------------------------------------------------------------------------


역할을 제거하려는 경우:

사용법: keystone role-delete <role>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone role-delete mybackup-role
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
[root@os ~]#
----------------------------------------------------------------------------------------------------




3단계: 새 사용자 만들기

예를 들어 새 사용자를 만듭니다. 기본 테넌트(프로젝트)가 이전 단계에서 생성된 mybackup인 user1. 각 백업 사용자에 대해 새 사용자를 생성하는 것이 좋습니다.

사용법: keystone user-create --name <user-name> --tenant <tenant> --pass <user password> --email <user email>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone user-create --name user1 --tenant mybackup --pass abc123$% --email user1@abc.com
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |          user1@abc.com           |
| enabled  |               True               |
|    id    | df2a64b224ec4d298c4d32661738194d |
|   name   |              user1               |
| tenantId | b769bfb2de75490088d8af7b7483e8f8 |
+----------+----------------------------------+
[root@os ~]#
----------------------------------------------------------------------------------------------------


다음 명령으로 사용자 설정을 확인하십시오:

사용법: keystone user-list

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone user-list
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+----------------------------------+------------+---------+------------------------+
|                id                |    name    | enabled |         email          |
+----------------------------------+------------+---------+------------------------+
| 70a0cf53001d4798b02aae61e935e5df |   admin    |   True  |     test@test.com      |
| 1b763f0cc253419597f7aae76041c39b |  alt_demo  |   True  |                        |
| 8d21745db067410ba44f11400adc8a50 | ceilometer |   True  |  ceilometer@localhost  |
| e370793a075148609116cc35ba01c216 |   cinder   |   True  |    cinder@localhost    |
| e7cc62d800f349fc92100521f184ccec |    demo    |   True  |                        |
| 30786a08d6004ab28556acae5ee20d56 |   glance   |   True  |    glance@localhost    |
| 578a16a390b14da3a9cf2f158535e353 |  neutron   |   True  |   neutron@localhost    |
| fd73f4613ed54710a82c6a90fbfb8ff8 |    nova    |   True  |     nova@localhost     |
| 516ea23e239d48cdba8708754e0115c1 |   swift    |   True  |    swift@localhost     |
| df2a64b224ec4d298c4d32661738194d |   user1    |   True  |     user1@abc.com      |
+----------------------------------+------------+---------+------------------------+
[root@os ~]#
----------------------------------------------------------------------------------------------------


사용자 비밀번호를 업데이트하려면:

사용법: keystone user-password-update --pass <new password> <user>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone user-password-update --pass 123456 user1
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
[root@os ~]#
----------------------------------------------------------------------------------------------------


사용자 세부 정보를 업데이트하려는 경우:

사용법: keystone user-update --name <new user-name> --email <new email> --enabled <true|false> <existing-user>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone user-update --name user2 --email user2@abc.com --enabled true user1
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
User has been updated.
[root@os ~]#
----------------------------------------------------------------------------------------------------


사용자를 제거하려면:

사용법: keystone user-delete <user>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone user-delete user1
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
[root@os ~]#
----------------------------------------------------------------------------------------------------




4단계: 백업 클라이언트에 대한 사용자 역할 생성 및 여기에 사용자 매핑

이전 단계에서 만든 역할을 사용하여 user1을 매핑합니다.

사용법: keystone user-role-add --user <user> --role <role> --tenant <tenant>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone user-role-add --user user1 --role mybackup-role --tenant mybackup
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
[root@os ~]#
----------------------------------------------------------------------------------------------------


다음 명령으로 user1의 역할 설정을 확인하십시오:

사용법: keystone user-role-list --user <user> --tenant <tenant>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone user-role-list --user user1 --tenant mybackup
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+----------------------------------+-------------+----------------------------------+----------------------------------+
|                id                |     name    |             user_id              |            tenant_id             |
+----------------------------------+-------------+----------------------------------+----------------------------------+
| 9fe2ff9ee4384b1894a90878d3e92bab |   _member_  | df2a64b224ec4d298c4d32661738194d | b769bfb2de75490088d8af7b7483e8f8 |  
| 5973dc8f56b34c0ebc748c969b5ea20b |   mybackup  | df2a64b224ec4d298c4d32661738194d | b769bfb2de75490088d8af7b7483e8f8 |
+----------------------------------+-------------+----------------------------------+----------------------------------+
[root@os ~]#
----------------------------------------------------------------------------------------------------


할당된 사용자 역할을 제거하려는 경우:

사용법: keystone user-role-remove --user <user> --role <role> --tenant <tenant>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# keystone user-role-remove --user user1 --role mybackup-role --tenant mybackup
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
[root@os ~]#
----------------------------------------------------------------------------------------------------




5단계: 컨테이너 설정

관리자는 다른 백업 사용자가 데이터를 저장할 수 있도록 컨테이너를 설정해야 합니다. mybackup 테넌트(프로젝트)에서 사용자 이름을 컨테이너 이름으로 사용하고 이 사용자에게 이 컨테이너의 읽기/쓰기 액세스 권한을 부여하는 것이 좋습니다. 이는 백업 사용자를 위한 백업 클라이언트 대상 설정을 단순화하기 때문입니다.

사용법: swift post <container name> -r $OS_TENANT_NAME:<user> -w $OS_TENANT_NAME:<user>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# swift post user1 -r $OS_TENANT_NAME:user1 -w $OS_TENANT_NAME:user1
[root@os ~]#
----------------------------------------------------------------------------------------------------


다음 명령으로 컨테이너 설정을 확인하십시오:

사용법: swift stat <user>

예시
----------------------------------------------------------------------------------------------------
[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:
 Accept-Ranges: bytes
   X-Timestamp: 1412578586.50844
  Content-Type: text/plain; charset=utf-8
[root@os ~]#
----------------------------------------------------------------------------------------------------


컨테이너를 제거하려는 경우:

사용법: swift delete <container>

예시
----------------------------------------------------------------------------------------------------
[root@os ~]# swift delete user1
1390527034510/files/2014-10-21-12-00-00/437b40c7/5e7e48e1/_$folder$
1390527034510/files/2014-10-20-12-00-00/_$folder$
    :
    :
    :
  Trimmed
    :
    :
    :
----------------------------------------------------------------------------------------------------


경고: 이 컨테이너에 업로드된 모든 파일이 제거됩니다. 명령줄에 확인이 없으므로 이 명령을 주의해서 다루십시오.





관련 주제