1. 程式人生 > >OpenStack-M版(Mitaka)搭建基於(Centos7.2)+++十、Openstack物件儲存服務(swift)完成安裝

OpenStack-M版(Mitaka)搭建基於(Centos7.2)+++十、Openstack物件儲存服務(swift)完成安裝

十、Openstack物件儲存服務(swift)完成安裝

一、啟動服務

1.在控制節點節點上,啟動物件儲存代理服務及其依賴服務,並將它們配置為隨系統啟動

systemctl enable openstack-swift-proxy.service memcached.service

systemctl start openstack-swift-proxy.service memcached.service

2.在儲存節點上,啟動物件儲存服務,並將其設定為隨系統啟動

systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service \
openstack-swift-account-reaper.service openstack-swift-account-replicator.service \
openstack-swift-container.service openstack-swift-container-auditor.service \
openstack-swift-container-replicator.service openstack-swift-container-updater.service \
openstack-swift-object.service openstack-swift-object-auditor.service \
openstack-swift-object-replicator.service openstack-swift-object-updater.service

systemctl start openstack-swift-account.service openstack-swift-account-auditor.service \
openstack-swift-account-reaper.service openstack-swift-account-replicator.service \
openstack-swift-container.service openstack-swift-container-auditor.service \
openstack-swift-container-replicator.service openstack-swift-container-updater.service \
openstack-swift-object.service openstack-swift-object-auditor.service \
openstack-swift-object-replicator.service openstack-swift-object-updater.service

一共12個服務

openstack-swift-account.service
openstack-swift-account-auditor.service
openstack-swift-account-reaper.service
openstack-swift-account-replicator.service
openstack-swift-container.service
openstack-swift-container-auditor.service
openstack-swift-container-replicator.service
openstack-swift-container-updater.service
openstack-swift-object.service
openstack-swift-object-auditor.service
openstack-swift-object-replicator.service
openstack-swift-object-updater.service


二、驗證操作

1.控制節點匯入demo憑證

. demo-openrc

2.顯示服務狀態

swift stat

[[email protected] ~]# . demo-openrc 
[[email protected] ~]# swift stat
                        Account: AUTH_8cc1c04a21ae4165a1667e0bd5029831
                     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: b24b3093654b4ba4be706fe675a03b2d
                    X-Timestamp: 1510843832.18905
                     X-Trans-Id: tx3a203d933678441fbbd8f-005a0da74b
                   Content-Type: text/plain; charset=utf-8
                  Accept-Ranges: bytes

3.建立container1容器

openstack container create container1

[[email protected] ~]# openstack container create container1
+---------------------------------------+------------+------------------------------------+
| account                               | container  | x-trans-id                         |
+---------------------------------------+------------+------------------------------------+
| AUTH_8cc1c04a21ae4165a1667e0bd5029831 | container1 | tx9cbd7d1486e64780a8bc6-005a0da775 |
+---------------------------------------+------------+------------------------------------+

4.上傳一個測試檔案到container1容器

建立一個檔案FILE

touch FILE
上傳測試檔案

openstack object create container1 FILE

[[email protected] ~]# openstack object create container1 FILE
+--------+------------+----------------------------------+
| object | container  | etag                             |
+--------+------------+----------------------------------+
| FILE   | container1 | d41d8cd98f00b204e9800998ecf8427e |
+--------+------------+----------------------------------+

5.列出container1容器裡的所有檔案

openstack object list container1

[[email protected] ~]# openstack object list container1
+------+
| Name |
+------+
| FILE |
+------+

6.從container1容器裡下載一個測試檔案

先將建立的FILE檔案刪除

[[email protected] ~]# rm FILE 
rm: remove regular empty file ‘FILE’? y
[[email protected] ~]# ls
admin-openrc  anaconda-ks.cfg  cirros-0.3.4-x86_64-disk.img  demo-openrc

下載

openstack object save container1 FILE

[[email protected] ~]# openstack object save container1 FILE
[[email protected] ~]# ls
admin-openrc  anaconda-ks.cfg  cirros-0.3.4-x86_64-disk.img  demo-openrc  FILE


到此swift結束