swift對象存儲安裝


對象存儲服務概覽
OpenStack對象存儲是一個多租戶的對象存儲系統,它支持大規模擴展,可以以低成本來管理大型的非結構化數據,通過RESTful HTTP 應用程序接口。
它包含下列組件:
代理服務器(swift-proxy-server)
接收OpenStack對象存儲API和純粹的HTTP請求以上傳文件,更改元數據,以及創建容器。它可服務於在web瀏覽器下顯示文件和容器列表。為了改進性能,代理服務可以使用可選的緩存,通常部署的是memcache。
賬戶服務器 (swift-account-server)
管理由對象存儲定義的賬戶。
容器服務器 (swift-container-server)
管理容器或文件夾的映射,對象存儲內部。
對象服務器 (swift-object-server)
在存儲節點上管理實際的對象,比如:文件。
各種定期進程
為了駕馭大型數據存儲的任務,復制服務需要在集群內確保一致性和可用性,其他定期進程有審計,更新和reaper。
WSGI中間件
掌控認證,使用OpenStack認證服務。
swift 客戶端
用戶可以通過此命令行客戶端來向REST API提交命令,授權的用戶角色可以是管理員用戶,經銷商用戶,或者是swift用戶。
swift-init
初始化環鏈文件生成的腳本,將守護進程名稱當作參數並提供命令。歸檔於http://docs.openstack.org/developer/swift/admin_guide.html#managing-services。
swift-recon
一個被用於檢索多種關於一個集群的度量和計量信息的命令行接口工具已被swift-recon中間件采集。
swift-ring-builder
存儲環鏈建立並重平衡實用程序。歸檔於http://docs.openstack.org/developer/swift/admin_guide.html#managing-the-rings。
 
本章節描述如何安裝和配置在存儲節點上處理account,container和object服務請求的代理服務。為了簡單起見,本指南在控制節點安裝和配置代理服務。不過,你可以在任何與存儲節點網絡聯通的節點上運行代理服務。另外,你可以在多個節點安裝和配置代理服務提高性能和冗余。更多信息,參考Deployment Guide < http://docs.openstack.org/developer/swift/deployment_guide.html>
先決條件
代理服務依賴於諸如身份認證服務所提供的認證和授權機制。但是,與其他服務不同,它也提供了一個內部機制可以在沒有任何其他OpenStack服務的情況下運行。不過為了簡單起見,本指南引用:doc: `keystone`中的身份認證服務。在你配置對象存儲服務前,你必須創建服務憑證和API端點。
 
本節適用於Red Hat Enterprise Linux 7和CentOS 7。
1.1 對象存儲服務不使用控制節點上的SQL數據庫。而是使用在每個存儲節點的分布式SQLite數據庫。
1 獲得 admin 憑證來獲取只有管理員能執行的命令的訪問權限:
$ . admin-openrc
2 要創建身份認證服務的憑證,完成這些步驟:
創建 swift 用戶:
[root@controller2 ~]# openstack user create --domain default --password-prompt swift
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | e9121a829e7348b2ae74b0be3956344c |
| name | swift |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
swift 用戶添加 admin 角色:
$ openstack role add --project service --user swift admin
創建 swift 服務條目:
$ openstack service create --name swift \
--description "OpenStack Object Storage" object-store
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Object Storage |
| enabled | True |
| id | 75ef509da2c340499d454ae96a2c5c34 |
| name | swift |
| type | object-store |
+-------------+----------------------------------+
3 創建對象存儲服務 API 端點:
[root@controller2 ~]# openstack endpoint create --region RegionOne \
> object-store public http://controller2:8080/v1/AUTH_%\(project_id\)s
+--------------+------------------------------------------------+
| Field | Value |
+--------------+------------------------------------------------+
| enabled | True |
| id | 1c18900ffb5043c4b212ecea17184846 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 8706e144a14048c185ced55739459257 |
| service_name | swift |
| service_type | object-store |
| url | http://controller2:8080/v1/AUTH_%(project_id)s |
+--------------+------------------------------------------------+
[root@controller2 ~]# openstack endpoint create --region RegionOne \
> object-store internal http://controller2:8080/v1/AUTH_%\(project_id\)s
+--------------+------------------------------------------------+
| Field | Value |
+--------------+------------------------------------------------+
| enabled | True |
| id | d2c28e09ef8d432c8af9b58f2bf89a94 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 8706e144a14048c185ced55739459257 |
| service_name | swift |
| service_type | object-store |
| url | http://controller2:8080/v1/AUTH_%(project_id)s |
+--------------+------------------------------------------------+
[root@controller2 ~]# openstack endpoint create --region RegionOne \
> object-store admin http://controller2:8080/v1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 725a4aa3078d4db09581ba5be5c76891 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 8706e144a14048c185ced55739459257 |
| service_name | swift |
| service_type | object-store |
| url | http://controller2:8080/v1 |
+--------------+----------------------------------+
1.2 安全並配置組件
注解
默認配置文件在各發行版本中可能不同。你可能需要添加這些部分,選項而不是修改已經存在的部分和選項。另外,在配置片段中的省略號( ...)表示默認的配置選項你應該保留。
1 安裝軟件包
# yum install openstack-swift-proxy python-swiftclient \
python-keystoneclient python-keystonemiddleware \
memcached
注解
完整的 OpenStack 環境已經包含了這些包的其中一部分。
2 從對象存儲的倉庫源中獲取代理服務的配置文件:
# curl -o /etc/swift/proxy-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/proxy-server.conf-sample
3 編輯文件 /etc/swift/proxy-server.conf 並完成如下動作:
[DEFAULT] 部分,配置綁定端口,用戶和配置目錄。
[DEFAULT]
...
bind_port = 8080
user = swift
swift_dir = /etc/swift
在``[pipeline:main]``部分,刪除``tempurl``和``tempauth``模塊並增加``authtoken``和``keystoneauth``模塊
[pipeline:main]
pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo versioned_writes proxy-logging proxy-server
注解:不要改變模塊的順序。
[app:proxy-server] 部分,啟動自動賬戶創建。
[app:proxy-server]
use = egg:swift#proxy
...
account_autocreate = True
[filter:keystoneauth] 部分,配置操作員角色。
[filter:keystoneauth]
use = egg:swift#keystoneauth
...
operator_roles = admin,user
[filter:authtoken] 部分,配置認證服務訪問。
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
...
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = swift
password = SWIFT_PASS
delay_auth_decision = True
使用你在身份認證服務中選擇的 swift 用戶密碼來替換 SWIFT_PASS 。
注解:注釋或者刪除掉在 [filter:authtoken] 部分的所有其他的內容。
[filter:cache] 部分,配置 memcached 的位置:
[filter:cache]
use = egg:swift#memcache
...
memcache_servers = controller:11211
二、安裝和配置存儲節點
本章節描述怎樣為操作帳號,容器和對象服務安裝和配置存儲節點。為簡單起見,這里配置兩個存儲節點,每個包含兩個空本地塊存儲設備。這個向導用的是 /dev/sdb``和 ``/dev/sdc,但是你可以用不同的值代替您的特定節點。
1.1 先決條件
在你在存儲節點上安裝和配置對象存儲服務之前,你必須准備好存儲設備。
 注解:在每個存儲節點上執行這些步驟。
1 安裝支持的工具包:
# yum install xfsprogs rsync
2 使用XFS格式化``/dev/sdb``和``/dev/sdc``設備:
# mkfs.xfs /dev/sdb
# mkfs.xfs /dev/sdc
3 創建掛載點目錄結構:
# mkdir -p /srv/node/sdb
# mkdir -p /srv/node/sdc
4 編輯``/etc/fstab``文件並添加以下內容:
/dev/sdb /srv/node/sdb xfs noatime,nodiratime,logbufs=8 0 2
/dev/sdc /srv/node/sdc xfs noatime,nodiratime,logbufs=8 0 2
5 掛載設備:
# mount /srv/node/sdb
# mount /srv/node/sdc
6 創建並編輯``/etc/rsyncd.conf``文件並包含以下內容:
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = MANAGEMENT_INTERFACE_IP_ADDRESS
 
[account]
max connections = 2
path = /srv/node/
read only = False
lock file = /var/lock/account.lock
 
[container]
max connections = 2
path = /srv/node/
read only = False
lock file = /var/lock/container.lock
 
[object]
max connections = 2
path = /srv/node/
read only = False
lock file = /var/lock/object.lock
替換 ``MANAGEMENT_INTERFACE_IP_ADDRESS`為存儲節點管理網絡的IP地址。
注解 ``rsync``服務不需要認證,所以考慮將它安裝在私有網絡的環境中
7 啟動 “rsyncd” 服務和配置它隨系統啟動:
# systemctl enable rsyncd.service
# systemctl start rsyncd.service
1.2 安全並配置組件
注解:默認配置文件在各發行版本中可能不同。你可能需要添加這些部分,選項而不是修改已經存在的部分和選項。另外,在配置片段中的省略號( ...)表示默認的配置選項你應該保留。
 注解:在每個存儲節點上執行這些步驟。
1 安裝軟件包:
# yum install openstack-swift-account openstack-swift-container \
openstack-swift-object
2 從對象存儲源倉庫中獲取accounting, container以及object服務配置文件
# curl -o /etc/swift/account-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/account-server.conf-sample
# curl -o /etc/swift/container-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/container-server.conf-sample
# curl -o /etc/swift/object-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/object-server.conf-sample
3 編輯 /etc/swift/account-server.conf 文件並完成下面操作:
在``[DEFAULT]`` 部分,配置綁定IP地址,綁定端口,用戶,配置目錄和掛載目錄:
[DEFAULT]
...
bind_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
bind_port = 6202
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
替換 ``MANAGEMENT_INTERFACE_IP_ADDRESS`為存儲節點管理網絡的IP地址。
在``[pipeline:main]``部分,啟用合適的模塊:
[pipeline:main]
pipeline = healthcheck recon account-server
注解: 更多關於啟用其他模塊的額外功能的信息,請參考`Deployment Guide < http://docs.openstack.org/developer/swift/deployment_guide.html>`__。
在``[filter:recon]``部分,配置recon (meters)緩存目錄:
[filter:recon]
use = egg:swift#recon
...
recon_cache_path = /var/cache/swift
4 編輯``/etc/swift/container-server.conf``文件並完成下列操作:
在``[DEFAULT]`` 部分,配置綁定IP地址,綁定端口,用戶,配置目錄和掛載目錄
[DEFAULT]
...
bind_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
bind_port = 6201
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
替換 ``MANAGEMENT_INTERFACE_IP_ADDRESS`為存儲節點管理網絡的IP地址。
在``[pipeline:main]``部分,啟用合適的模塊:
[pipeline:main]
pipeline = healthcheck recon container-server
 注解 更多關於啟用其他模塊的額外功能的信息,請參考`Deployment Guide < http://docs.openstack.org/developer/swift/deployment_guide.html>`__。
在``[filter:recon]``部分,配置recon (meters)緩存目錄:
[filter:recon]
use = egg:swift#recon
...
recon_cache_path = /var/cache/swift
5 編輯``/etc/swift/object-server.conf``文件並完成下列操作:
在``[DEFAULT]`` 部分,配置綁定IP地址,綁定端口,用戶,配置目錄和掛載目錄:
[DEFAULT]
...
bind_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
bind_port = 6200
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
替換 ``MANAGEMENT_INTERFACE_IP_ADDRESS`為存儲節點管理網絡的IP地址。
在``[pipeline:main]``部分,啟用合適的模塊:
[pipeline:main]
pipeline = healthcheck recon object-server
 注解 :更多關於啟用其他模塊的額外功能的信息,請參考`Deployment Guide < http://docs.openstack.org/developer/swift/deployment_guide.html>`__。
在``[filter:recon]``部分,配置recon(meters)緩存和lock目錄:
[filter:recon]
use = egg:swift#recon
...
recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock
6 確認掛載點目錄結構是否有合適的所有權:
# chown -R swift:swift /srv/node
7 創建 “recon” 目錄和確保它有合適的所有權:
# mkdir -p /var/cache/swift
# chown -R root:swift /var/cache/swift
# chmod -R 775 /var/cache/swift
三、創建,分發並初始化rings
3.1 創建賬戶ring
帳戶服務器使用帳戶 ring 來維護一個容器的列表。
1 切換到 ``/etc/swift``目錄。
2 創建基本 account.builder 文件:
# swift-ring-builder account.builder create 10 3 1
3 添加每個節點到 ring 中:
# swift-ring-builder account.builder \
add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6202 \
--device DEVICE_NAME --weight DEVICE_WEIGHT
STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS 替換為存儲節點管理網絡的IP地址。將 DEVICE_NAME``替換為同一個存儲節點存儲設備名稱。例如,使用 :ref:`swift-storage` 中的第一個存儲節點的 ``/dev/sdb 存儲設備,大小為100:
# swift-ring-builder account.builder add \
--region 1 --zone 1 --ip 10.0.0.51 --port 6202 --device sdb --weight 100
在每個存儲節點上面重復執行這個命令。在這個例子的架構中,使用該命令的四個變量:
# swift-ring-builder account.builder add \
--region 1 --zone 1 --ip 10.0.0.51 --port 6202 --device sdb --weight 100
Device d0r1z1-10.0.0.51:6202R10.0.0.51:6202/sdb_"" with 100.0 weight got id 0
# swift-ring-builder account.builder add \
--region 1 --zone 1 --ip 10.0.0.51 --port 6202 --device sdc --weight 100
Device d1r1z2-10.0.0.51:6202R10.0.0.51:6202/sdc_"" with 100.0 weight got id 1
# swift-ring-builder account.builder add \
--region 1 --zone 2 --ip 10.0.0.52 --port 6202 --device sdb --weight 100
Device d2r1z3-10.0.0.52:6202R10.0.0.52:6202/sdb_"" with 100.0 weight got id 2
# swift-ring-builder account.builder add \
--region 1 --zone 2 --ip 10.0.0.52 --port 6202 --device sdc --weight 100
Device d3r1z4-10.0.0.52:6202R10.0.0.52:6202/sdc_"" with 100.0 weight got id 3
4 驗證 ring 的內容:
# swift-ring-builder account.builder
account.builder, build version 4
1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion
The minimum number of hours before a partition can be reassigned is 1
The overload factor is 0.00% (0.000000)
Devices: id region zone ip address port replication ip replication port name weight partitions balance meta
0 1 1 10.0.0.51 6202 10.0.0.51 6202 sdb 100.00 0 -100.00
1 1 1 10.0.0.51 6202 10.0.0.51 6202 sdc 100.00 0 -100.00
2 1 2 10.0.0.52 6202 10.0.0.52 6202 sdb 100.00 0 -100.00
3 1 2 10.0.0.52 6202 10.0.0.52 6202 sdc 100.00 0 -100.00
5 平衡 ring:
# swift-ring-builder account.builder rebalance
Reassigned 1024 (100.00%) partitions. Balance is now 0.00. Dispersion is now 0.00
3.2 創建容器ring
容器服務器使用容器環來維護對象的列表。但是,它不跟蹤對象的位置。
1. 切換到 ``/etc/swift``目錄。
2 創建基本``container.builder``文件:
# swift-ring-builder container.builder create 10 3 1
3 添加每個節點到 ring 中:
# swift-ring-builder container.builder \
add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6201 \
--device DEVICE_NAME --weight DEVICE_WEIGHT
STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS 替換為存儲節點管理網絡的IP地址。將 DEVICE_NAME``替換為同一個存儲節點存儲設備名稱。例如,使用 :ref:`swift-storage` 中的第一個存儲節點的 ``/dev/sdb 存儲設備,大小為100:
# swift-ring-builder container.builder add \
--region 1 --zone 1 --ip 10.0.0.51 --port 6201 --device sdb --weight 100
在每個存儲節點上面重復執行這個命令。在這個例子的架構中,使用該命令的四個變量:
# swift-ring-builder container.builder add \
--region 1 --zone 1 --ip 10.0.0.51 --port 6201 --device sdb --weight 100
Device d0r1z1-10.0.0.51:6201R10.0.0.51:6201/sdb_"" with 100.0 weight got id 0
# swift-ring-builder container.builder add \
--region 1 --zone 1 --ip 10.0.0.51 --port 6201 --device sdc --weight 100
Device d1r1z2-10.0.0.51:6201R10.0.0.51:6201/sdc_"" with 100.0 weight got id 1
# swift-ring-builder container.builder add \
--region 1 --zone 2 --ip 10.0.0.52 --port 6201 --device sdb --weight 100
Device d2r1z3-10.0.0.52:6201R10.0.0.52:6201/sdb_"" with 100.0 weight got id 2
# swift-ring-builder container.builder add \
--region 1 --zone 2 --ip 10.0.0.52 --port 6201 --device sdc --weight 100
Device d3r1z4-10.0.0.52:6201R10.0.0.52:6201/sdc_"" with 100.0 weight got id 3
4 驗證 ring 的內容:
# swift-ring-builder container.builder
container.builder, build version 4
1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion
The minimum number of hours before a partition can be reassigned is 1
The overload factor is 0.00% (0.000000)
Devices: id region zone ip address port replication ip replication port name weight partitions balance meta
0 1 1 10.0.0.51 6201 10.0.0.51 6201 sdb 100.00 0 -100.00
1 1 1 10.0.0.51 6201 10.0.0.51 6201 sdc 100.00 0 -100.00
2 1 2 10.0.0.52 6201 10.0.0.52 6201 sdb 100.00 0 -100.00
3 1 2 10.0.0.52 6201 10.0.0.52 6201 sdc 100.00 0 -100.00
5 平衡 ring:
# swift-ring-builder container.builder rebalance
Reassigned 1024 (100.00%) partitions. Balance is now 0.00. Dispersion is now 0.00
3.3 創建對象ring
對象服務器使用對象環來維護對象在本地設備上的位置列表。
1 切換到 ``/etc/swift``目錄。
2 創建基本``object.builder``文件:
swift-ring-builder object.builder create 10 3 1
3 添加每個節點到 ring 中:
# swift-ring-builder object.builder \
add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6200 \
--device DEVICE_NAME --weight DEVICE_WEIGHT
STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS 替換為存儲節點管理網絡的IP地址。將 DEVICE_NAME``替換為同一個存儲節點存儲設備名稱。例如,使用 :ref:`swift-storage` 中的第一個存儲節點的 ``/dev/sdb 存儲設備,大小為100:
# swift-ring-builder object.builder add \
--region 1 --zone 1 --ip 10.0.0.51 --port 6200 --device sdb --weight 100
在每個存儲節點上面重復執行這個命令。在這個例子的架構中,使用該命令的四個變量:
# swift-ring-builder object.builder add \
--region 1 --zone 1 --ip 10.0.0.51 --port 6200 --device sdb --weight 100
Device d0r1z1-10.0.0.51:6200R10.0.0.51:6200/sdb_"" with 100.0 weight got id 0
# swift-ring-builder object.builder add \
--region 1 --zone 1 --ip 10.0.0.51 --port 6200 --device sdc --weight 100
Device d1r1z2-10.0.0.51:6200R10.0.0.51:6200/sdc_"" with 100.0 weight got id 1
# swift-ring-builder object.builder add \
--region 1 --zone 2 --ip 10.0.0.52 --port 6200 --device sdb --weight 100
Device d2r1z3-10.0.0.52:6200R10.0.0.52:6200/sdb_"" with 100.0 weight got id 2
# swift-ring-builder object.builder add \
--region 1 --zone 2 --ip 10.0.0.52 --port 6200 --device sdc --weight 100
Device d3r1z4-10.0.0.52:6200R10.0.0.52:6200/sdc_"" with 100.0 weight got id 3
4 驗證 ring 的內容:
# swift-ring-builder object.builder
object.builder, build version 4
1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion
The minimum number of hours before a partition can be reassigned is 1
The overload factor is 0.00% (0.000000)
Devices: id region zone ip address port replication ip replication port name weight partitions balance meta
0 1 1 10.0.0.51 6200 10.0.0.51 6200 sdb 100.00 0 -100.00
1 1 1 10.0.0.51 6200 10.0.0.51 6200 sdc 100.00 0 -100.00
2 1 2 10.0.0.52 6200 10.0.0.52 6200 sdb 100.00 0 -100.00
3 1 2 10.0.0.52 6200 10.0.0.52 6200 sdc 100.00
5 平衡 ring:
# swift-ring-builder object.builder rebalance
Reassigned 1024 (100.00%) partitions. Balance is now 0.00. Dispersion is now 0.00
3.4分發環配置文件
復制``account.ring.gz``, container.ring.gz``和``object.ring.gz 文件到每個存儲節點和其他運行了代理服務的額外節點的 /etc/swift 目錄。
四、完成安裝
注解:默認配置文件在各發行版本中可能不同。你可能需要添加這些部分,選項而不是修改已經存在的部分和選項。另外,在配置片段中的省略號(...)表示默認的配置選項你應該保留。
1 從對象存儲源倉庫中獲取 /etc/swift/swift.conf 文件:
# curl -o /etc/swift/swift.conf \
https://opendev.org/openstack/swift/raw/branch/master/etc/swift.conf-sample
2 編輯 /etc/swift/swift.conf 文件並完成以下動作:
在``[swift-hash]``部分,為你的環境配置哈希路徑前綴和后綴:
[swift-hash]
...
swift_hash_path_suffix = HASH_PATH_SUFFIX
swift_hash_path_prefix = HASH_PATH_PREFIX
將其中的 HASH_PATH_PREFIX和 HASH_PATH_SUFFIX替換為唯一的值。警告:這些值要保密,並且不要修改或丟失。
在``[storage-policy:0]``部分,配置默認存儲策略:
[storage-policy:0]
...
name = Policy-0
default = yes
3 復制``swift.conf`` 文件到每個存儲節點和其他允許了代理服務的額外節點的 /etc/swift 目錄。
4 在所有節點上,確認配置文件目錄是否有合適的所有權:
# chown -R root:swift /etc/swift
5 在控制節點和其他運行了代理服務的節點上,啟動對象存儲代理服務及其依賴服務,並將它們配置為隨系統啟動:
# systemctl enable openstack-swift-proxy.service memcached.service
# systemctl start openstack-swift-proxy.service memcached.service
6 在存儲節點上,啟動對象存儲服務,並將其設置為隨系統啟動:
# systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service \
openstack-swift-account-reaper.service openstack-swift-account-replicator.service
# systemctl start openstack-swift-account.service openstack-swift-account-auditor.service \
openstack-swift-account-reaper.service openstack-swift-account-replicator.service
# systemctl enable openstack-swift-container.service \
openstack-swift-container-auditor.service openstack-swift-container-replicator.service \
openstack-swift-container-updater.service
# systemctl start openstack-swift-container.service \
openstack-swift-container-auditor.service openstack-swift-container-replicator.service \
openstack-swift-container-updater.service
# systemctl enable openstack-swift-object.service openstack-swift-object-auditor.service \
openstack-swift-object-replicator.service openstack-swift-object-updater.service
# systemctl start openstack-swift-object.service openstack-swift-object-auditor.service \
openstack-swift-object-replicator.service openstack-swift-object-updater.service
五、驗證操作
驗證對象存儲服務的操作。
 注解
在控制節點上執行這些步驟。
警告
如果其中的一項或多項步驟沒有正確執行,請在``/var/log/audit/audit.log``文件中檢查SELinux的關於禁止``swift``過程的信息。如果該文件存在的話,將``/srv/node``目錄下``swift_data_t`` type, object_r role 和the system_u user關於安全等級的信息設置成最低安全等級(s0)
# chcon -R system_u:object_r:swift_data_t:s0 /srv/node
1 導入``demo``憑證
$ . demo-openrc
2 顯示服務狀態:
$ swift stat
Account: AUTH_ed0b60bf607743088218b0a533d5943f
Containers: 0
Objects: 0
Bytes: 0
Containers in policy "policy-0": 0
Objects in policy "policy-0": 0
Bytes in policy "policy-0": 0
X-Account-Project-Domain-Id: default
X-Timestamp: 1444143887.71539
X-Trans-Id: tx1396aeaf17254e94beb34-0056143bde
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes
3 創建``container1``容器
$ openstack container create container1
+---------------------------------------+------------+------------------------------------+
| account | container | x-trans-id |
+---------------------------------------+------------+------------------------------------+
| AUTH_ed0b60bf607743088218b0a533d5943f | container1 | tx8c4034dc306c44dd8cd68-0056f00a4a |
+---------------------------------------+------------+------------------------------------+
4 上傳一個測試文件到``container1``容器
$ openstack object create container1 FILE
+--------+------------+----------------------------------+
| object | container | etag |
+--------+------------+----------------------------------+
| FILE | container1 | ee1eca47dc88f4879d8a229cc70a07c6 |
+--------+------------+----------------------------------+
5 列出``container1``容器里的所有文件
$ openstack object list container1
+------+
| Name |
+------+
| FILE |
+------+
6 從``container1``容器里下載一個測試文件
$ openstack object save container1 FILE



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM