next up previous contents
Next: 建立 Swift Storage Node Up: 物件儲存 Swift Previous: 認識 Swift   Contents

Swift 安裝

  1. 安裝套件
    [root@kvm4 ~]# yum install -y openstack-swift openstack-swift-proxy \
    openstack-swift-object openstack-swift-container \
    openstack-swift-account memcached
    
  2. 載入管理者環境變數。
    [root@kvm4 ~]# source keystonerc_admin 
    [root@kvm4 ~(keystone_admin)]#
    
  3. 產生用戶 swift。
    [root@kvm4 ~(keystone_admin)]# keystone user-create --name swift --pass 123qwe
    +----------+----------------------------------+
    | Property |              Value               |
    +----------+----------------------------------+
    |  email   |                                  |
    | enabled  |               True               |
    |    id    | a863ddc96851437fa48e2a35981c7e1f |
    |   name   |              swift               |
    | tenantId |                                  |
    +----------+----------------------------------+
    
  4. 確認管理者角色存在?
    [root@kvm4 ~(keystone_admin)]# keystone role-list | grep admin
    | 91f1e2429c614bac8efe19cef39e8e7d |  admin   |
    
  5. 如果不存在,則必須產生管理者角色
    [root@kvm4 ~]# keystone role-create --name admin
    
  6. 確認租戶 services 存在?
    [root@kvm4 ~(keystone_admin)]# keystone tenant-list | grep services
    [root@kvm4 ~(keystone_admin)]#
    
  7. 如果不存在,必須產生租戶 services。
    [root@kvm4 ~(keystone_admin)]# keystone tenant-create --name services
    +-------------+----------------------------------+
    |   Property  |              Value               |
    +-------------+----------------------------------+
    | description |                                  |
    |   enabled   |               True               |
    |      id     | da7fe21aa92743f9baa51fd4368e6726 |
    |     name    |             services             |
    +-------------+----------------------------------+
    
  8. 以管理者 admin 角色新增用戶 swift 到 services 租戶。
    [root@kvm4 ~(keystone_admin)]# keystone user-role-add \
    --role admin --tenant services --user swift
    
  9. 確認 object store 服務是否存在?
    [root@kvm4 ~(keystone_admin)]# keystone service-list 
    +----------------------------------+----------+----------+---------------------------+
    |                id                |   name   |   type   |        description        |
    +----------------------------------+----------+----------+---------------------------+
    | 487d5875de1a47898329fb7b68c718e8 | keystone | identity | Keystone Identity Service |
    +----------------------------------+----------+----------+---------------------------+
    
  10. 如果 object store 服務不存在,則必須產生並記下其 id,做為建立 swift endpoint 用。
    [root@kvm4 ~(keystone_admin)]# keystone service-create \
    --name swift --type object-store --description "Swift Storage Service"
    +-------------+----------------------------------+
    |   Property  |              Value               |
    +-------------+----------------------------------+
    | description |      Swift Storage Service       |
    |      id     | 8133b2b0b179450c9e177f617a228f7a |
    |     name    |              swift               |
    |     type    |           object-store           |
    +-------------+----------------------------------+
    
  11. 建立 swift 服務的 endpoint
    [root@kvm4 ~(keystone_admin)]# keystone endpoint-create \
    --service-id 8133b2b0b179450c9e177f617a228f7a \
    --publicurl "http://kvm4.deyu.wang:8080/v1/AUTH_%(tenant_id)s" \
    --adminurl "http://kvm4.deyu.wang:8080/v1/AUTH_%(tenant_id)s" \
    --internalurl "http://kvm4.deyu.wang:8080/v1/AUTH_%(tenant_id)s"
    +-------------+--------------------------------------------------+
    |   Property  |                      Value                       |
    +-------------+--------------------------------------------------+
    |   adminurl  | http://kvm4.deyu.wang:8080/v1/AUTH_%(tenant_id)s |
    |      id     |         7fd689cdf42d4dbda513f1fd3ca25244         |
    | internalurl | http://kvm4.deyu.wang:8080/v1/AUTH_%(tenant_id)s |
    |  publicurl  | http://kvm4.deyu.wang:8080/v1/AUTH_%(tenant_id)s |
    |    region   |                    regionOne                     |
    |  service_id |         8133b2b0b179450c9e177f617a228f7a         |
    +-------------+--------------------------------------------------+
    



2015-12-29