OpenStack Yoga版安裝筆記(23)Swift安裝

一、官方文檔?

Object Storage Install Guide — Swift 2.29.3.dev5 documentation

二、環境準備

之前的實驗,已經有controller, compute1, block1節點,并已經完成Keystone、Glance、Nova、Neutron、Cinder等主要OpenStack Service的安裝。?

此處新增加object1、object2節點,參考《OpenStack Yoga版安裝筆記(二)環境安裝》進行環境準備,object1、object2各新增加2塊硬盤/dev/sdb,/dev/sdc。

1、安裝vim/ping2、網卡設置
root@object1:~# cat /etc/netplan/00-installer-config.yaml 
# This is the network config written by 'subiquity'
network:ethernets:ens32:addresses:- 10.0.20.14/24nameservers:addresses:- 10.0.20.2search: []routes:- to: defaultvia: 10.0.20.2version: 23、hostname設置
root@object1:~# hostname
object14、/etc/hosts文件修改
root@object1:~# cat /etc/hosts
127.0.0.1 localhost
# 127.0.1.1 host2# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters10.0.20.11 controller
10.0.20.12 compute1
10.0.20.13 block1
10.0.20.14 object1
10.0.20.15 object25、NTP設置
root@object1:~# cat /etc/chrony/chrony.conf 
...
# pool ntp.ubuntu.com        iburst maxsources 4
# pool 0.ubuntu.pool.ntp.org iburst maxsources 1
# pool 1.ubuntu.pool.ntp.org iburst maxsources 1
# pool 2.ubuntu.pool.ntp.org iburst maxsources 2server controller iburst
...
root@object1:~# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* controller                    3   6   377    44  +2058ns[-4498ns] +/-   28ms
root@object1:~# 6、新增兩塊硬盤:/dev/sdb,/dev/sdc
root@object1:~# lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda                         8:0    0   20G  0 disk 
├─sda1                      8:1    0    1M  0 part 
├─sda2                      8:2    0  1.8G  0 part /boot
└─sda3                      8:3    0 18.2G  0 part └─ubuntu--vg-ubuntu--lv 253:0    0   10G  0 lvm  /
sdb                         8:16   0   20G  0 disk 
sdc                         8:32   0   20G  0 disk 
sr0                        11:0    1    2G  0 rom  
root@object1:~# 

?三、Object Storage service overview

OpenStack對象存儲(Swift)是一個多租戶的對象存儲系統,具有高度的可擴展性,能夠通過RESTful HTTP API以低成本管理大量非結構化數據。?其架構模塊化,便于擴展和維護。以下是Swift的主要組件及其功能:?

1. Proxy servers(swift-proxy-server)

  • 功能:?接收并處理來自客戶端的API請求和raw HTTP請求,負責文件上傳、元數據修改和容器創建等操作,同時向Web瀏覽器提供文件或容器(contaiener的列表。

  • 性能優化:?可與memcache等緩存系統配合使用,以提高性能。

2. Account servers(swift-account-server)

  • 功能:?管理在對象存儲中定義的賬戶。

  • 數據存儲:?使用SQLite數據庫存儲賬戶信息。

3. Container servers(swift-container-server)

  • 功能:?管理容器或文件夾在對象存儲中的映射關系。

  • 數據存儲:?使用SQLite數據庫存儲容器信息。

4. Object Servers(swift-object-server)

  • 功能:?管理存儲節點上的實際對象(如文件)。

  • 數據存儲:?將對象存儲在磁盤上,并使用擴展文件屬性(xattr)存儲元數據。

5. Various periodic processes

  • 功能:?執行對大數據存儲的日常維護任務。

  • 主要進程

    • 復制服務(replication service):?確保數據在集群中的一致性和可用性。

    • 審計員(Auditor):?檢查數據的完整性。

    • 更新程序(Updater):?更新數據的元信息。

    • 回收程序(Reaper):?刪除過期或無效的數據。

6. WSGI middleware

  • 功能:?處理身份驗證,通常與OpenStack身份認證系統(Keystone)結合使用。

7. Swift客戶端(swift client)

  • 功能:?允許用戶通過命令行客戶端向REST API提交命令,命令可以由admin user、reseller user或swift user授權執行。

8. Swift初始化腳本(swift-init)

  • 功能:?初始化環文件的構建,接受守護進程名稱作為參數,并提供相關命令。

  • 文檔:?詳見官方文檔。

?swift-init 是 OpenStack Swift 的初始化腳本,用于管理和啟動 Swift 的各個守護進程。?它簡化了服務的啟動、停止、重啟等操作,尤其在需要同時管理多個服務時尤為方便。

📌 功能概述

swift-init 允許管理員通過統一的命令管理 Swift 的各個服務,而無需單獨調用每個服務的初始化腳本。?它支持對單個服務、多個服務或所有服務進行操作。

🛠 常用命令

swift-init 的基本語法如下:?

swift-init <server> <command>

  • <server>:?指定要操作的服務,可以是以下之一:

    • proxy:?Swift 代理守護進程

    • accountcontainerobject:?分別對應賬戶、容器和對象服務

    • all:所有服務

    • main:?主要服務(proxyaccountcontainerobject

    • rest:?所有 REST 相關服務

  • <command>:?要執行的操作,常見的有:

    • start:啟動服務

    • stop:停止服務

    • restart:重啟服務

    • shutdown:?優雅地關閉服務

    • reload:?重新加載服務配置

    • reload-seamless:?無縫重新加載服務配置

9. Swift監控工具(swift-recon)

  • 功能:?用于檢索由swift-recon中間件收集的集群指標和遙測信息。

  • 用途:?幫助管理員監控集群的健康狀態。?

10. Swift環構建工具(swift-ring-builder)

  • 功能:?構建和重新平衡存儲環。

  • 用途:?確保數據在集群中的均勻分布。

  • 文檔:?詳見官方文檔。

swift-ring-builder 是 OpenStack Swift 中用于構建和管理存儲環(Ring)的命令行工具。?存儲環是 Swift 存儲系統的核心組件,決定了數據如何在集群中分布。?通過該工具,管理員可以創建、修改和維護賬戶、容器和對象服務的環配置。

🔧 swift-ring-builder 的主要功能

  1. 創建環文件:?初始化一個新的環配置文件。

    swift-ring-builder <ring_file> create <part_power> <replicas> <min_part_hours>

    • <ring_file>:?環配置文件的名稱,如 account.buildercontainer.builderobject.builder

    • <part_power>:?分區數量的指數(2 的冪次方)。

    • <replicas>:?每個分區的副本數量。

    • <min_part_hours>:?在重新分配分區之前,分區必須存在的最短時間(以小時為單位)。

  2. 添加設備到環中:?將存儲節點的設備添加到環配置中。

    swift-ring-builder <ring_file> add --region <region> --zone <zone> --ip <ip> --port <port> --device <device> --weight <weight>

    • <region>:?設備所在的區域編號。

    • <zone>:?設備所在的可用區編號。

    • <ip>:?設備的管理 IP 地址。

    • <port>:?服務端口號(如 6000、6001、6002)。

    • <device>:?設備名稱(如 sdasdb)。

    • <weight>:?設備的權重,影響分區的分配比例。?

  3. 重平衡環:?根據當前的設備配置重新分配分區,以確保數據均勻分布。

    swift-ring-builder <ring_file> rebalance

  4. 寫入環文件:?生成 .ring.gz 文件,供 Swift 服務使用。

    swift-ring-builder <ring_file> write_ring
  5. 驗證環配置:?檢查環配置的有效性。

????????swift-ring-builder <ring_file> validate


🧠 理解環參數

  • part_power:?決定分區數量的指數,2^part_power 即為總分區數。

  • replicas:?每個分區的副本數量,影響數據的冗余度。

  • min_part_hours:?分區在被重新分配之前必須存在的最短時間,有助于減少頻繁的分區遷移。?


?? 使用建議

  • 備份 .builder 文件:?在修改環配置之前,建議備份 .builder 文件,以防止數據丟失。

  • 定期重平衡:?在添加或移除設備后,執行重平衡操作,確保數據均勻分布。

  • 監控環狀態:?使用 swift-ring-builder <ring_file> validate 檢查環配置的有效性。?

Swift的架構設計強調高可用性、高持久性和高并發性,適用于大規模數據存儲需求。?通過上述組件的協作,Swift能夠提供可靠的對象存儲服務。

四、Configure networking

在前面環境準備中已完成。

五、Install and configure the controller node(選擇Ubuntu)

本節描述如何安裝和配置proxy service。?在 OpenStack Swift 中,代理服務(Proxy Service)是連接客戶端請求與后端存儲服務的關鍵組件。?它負責處理賬戶(Account)、容器(Container)和對象(Object)服務的請求,并將請求路由到相應的存儲節點。

為了簡單起見,本指南在控制節點上安裝和配置代理服務。然而,您可以在任何能夠連接到存儲節點網絡的節點上運行代理服務。此外,您還可以在多個節點上安裝和配置代理服務,以提高性能和冗余性。

5.1 Prerequisites

?在 OpenStack Swift 中,代理服務(Proxy Server)負責處理賬戶、容器和對象服務的請求。?雖然它通常依賴于身份認證與授權機制(如 OpenStack Identity 服務),但也提供了一個內部機制,使其在沒有其他 OpenStack 服務的情況下也能運行。?在配置對象存儲服務之前,必須創建服務憑證和 API 端點。

注:對象存儲服務不在控制節點上使用SQL數據庫,而是使用每個存儲節點上的分布式SQLite數據庫。

?在 OpenStack Swift 中,對象存儲服務(Object Storage) 的架構設計強調去中心化和高可用性。?與許多傳統存儲系統依賴集中式 SQL 數據庫不同,Swift 采用分布式 SQLite 數據庫,分別部署在每個存儲節點上,以管理賬戶、容器和對象的元數據。

1、Source the?admin?credentials to gain access to admin-only CLI commands:

root@osclient:~# source admin-openrc 
root@osclient ~(admin/amdin)# cat admin-openrc 
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
export PS1='\u@\h \W(admin/amdin)\$ '
root@osclient ~(admin/amdin)# 

?2、To create the Identity service credentials, complete these steps:

  • Create the?swift?user:
root@osclient ~(admin/amdin)# openstack user create --domain default --password-prompt swift
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | fc098317d7ed4e2cbe2e4a80886c3109 |
| name                | swift                            |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
root@osclient ~(admin/amdin)#
  • Add the?admin?role to the?swift?user:
root@osclient ~(admin/amdin)# openstack role add --project service --user swift admin
root@osclient ~(admin/amdin)# 
  • Create the?swift?service entity:
root@osclient ~(admin/amdin)# openstack service create --name swift \
>   --description "OpenStack Object Storage" object-store
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Object Storage         |
| enabled     | True                             |
| id          | 2df36ab13b3f452bad5f7a2faecca327 |
| name        | swift                            |
| type        | object-store                     |
+-------------+----------------------------------+
root@osclient ~(admin/amdin)#

3、Create the Object Storage service API endpoints:

root@osclient ~(admin/amdin)# openstack endpoint create --region RegionOne \
>   object-store public http://controller:8080/v1/AUTH_%\(project_id\)s
+--------------+-----------------------------------------------+
| Field        | Value                                         |
+--------------+-----------------------------------------------+
| enabled      | True                                          |
| id           | 2a487d3946fa4393a0b7232703f1be39              |
| interface    | public                                        |
| region       | RegionOne                                     |
| region_id    | RegionOne                                     |
| service_id   | 2df36ab13b3f452bad5f7a2faecca327              |
| service_name | swift                                         |
| service_type | object-store                                  |
| url          | http://controller:8080/v1/AUTH_%(project_id)s |
+--------------+-----------------------------------------------+
root@osclient ~(admin/amdin)# openstack endpoint create --region RegionOne \
>   object-store internal http://controller:8080/v1/AUTH_%\(project_id\)s
+--------------+-----------------------------------------------+
| Field        | Value                                         |
+--------------+-----------------------------------------------+
| enabled      | True                                          |
| id           | 87dae0b29b8f4f3385e7f9f831351d56              |
| interface    | internal                                      |
| region       | RegionOne                                     |
| region_id    | RegionOne                                     |
| service_id   | 2df36ab13b3f452bad5f7a2faecca327              |
| service_name | swift                                         |
| service_type | object-store                                  |
| url          | http://controller:8080/v1/AUTH_%(project_id)s |
+--------------+-----------------------------------------------+
root@osclient ~(admin/amdin)# openstack endpoint create --region RegionOne \
>   object-store admin http://controller:8080/v1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 33632ba9186848299ff0e712134269ce |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 2df36ab13b3f452bad5f7a2faecca327 |
| service_name | swift                            |
| service_type | object-store                     |
| url          | http://controller:8080/v1        |
+--------------+----------------------------------+
root@osclient ~(admin/amdin)# 

在 OpenStack Swift 的默認配置中,端口 8080 是用于對象存儲服務的 代理服務swift-proxy-server)的端口。具體來說,代理服務會接收客戶端的請求,處理對象存儲的 API 請求,并將請求路由到后端的存儲節點。

其他端口(如 6000、6001、6002):用于 Swift 存儲節點的對象服務、容器服務和賬戶服務。

5.2 Install and configure components?

1、Install the packages(出現問題并解決):

root@controller:~# apt-get install swift swift-proxy python-swiftclient \
>   python-keystoneclient python-keystonemiddleware \
>   memcached
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python-swiftclient
E: Unable to locate package python-keystoneclient
E: Unable to locate package python-keystonemiddleware
root@controller:~# 

?將python改為python3(參考:https://www.server-world.info/en/note?os=Ubuntu_22.04&p=openstack_bobcat3&f=12):


root@controller:~# apt-get install swift swift-proxy python3-swiftclient \
>   python3-keystoneclient python3-keystonemiddleware \
>   memcached
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-keystoneclient is already the newest version (1:4.4.0-0ubuntu1).
python3-keystoneclient set to manually installed.
python3-swiftclient is already the newest version (1:3.13.1-0ubuntu1).
python3-swiftclient set to manually installed.
memcached is already the newest version (1.6.14-1ubuntu0.1).
python3-keystonemiddleware is already the newest version (9.4.0-0ubuntu1.1).
python3-keystonemiddleware set to manually installed.
The following additional packages will be installed:liberasurecode1 libgf-complete1 libjerasure2 python3-pyeclib python3-swift python3-xattr
Suggested packages:libisal2 swift-bench
The following NEW packages will be installed:liberasurecode1 libgf-complete1 libjerasure2 python3-pyeclib python3-swift python3-xattr swift swift-proxy
0 upgraded, 8 newly installed, 0 to remove and 110 not upgraded.
Need to get 907 kB of archives.
After this operation, 4909 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://cn.archive.ubuntu.com/ubuntu jammy/main amd64 liberasurecode1 amd64 1.6.2-1build2 [43.3 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu jammy/main amd64 python3-pyeclib amd64 1.6.0-7build1 [28.6 kB]
Get:3 http://cn.archive.ubuntu.com/ubuntu jammy/main amd64 libgf-complete1 amd64 1.0.2+2017.04.10.git.ea75cdf-7build1 [70.2 kB]
Get:4 http://cn.archive.ubuntu.com/ubuntu jammy/main amd64 libjerasure2 amd64 2.0.0+2017.04.10.git.de1739cc84-2build2 [29.3 kB]
Get:5 http://cn.archive.ubuntu.com/ubuntu jammy/main amd64 python3-xattr amd64 0.9.7-1build4 [16.3 kB]
Get:6 http://cn.archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3-swift all 2.29.2-0ubuntu1 [653 kB]
Get:7 http://cn.archive.ubuntu.com/ubuntu jammy-updates/main amd64 swift all 2.29.2-0ubuntu1 [26.7 kB]
Get:8 http://cn.archive.ubuntu.com/ubuntu jammy-updates/main amd64 swift-proxy all 2.29.2-0ubuntu1 [39.1 kB]
Fetched 907 kB in 5s (188 kB/s)   
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package liberasurecode1:amd64.
(Reading database ... 168181 files and directories currently installed.)
Preparing to unpack .../0-liberasurecode1_1.6.2-1build2_amd64.deb ...
Unpacking liberasurecode1:amd64 (1.6.2-1build2) ...
Selecting previously unselected package python3-pyeclib.
Preparing to unpack .../1-python3-pyeclib_1.6.0-7build1_amd64.deb ...
Unpacking python3-pyeclib (1.6.0-7build1) ...
Selecting previously unselected package libgf-complete1:amd64.
Preparing to unpack .../2-libgf-complete1_1.0.2+2017.04.10.git.ea75cdf-7build1_amd64.deb ...
Unpacking libgf-complete1:amd64 (1.0.2+2017.04.10.git.ea75cdf-7build1) ...
Selecting previously unselected package libjerasure2:amd64.
Preparing to unpack .../3-libjerasure2_2.0.0+2017.04.10.git.de1739cc84-2build2_amd64.deb ...
Unpacking libjerasure2:amd64 (2.0.0+2017.04.10.git.de1739cc84-2build2) ...
Selecting previously unselected package python3-xattr.
Preparing to unpack .../4-python3-xattr_0.9.7-1build4_amd64.deb ...
Unpacking python3-xattr (0.9.7-1build4) ...
Selecting previously unselected package python3-swift.
Preparing to unpack .../5-python3-swift_2.29.2-0ubuntu1_all.deb ...
Unpacking python3-swift (2.29.2-0ubuntu1) ...
Selecting previously unselected package swift.
Preparing to unpack .../6-swift_2.29.2-0ubuntu1_all.deb ...
Unpacking swift (2.29.2-0ubuntu1) ...
Selecting previously unselected package swift-proxy.
Preparing to unpack .../7-swift-proxy_2.29.2-0ubuntu1_all.deb ...
Unpacking swift-proxy (2.29.2-0ubuntu1) ...
Setting up python3-xattr (0.9.7-1build4) ...
Setting up liberasurecode1:amd64 (1.6.2-1build2) ...
Setting up libgf-complete1:amd64 (1.0.2+2017.04.10.git.ea75cdf-7build1) ...
Setting up libjerasure2:amd64 (2.0.0+2017.04.10.git.de1739cc84-2build2) ...
Setting up python3-pyeclib (1.6.0-7build1) ...
Setting up python3-swift (2.29.2-0ubuntu1) ...
Setting up swift (2.29.2-0ubuntu1) ...
Setting up swift-proxy (2.29.2-0ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/swift-proxy.service → /lib/systemd/system/swift-proxy.service.
Processing triggers for libc-bin (2.35-0ubuntu3.9) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline
Scanning processes...                                                                                                                                                                                                                                           
Scanning linux images...                                                                                                                                                                                                                                        Running kernel seems to be up-to-date.No services need to be restarted.No containers need to be restarted.No user sessions are running outdated binaries.No VM guests are running outdated hypervisor (qemu) binaries on this host.
root@controller:~# 

b. Create the?/etc/swift?directory

目錄已經存在。

root@controller:/etc/swift# ls
account-server.conf  container-server.conf  object-expirer.conf  object-server.conf

c.?Obtain the proxy service configuration file from the Object Storage source repository:

root@controller:/etc/swift# curl -o /etc/swift/proxy-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/proxy-server.conf-sample% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100 62649  100 62649    0     0  63461      0 --:--:-- --:--:-- --:--:-- 63409
root@controller:/etc/swift# ls
account-server.conf  container-server.conf  object-expirer.conf  object-server.conf  proxy-server.conf
root@controller:/etc/swift# 

d. Edit the?/etc/swift/proxy-server.conf?file and complete the following actions:

  • In the?[DEFAULT]?section, configure the bind port, user, and configuration directory:
[DEFAULT]
...
bind_port = 8080
user = swift
swift_dir = /etc/swift
...
  • In the?[pipeline:main]?section, remove the?tempurl?and?tempauth?modules and add the?authtoken?and?keystoneauth?modules:
[pipeline:main]
...
# pipeline = catch_errors gatekeeper healthcheck proxy-logging cache listing_formats container_sync bulk tempurl ratelimit tempauth copy container-quotas account-quotas slo dlo versioned_writes symlink proxy-logging proxy-server
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
...
  • In the?[app:proxy-server]?section, enable automatic account creation:
[app:proxy-server]
use = egg:swift#proxy
account_autocreate = True
  • In the?[filter:keystoneauth]?section, configure the operator roles:
[filter:keystoneauth]
use = egg:swift#keystoneauth
operator_roles = admin,myrole <--需要添加需要的role,這里添加“myrole"
  • use = egg:swift#keystoneauth 指定使用 Swift 自帶的 Keystone 認證中間件,它會攔截 API 請求,將 Keystone 的令牌與 Swift 賬戶映射并進行權限校驗 OpenStack 文檔。

  • operator_roles 列表中的角色(逗號分隔)定義了哪些 Keystone 角色被視為“操作者”角色,只有當用戶在其項目(tenant)中擁有其中任一角色時,才允許訪問或操作該項目對應的 Swift 賬戶(如列出容器、創建容器等)?。

  • 若將 operator_roles = admin,user,則具有 adminuser 角色的 Keystone 用戶都可以對對應項目下的 Swift 賬戶進行操作。通常,user 是普通租戶用戶的默認角色,而 admin 則是管理角色

  • 由于在之前,已經創建“myuser" user以 "myrole" role訪問”myproject" project,這里需要增加“myrole" role,以便后續使用。

  • In the?[filter:authtoken]?section, configure Identity service access:
[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 = openstack
delay_auth_decision = True
  • In the?[filter:cache]?section, configure the?memcached?location:
[filter:cache]
use = egg:swift#memcache
memcache_servers = controller:11211

六、Install and configure the storage nodes(選擇Ubuntu)

本節描述了如何安裝和配置運行Account、Container和Object服務的存儲節點。為了簡單起見,此配置引用了兩個存儲節點,每個節點包含兩個空的本地塊存儲設備。說明中使用了/dev/sdb/dev/sdc,但您可以根據您的特定節點替換為不同的值。

雖然對象存儲支持任何具有擴展屬性(xattr)的文件系統,但測試和基準測試表明,XFS在性能和可靠性方面表現最佳。有關水平擴展環境的更多信息,請參閱部署指南。

6.1 Prerequisites

在存儲節點上安裝和配置對象存儲服務(Object Storage Service)之前,您必須先準備好存儲設備。

注:每個存儲節點都需要執行這些步驟。

6.1.1 object1先決條件

1.?Install the supporting utility packages:

root@object1:~#  apt-get install xfsprogs rsync
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:python3-braceexpand xfsdump acl attr quota
The following NEW packages will be installed:rsync
The following packages will be upgraded:xfsprogs
1 upgraded, 1 newly installed, 0 to remove and 61 not upgraded.
Need to get 1308 kB of archives.
After this operation, 814 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 rsync amd64 3.2.7-0ubuntu0.22.04.4 [437 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 xfsprogs amd64 5.13.0-1ubuntu2.1 [870 kB]
Fetched 1308 kB in 4s (370 kB/s)  
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package rsync.
(Reading database ... 101894 files and directories currently installed.)
Preparing to unpack .../rsync_3.2.7-0ubuntu0.22.04.4_amd64.deb ...
Unpacking rsync (3.2.7-0ubuntu0.22.04.4) ...
Preparing to unpack .../xfsprogs_5.13.0-1ubuntu2.1_amd64.deb ...
Unpacking xfsprogs (5.13.0-1ubuntu2.1) over (5.13.0-1ubuntu2) ...
Setting up xfsprogs (5.13.0-1ubuntu2.1) ...
update-initramfs: deferring update (trigger activated)
Setting up rsync (3.2.7-0ubuntu0.22.04.4) ...
rsync.service is a disabled or a static unit, not starting it.
Processing triggers for libc-bin (2.35-0ubuntu3.9) ...
Processing triggers for initramfs-tools (0.140ubuntu13.4) ...
update-initramfs: Generating /boot/initrd.img-5.15.0-136-generic
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline
Scanning processes...                                                                                                                                                                                                                                           
Scanning linux images...                                                                                                                                                                                                                                        Running kernel seems to be up-to-date.No services need to be restarted.No containers need to be restarted.No user sessions are running outdated binaries.No VM guests are running outdated hypervisor (qemu) binaries on this host.
root@object1:~# 
  • xfsprogs:是一個包含 XFS 文件系統工具的軟件包。XFS 是一種高性能的文件系統,常用于需要大容量存儲和高吞吐量的場景。xfsprogs 提供了用于創建、管理和維護 XFS 文件系統的工具,例如 mkfs.xfs(用于格式化 XFS 文件系統)和 xfs_db(用于調試 XFS 文件系統)。

  • rsync:是一個用于同步文件和目錄的工具,支持本地和遠程同步。它通過比較文件的大小和修改時間來高效地同步數據,僅傳輸發生變化的部分,從而節省時間和帶寬。rsync 常用于備份、鏡像和數據遷移等場景。

在對象存儲服務(如 OpenStack Swift)的部署中,xfsprogs 用于格式化存儲設備為 XFS 文件系統,而 rsync 可能用于數據同步或其他相關操作。

2. Format the?/dev/sdb?and?/dev/sdc?devices as XFS:?

root@object1:~# mkfs.xfs /dev/sdb
meta-data=/dev/sdb               isize=512    agcount=4, agsize=1310720 blks=                       sectsz=512   attr=2, projid32bit=1=                       crc=1        finobt=1, sparse=1, rmapbt=0=                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=5242880, imaxpct=25=                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2=                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
root@object1:~# mkfs.xfs /dev/sdc
meta-data=/dev/sdc               isize=512    agcount=4, agsize=1310720 blks=                       sectsz=512   attr=2, projid32bit=1=                       crc=1        finobt=1, sparse=1, rmapbt=0=                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=5242880, imaxpct=25=                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2=                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
root@object1:~# 

3.?Create the mount point directory structure:

root@object1:~# mkdir -p /srv/node/sdb
root@object1:~# mkdir -p /srv/node/sdc
root@object1:~# 
  • -p:是 mkdir 的一個選項,表示遞歸創建目錄。如果目標路徑中的某些中間目錄不存在,-p 選項會自動創建這些中間目錄,確保最終路徑能夠成功創建。

在 OpenStack Swift 的部署中,/srv/node/sdb 目錄可能被用作存儲對象數據的掛載點,或者用于存放與該存儲設備相關的索引和元數據。

4. Find the UUID of the new partitions:

root@object1:~# blkid
/dev/sr0: BLOCK_SIZE="2048" UUID="2024-02-16-23-52-30-00" LABEL="Ubuntu-Server 22.04.4 LTS amd64" TYPE="iso9660" PTTYPE="PMBR"
/dev/mapper/ubuntu--vg-ubuntu--lv: UUID="25617d2f-0882-4c87-8946-da5a2ea9aa40" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda2: UUID="b1700072-ccb5-44aa-92b0-2ef041c3b62e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="d4e50be8-05b8-4321-9573-40e6b76c00e8"
/dev/sda3: UUID="2PHsFv-fjte-CEay-sfKx-HkST-9U0s-hHOitW" TYPE="LVM2_member" PARTUUID="ae32aeb7-bed1-4d81-b7ae-4ce0d23ee252"
/dev/sdb: UUID="d760b7ed-e476-4afa-9ff8-eff2e85095bd" BLOCK_SIZE="512" TYPE="xfs"
/dev/sdc: UUID="8f76817c-6812-424a-ae0b-02b88719e484" BLOCK_SIZE="512" TYPE="xfs"
/dev/sda1: PARTUUID="8e25ab6a-e3f5-4885-aa99-e2df0c2363f7"
root@object1:~# 

?5.?Edit the?/etc/fstab?file and add the following to it:

root@object1:~# vi /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/ubuntu-vg/ubuntu-lv during curtin installation
/dev/disk/by-id/dm-uuid-LVM-gpAAX0VN55VQhctf2KC2IWzccIxI6LrTtoIY7oEheHYOVX7LaS7krjxWkAe71soK / ext4 defaults 0 1
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/b1700072-ccb5-44aa-92b0-2ef041c3b62e /boot ext4 defaults 0 1
UUID="d760b7ed-e476-4afa-9ff8-eff2e85095bd" /srv/node/sdb xfs noatime 0 2
UUID="8f76817c-6812-424a-ae0b-02b88719e484" /srv/node/sdc xfs noatime 0 2

這段內容是 /etc/fstab 文件的內容,它定義了系統啟動時自動掛載的文件系統以及掛載的選項。以下是逐行解釋:

# <file system> <mount point> <type> <options> <dump> <pass>

  • 這是一條注釋,說明了 /etc/fstab 文件中每一列的含義:

    • <file system>:文件系統的設備或標識符(如 UUID 或設備路徑)。

    • <mount point>:掛載點路徑。

    • <type>:文件系統類型(如 ext4、xfs 等)。

    • <options>:掛載選項。

    • <dump>:用于備份工具的備份選項(通常設置為 0)。

    • <pass>:在啟動時進行文件系統檢查的順序(通常設置為 1 或 2,根文件系統為 1,其他文件系統為 2)。

UUID="d760b7ed-e476-4afa-9ff8-eff2e85095bd" /srv/node/sdb xfs noatime 0 2

  • 這一行定義了 /srv/node/sdb 的掛載信息:

    • 設備標識符:UUID="d760b7ed-e476-4afa-9ff8-eff2e85095bd"(通過 UUID 指定設備)。

    • 掛載點:/srv/node/sdb

    • 文件系統類型:xfs

    • 掛載選項:noatime(不更新文件的訪問時間戳,可以提高性能)。

    • <dump>0

    • <pass>2(表示在啟動時會進行文件系統檢查,但優先級低于根文件系統)。?

6.?Mount the devices:

root@object1:~# mount /srv/node/sdb
root@object1:~# mount /srv/node/sdc

?7.?Create or edit the?/etc/rsyncd.conf?file to contain the following:

root@object1:~# vi /etc/rsyncd.confuid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 10.0.20.14[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

注:rsync 服務不需要進行身份驗證,因此在生產環境中,建議將其運行在私有網絡上。

8.?Edit the?/etc/default/rsync?file and enable the?rsync?service:

root@object1:~# ls /etc/default/rsync 
/etc/default/rsync
root@object1:~# vi /etc/default/rsync 
...
RSYNC_ENABLE=true
...

9.?Start the?rsync?service:

root@object1:~# service rsync start
root@object1:~#

6.1.2 object2先決條件

1、
root@object2:~# apt-get install xfsprogs rsync2、
root@object2:~# mkfs.xfs /dev/sdb
meta-data=/dev/sdb               isize=512    agcount=4, agsize=1310720 blks=                       sectsz=512   attr=2, projid32bit=1=                       crc=1        finobt=1, sparse=1, rmapbt=0=                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=5242880, imaxpct=25=                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2=                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
root@object2:~# mkfs.xfs /dev/sdc
meta-data=/dev/sdc               isize=512    agcount=4, agsize=1310720 blks=                       sectsz=512   attr=2, projid32bit=1=                       crc=1        finobt=1, sparse=1, rmapbt=0=                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=5242880, imaxpct=25=                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2=                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
root@object2:~# 3、
root@object2:~# mkdir -p /srv/node/sdb
root@object2:~# mkdir -p /srv/node/sdc
root@object2:~# 4、
root@object2:~# blkid
/dev/sr0: BLOCK_SIZE="2048" UUID="2024-02-16-23-52-30-00" LABEL="Ubuntu-Server 22.04.4 LTS amd64" TYPE="iso9660" PTTYPE="PMBR"
/dev/mapper/ubuntu--vg-ubuntu--lv: UUID="25617d2f-0882-4c87-8946-da5a2ea9aa40" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda2: UUID="b1700072-ccb5-44aa-92b0-2ef041c3b62e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="d4e50be8-05b8-4321-9573-40e6b76c00e8"
/dev/sda3: UUID="2PHsFv-fjte-CEay-sfKx-HkST-9U0s-hHOitW" TYPE="LVM2_member" PARTUUID="ae32aeb7-bed1-4d81-b7ae-4ce0d23ee252"
/dev/sdb: UUID="70e984de-a7eb-4c77-a6d7-0d71fe6e87c4" BLOCK_SIZE="512" TYPE="xfs"
/dev/sdc: UUID="a68ad547-cfcf-49ab-b722-7ee12ce9c044" BLOCK_SIZE="512" TYPE="xfs"
/dev/sda1: PARTUUID="8e25ab6a-e3f5-4885-aa99-e2df0c2363f7"
root@object2:~# 5、
root@object2:~# vi /etc/fstab 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/ubuntu-vg/ubuntu-lv during curtin installation
/dev/disk/by-id/dm-uuid-LVM-gpAAX0VN55VQhctf2KC2IWzccIxI6LrTtoIY7oEheHYOVX7LaS7krjxWkAe71soK / ext4 defaults 0 1
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/b1700072-ccb5-44aa-92b0-2ef041c3b62e /boot ext4 defaults 0 1
UUID="70e984de-a7eb-4c77-a6d7-0d71fe6e87c4" /srv/node/sdb xfs noatime 0 2
UUID="a68ad547-cfcf-49ab-b722-7ee12ce9c044" /srv/node/sdc xfs noatime 0 26、
root@object2:~# mount /srv/node/sdb
root@object2:~# mount /srv/node/sdc
root@object2:~# 7、
root@object2:~# vi /etc/rsyncd.confuid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 10.0.20.15[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.lock8、
root@object2:~# vi /etc/default/rsync 
...
RSYNC_ENABLE=true
...  9、
root@object2:~# service rsync start
root@object2:~#                                                                       

6.2?Install and configure components

注:每個存儲節點都需要執行這些步驟。

6.2.1 object1安裝配置

1.?Install the packages:(安裝過程有出錯信息,未解決

root@object1:~# apt-get install swift swift-account swift-container swift-object

執行過程有報錯信息,暫時無解決辦法。

root@object1:~# apt-get install swift swift-account swift-container swift-object
...
Setting up swift-account (2.29.2-0ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/swift-account-auditor.service → /lib/systemd/system/swift-account-auditor.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-account-reaper.service → /lib/systemd/system/swift-account-reaper.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-account-replicator.service → /lib/systemd/system/swift-account-replicator.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-account.service → /lib/systemd/system/swift-account.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Setting up swift-container (2.29.2-0ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/swift-container-auditor.service → /lib/systemd/system/swift-container-auditor.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-container-reconciler.service → /lib/systemd/system/swift-container-reconciler.service.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-container-replicator.service → /lib/systemd/system/swift-container-replicator.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-container-sharder.service → /lib/systemd/system/swift-container-sharder.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-container-sync.service → /lib/systemd/system/swift-container-sync.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-container-updater.service → /lib/systemd/system/swift-container-updater.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-container.service → /lib/systemd/system/swift-container.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Setting up swift (2.29.2-0ubuntu1) ...
Setting up swift-object (2.29.2-0ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/swift-object-auditor.service → /lib/systemd/system/swift-object-auditor.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-object-reconstructor.service → /lib/systemd/system/swift-object-reconstructor.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-object-replicator.service → /lib/systemd/system/swift-object-replicator.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-object-updater.service → /lib/systemd/system/swift-object-updater.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/swift-object.service → /lib/systemd/system/swift-object.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline
Scanning processes...                                                                                                                                                                                                                                           
Scanning linux images...   
...                          

2、Obtain the accounting, container, and object service configuration files from the Object Storage source repository:

root@object1:/etc/swift# curl -o /etc/swift/container-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/container-server.conf-sample% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100 23165  100 23165    0     0  18922      0  0:00:01  0:00:01 --:--:-- 18925
root@object1:/etc/swift# root@object1:/etc/swift# curl -o /etc/swift/object-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/object-server.conf-sample% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100 34028  100 34028    0     0  32302      0  0:00:01  0:00:01 --:--:-- 32315root@object1:/etc/swift# curl -o /etc/swift/object-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/object-server.conf-sample% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100 34028  100 34028    0     0  37240      0 --:--:-- --:--:-- --:--:-- 37229
root@object1:/etc/swift# root@object1:/etc/swift# ls
account-server.conf  account-server.conf.bak  container-server.conf  container-server.conf.bak  object-expirer.conf  object-server.conf  object-server.conf.bak
root@object1:/etc/swift# 

3. Edit the?/etc/swift/account-server.conf?file and complete the following actions:

root@object1:~# vi /etc/swift/account-server.conf[DEFAULT]
bind_ip = 10.0.20.14
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
bind_port = 6202
...
[pipeline:main]
# pipeline = healthcheck recon backend_ratelimit account-server
pipeline = healthcheck recon account-server
...
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
...

4.?Edit the?/etc/swift/container-server.conf?file and complete the following actions:

root@object1:~# vi /etc/swift/container-server.conf[DEFAULT]
bind_ip = 10.0.20.14
bind_port = 6201
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
...
[pipeline:main]
# pipeline = healthcheck recon backend_ratelimit container-server
pipeline = healthcheck recon container-server
...
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift

5.?Edit the?/etc/swift/object-server.conf?file and complete the following actions:

root@object1:~# vi /etc/swift/object-server.conf[DEFAULT]
bind_ip = 10.0.20.14
bind_port = 6200
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
...
[pipeline:main]
# pipeline = healthcheck recon backend_ratelimit object-server
pipeline = healthcheck recon object-server
...
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock

6. Ensure proper ownership of the mount point directory structure:

root@object1:~# chown -R swift:swift /srv/node
root@object1:~# ls -l /srv/node
total 0
drwxr-xr-x 2 swift swift 6 Apr 19 02:23 sdb
drwxr-xr-x 2 swift swift 6 Apr 19 02:23 sdc
root@object1:~# 

7. Create the?recon?directory and ensure proper ownership of it:

root@object1:~# mkdir -p /var/cache/swift
root@object1:~# chown -R root:swift /var/cache/swift
root@object1:~# chmod -R 775 /var/cache/swift
root@object1:~# ls -l /var/cache/swift
total 0
root@object1:~# ls -l /var/cache
total 36
drwxr-xr-x 3 root      root   4096 Feb 16  2024 PackageKit
drwxr-xr-x 3 root      root   4096 Aug 11  2024 apparmor
drwxr-xr-x 3 root      root   4096 Apr 19 03:22 apt
drwxr-xr-x 2 root      root   4096 Apr 19 03:22 debconf
drwx------ 2 root      root   4096 Apr 19 03:21 ldconfig
drwxr-x--- 2 pollinate daemon 4096 Aug 11  2024 pollinate
drwx------ 2 root      root   4096 Feb 16  2024 private
drwxr-xr-x 2 root      root   4096 Apr 18 22:50 snapd
drwxrwxr-x 2 root      swift  4096 Feb  8  2023 swift
root@object1:~# 

6.2.2 object2安裝配置

1、
root@object2:~# apt-get install swift swift-account swift-container swift-object
(有相同報錯信息)2、
root@object2:~# curl -o /etc/swift/account-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/account-server.conf-sample% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100 13445  100 13445    0     0  15897      0 --:--:-- --:--:-- --:--:-- 15892
root@object2:~# curl -o /etc/swift/container-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/container-server.conf-sample% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100 23165  100 23165    0     0  18894      0  0:00:01  0:00:01 --:--:-- 18910
root@object2:~# curl -o /etc/swift/object-server.conf https://opendev.org/openstack/swift/raw/branch/master/etc/object-server.conf-sample% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100 34028  100 34028    0     0  32231      0  0:00:01  0:00:01 --:--:-- 32254
root@object2:~# 3、
root@object2:~# vi /etc/swift/account-server.conf[DEFAULT]
bind_ip = 10.0.20.15
bind_port = 6202
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
...
[pipeline:main]
# pipeline = healthcheck recon backend_ratelimit account-server
pipeline = healthcheck recon account-server
...
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift4、
root@object2:~# vi /etc/swift/container-server.conf[DEFAULT]
bind_ip = 10.0.20.15
bind_port = 6201
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
...
[pipeline:main]
# pipeline = healthcheck recon backend_ratelimit container-server
pipeline = healthcheck recon container-server
...
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift5、
root@object2:~# vi /etc/swift/object-server.conf
[DEFAULT]
bind_ip = 10.0.20.15
bind_port = 6200
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
...
[pipeline:main]
# pipeline = healthcheck recon backend_ratelimit object-server
pipeline = healthcheck recon object-server
...
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock6、
root@object2:~# chown -R swift:swift /srv/node
root@object2:~# ls -l /srv/node
total 0
drwxr-xr-x 2 swift swift 6 Apr 19 03:46 sdb
drwxr-xr-x 2 swift swift 6 Apr 19 03:46 sdc
root@object2:~#7、
root@object2:~# mkdir -p /var/cache/swift
root@object2:~# chown -R root:swift /var/cache/swift
root@object2:~# chmod -R 775 /var/cache/swift
root@object2:~# ls -l /var/cache
total 36
drwxr-xr-x 3 root      root   4096 Feb 16  2024 PackageKit
drwxr-xr-x 3 root      root   4096 Aug 11  2024 apparmor
drwxr-xr-x 3 root      root   4096 Apr 19 06:06 apt
drwxr-xr-x 2 root      root   4096 Apr 19 06:06 debconf
drwx------ 2 root      root   4096 Apr 19 06:06 ldconfig
drwxr-x--- 2 pollinate daemon 4096 Aug 11  2024 pollinate
drwx------ 2 root      root   4096 Feb 16  2024 private
drwxr-xr-x 2 root      root   4096 Apr 18 22:50 snapd
drwxrwxr-x 2 root      swift  4096 Feb  8  2023 swift
root@object2:~# 

七、Create and distribute initial rings

在啟動Object Storage Services之前,您必須創建初始的賬戶、容器和對象環(initial account, container, and object ring)。環構建器(ring builder)會創建每個節點用于確定和部署存儲架構的配置文件。

為了簡單起見,本指南使用一個區域和兩個存儲區,最大分區數為 2^10(1024),每個對象有 3 個副本,分區移動的最小間隔時間為 1 小時。(1個region,2個zone,2^10 maximum partitions,3 replicas of each object)

對于對象存儲,分區(partition)表示存儲設備上的一個目錄,而不是傳統意義上的分區表。有關更多信息,請參閱部署指南。

注:在控制節點執行這些步驟

7.1 Create account ring

The account server uses the account ring to maintain lists of containers.

1.?Change to the /etc/swift directory.

2.?Create the base?account.builder?file:

root@controller:~# cd /etc/swift
root@controller:/etc/swift# swift-ring-builder account.builder create 10 3 1
root@controller:/etc/swift# 

3.?Add each storage node to the ring:

root@controller:/etc/swift# swift-ring-builder account.builder add \
>   --region 1 --zone 1 --ip 10.0.20.14 --port 6202 --device sdb --weight 100
Device d0r1z1-10.0.20.14:6202R10.0.20.14:6202/sdb_"" with 100.0 weight got id 0
root@controller:/etc/swift# swift-ring-builder account.builder add \
>   --region 1 --zone 1 --ip 10.0.20.14 --port 6202 --device sdc --weight 100
Device d1r1z1-10.0.20.14:6202R10.0.20.14:6202/sdc_"" with 100.0 weight got id 1
root@controller:/etc/swift# swift-ring-builder account.builder add \
>   --region 1 --zone 2 --ip 10.0.20.15 --port 6202 --device sdb --weight 100
Device d2r1z2-10.0.20.15:6202R10.0.20.15:6202/sdb_"" with 100.0 weight got id 2
root@controller:/etc/swift# swift-ring-builder account.builder add \
>   --region 1 --zone 2 --ip 10.0.20.15 --port 6202 --device sdc --weight 100
Device d3r1z2-10.0.20.15:6202R10.0.20.15:6202/sdc_"" with 100.0 weight got id 3
root@controller:/etc/swift# 

?4.?Verify the ring contents:

root@controller:/etc/swift# swift-ring-builder account.builder
account.builder, build version 4, id 87a8bdffe7e24adea2fa9f3896ee1524
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 (0:00:00 remaining)
The overload factor is 0.00% (0.000000)
Ring file account.ring.gz not found, probably it hasn't been written yet
Devices:   id region zone ip address:port replication ip:port  name weight partitions balance flags meta0      1    1 10.0.20.14:6202     10.0.20.14:6202   sdb 100.00          0 -100.00       1      1    1 10.0.20.14:6202     10.0.20.14:6202   sdc 100.00          0 -100.00       2      1    2 10.0.20.15:6202     10.0.20.15:6202   sdb 100.00          0 -100.00       3      1    2 10.0.20.15:6202     10.0.20.15:6202   sdc 100.00          0 -100.00       
root@controller:/etc/swift# 

Ring file account.ring.gz not found, probably it hasn't been written yet

  • 提示沒有找到 account.ring.gz 文件,這通常是因為環文件尚未生成。在構建環的過程中,swift-ring-builder 會生成 .ring.gz 文件,用于存儲環的最終配置。

這段輸出顯示了賬戶環的構建狀態。目前,所有設備的分區數量為 0,平衡度為 -100.00,表示分區尚未分配到設備上。下一步通常需要運行 swift-ring-builderrebalance 命令來重新分配分區,確保它們均勻分布到各個設備上。

    5.?Rebalance the ring:

    root@controller:/etc/swift#  swift-ring-builder account.builder rebalance
    Reassigned 3072 (300.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00
    root@controller:/etc/swift# 

    ?在 Swift 的環配置中,分區數量是預先定義的,通常設置為 2^10(1024)、2^18 或其他 2 的冪次方值。在你的例子中,初始分區數量是 1024。但是,當你運行 swift-ring-builder account.builder rebalance 命令時,輸出顯示重新分配了 3072 個分區。這是因為在 Swift 中,分區數量實際上是初始分區數量乘以副本數量。

    7.2 Create container ring

    The container server uses the container ring to maintain lists of objects. However, it does not track object locations.

    1. Change to the?/etc/swift?directory.

    2.?Create the base?container.builder?file:

    root@controller:/etc/swift# swift-ring-builder container.builder create 10 3 1
    root@controller:/etc/swift# 

    3.?Add each storage node to the ring:

    root@controller:/etc/swift# swift-ring-builder container.builder add \
    >   --region 1 --zone 1 --ip 10.0.20.14 --port 6201 --device sdb --weight 100
    Device d0r1z1-10.0.20.14:6201R10.0.20.14:6201/sdb_"" with 100.0 weight got id 0
    root@controller:/etc/swift# swift-ring-builder container.builder add \
    >   --region 1 --zone 1 --ip 10.0.20.14 --port 6201 --device sdc --weight 100
    Device d1r1z1-10.0.20.14:6201R10.0.20.14:6201/sdc_"" with 100.0 weight got id 1
    root@controller:/etc/swift# swift-ring-builder container.builder add \
    >   --region 1 --zone 2 --ip 10.0.20.15 --port 6201 --device sdb --weight 100
    Device d2r1z2-10.0.20.15:6201R10.0.20.15:6201/sdb_"" with 100.0 weight got id 2
    root@controller:/etc/swift# swift-ring-builder container.builder add \
    >   --region 1 --zone 2 --ip 10.0.20.15 --port 6201 --device sdc --weight 100
    Device d3r1z2-10.0.20.15:6201R10.0.20.15:6201/sdc_"" with 100.0 weight got id 3
    root@controller:/etc/swift# 

    4. Verify the ring contents:

    root@controller:/etc/swift# swift-ring-builder container.builder
    container.builder, build version 4, id b46c41f56ebe4e0fa95b17cccc34cbe5
    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 (0:00:00 remaining)
    The overload factor is 0.00% (0.000000)
    Ring file container.ring.gz not found, probably it hasn't been written yet
    Devices:   id region zone ip address:port replication ip:port  name weight partitions balance flags meta0      1    1 10.0.20.14:6201     10.0.20.14:6201   sdb 100.00          0 -100.00       1      1    1 10.0.20.14:6201     10.0.20.14:6201   sdc 100.00          0 -100.00       2      1    2 10.0.20.15:6201     10.0.20.15:6201   sdb 100.00          0 -100.00       3      1    2 10.0.20.15:6201     10.0.20.15:6201   sdc 100.00          0 -100.00       
    root@controller:/etc/swift# 

    5.?Rebalance the ring:

    root@controller:/etc/swift# swift-ring-builder container.builder rebalance
    Reassigned 3072 (300.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00
    root@controller:/etc/swift#

    7.3 Create object ring

    The object server uses the object ring to maintain lists of object locations on local devices.

    1.?Change to the?/etc/swift?directory.

    2.?Create the base?object.builder?file:

    root@controller:/etc/swift# swift-ring-builder object.builder create 10 3 1
    root@controller:/etc/swift# 

    3.?Add each storage node to the ring:

    root@controller:/etc/swift# swift-ring-builder object.builder add \
    >   --region 1 --zone 1 --ip 10.0.20.14 --port 6200 --device sdb --weight 100
    Device d0r1z1-10.0.20.14:6200R10.0.20.14:6200/sdb_"" with 100.0 weight got id 0
    root@controller:/etc/swift# swift-ring-builder object.builder add \
    >   --region 1 --zone 1 --ip 10.0.20.14 --port 6200 --device sdc --weight 100
    Device d1r1z1-10.0.20.14:6200R10.0.20.14:6200/sdc_"" with 100.0 weight got id 1
    root@controller:/etc/swift# swift-ring-builder object.builder add \
    >   --region 1 --zone 2 --ip 10.0.20.15 --port 6200 --device sdb --weight 100
    Device d2r1z2-10.0.20.15:6200R10.0.20.15:6200/sdb_"" with 100.0 weight got id 2
    root@controller:/etc/swift# swift-ring-builder object.builder add \
    >   --region 1 --zone 2 --ip 10.0.20.15 --port 6200 --device sdc --weight 100
    Device d3r1z2-10.0.20.15:6200R10.0.20.15:6200/sdc_"" with 100.0 weight got id 3
    root@controller:/etc/swift# 

    4.?Verify the ring contents:

    root@controller:/etc/swift# swift-ring-builder object.builder
    object.builder, build version 4, id 04968feeaabf4c0aa6edd713cf7187fb
    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 (0:00:00 remaining)
    The overload factor is 0.00% (0.000000)
    Ring file object.ring.gz not found, probably it hasn't been written yet
    Devices:   id region zone ip address:port replication ip:port  name weight partitions balance flags meta0      1    1 10.0.20.14:6200     10.0.20.14:6200   sdb 100.00          0 -100.00       1      1    1 10.0.20.14:6200     10.0.20.14:6200   sdc 100.00          0 -100.00       2      1    2 10.0.20.15:6200     10.0.20.15:6200   sdb 100.00          0 -100.00       3      1    2 10.0.20.15:6200     10.0.20.15:6200   sdc 100.00          0 -100.00       
    root@controller:/etc/swift#

    5.?Rebalance the ring:

    root@controller:/etc/swift# swift-ring-builder object.builder rebalance
    Reassigned 3072 (300.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00
    root@controller:/etc/swift#

    7.4 Distribute ring configuration files

    ?重新平衡后,Swift 會生成一個新的環文件(如 account.ring.gz)。可以通過以下命令查看環文件是否存在:

    root@controller:/etc/swift# pwd
    /etc/swift
    root@controller:/etc/swift# ls -l *.gz
    -rw-r--r-- 1 root root 1493 Apr 19 06:31 account.ring.gz
    -rw-r--r-- 1 root root 1479 Apr 19 06:48 container.ring.gz
    -rw-r--r-- 1 root root 1461 Apr 19 06:55 object.ring.gz
    root@controller:/etc/swift# 

    Copy the?account.ring.gz,?container.ring.gz, and?object.ring.gz?files to the?/etc/swift?directory on each storage node and any additional nodes running the proxy service.

    root@controller:/etc/swift# rsync -a /etc/swift/account.ring.gz 10.0.20.14:/etc/swift
    The authenticity of host '10.0.20.14 (10.0.20.14)' can't be established.
    ED25519 key fingerprint is SHA256:qu0pX938LLAbrtNZIX+5jNS0Q8+svp1N8IdkRBLCu9Y.
    This key is not known by any other names
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yew^Hs
    Please type 'yes', 'no' or the fingerprint: yes
    Warning: Permanently added '10.0.20.14' (ED25519) to the list of known hosts.
    root@10.0.20.14's password: 
    root@controller:/etc/swift# rsync -a /etc/swift/account.ring.gz 10.0.20.15:/etc/swift
    The authenticity of host '10.0.20.15 (10.0.20.15)' can't be established.
    ED25519 key fingerprint is SHA256:qu0pX938LLAbrtNZIX+5jNS0Q8+svp1N8IdkRBLCu9Y.
    This host key is known by the following other names/addresses:~/.ssh/known_hosts:1: [hashed name]
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added '10.0.20.15' (ED25519) to the list of known hosts.
    root@10.0.20.15's password: 
    root@controller:/etc/swift# rsync -a /etc/swift/container.ring.gz 10.0.20.14:/etc/swift       
    root@10.0.20.14's password: 
    root@controller:/etc/swift# rsync -a /etc/swift/container.ring.gz 10.0.20.15:/etc/swift
    root@10.0.20.15's password: 
    root@controller:/etc/swift# rsync -a /etc/swift/object.ring.gz 10.0.20.14:/etc/swift          
    root@10.0.20.14's password: 
    root@controller:/etc/swift# rsync -a /etc/swift/object.ring.gz 10.0.20.15:/etc/swift   
    root@10.0.20.15's password: 
    

    controller:

    root@controller:/etc/swift# ls -l *.gz
    -rw-r--r-- 1 root root 1493 Apr 19 06:31 account.ring.gz
    -rw-r--r-- 1 root root 1479 Apr 19 06:48 container.ring.gz
    -rw-r--r-- 1 root root 1461 Apr 19 06:55 object.ring.gz
    root@controller:/etc/swift#

    object1:

    root@object1:/etc/swift# ls -l *.gz
    -rw-r--r-- 1 root root 1493 Apr 19 06:31 account.ring.gz
    -rw-r--r-- 1 root root 1479 Apr 19 06:48 container.ring.gz
    -rw-r--r-- 1 root root 1461 Apr 19 06:55 object.ring.gz
    root@object1:/etc/swift# 
    

    object2:

    root@object2:~# cd /etc/swift
    root@object2:/etc/swift# ls -l *.gz
    -rw-r--r-- 1 root root 1493 Apr 19 06:31 account.ring.gz
    -rw-r--r-- 1 root root 1479 Apr 19 06:48 container.ring.gz
    -rw-r--r-- 1 root root 1461 Apr 19 06:55 object.ring.gz
    root@object2:/etc/swift# 

    八、Finalize installation(選擇Ubuntu)

    1. Obtain the?/etc/swift/swift.conf?file from the Object Storage source repository:

    root@controller:/etc/swift# curl -o /etc/swift/swift.conf \
    >   https://opendev.org/openstack/swift/raw/branch/master/etc/swift.conf-sample% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
    100  8755  100  8755    0     0   6121      0  0:00:01  0:00:01 --:--:--  6118
    root@controller:/etc/swift# 

    2.?Edit the?/etc/swift/swift.conf?file and complete the following actions:

    root@controller:/etc/swift# vi swift.conf[swift-hash]swift_hash_path_suffix = openstack
    swift_hash_path_prefix = openstack[storage-policy:0]
    name = Policy-0
    default = yes

    3. Copy the?swift.conf?file to the?/etc/swift?directory on each storage node and any additional nodes running the proxy service.

    root@controller:/etc/swift# rsync -a /etc/swift/swift.conf 10.0.20.14:/etc/swift
    root@10.0.20.14's password: 
    root@controller:/etc/swift# rsync -a /etc/swift/swift.conf 10.0.20.15:/etc/swift
    root@10.0.20.15's password: 
    root@controller:/etc/swift# object1:
    root@object1:/etc/swift# ls swift.conf
    swift.confobject2:
    root@object2:/etc/swift# ls swift.conf
    swift.conf
    root@object2:/etc/swift# 

    4.?On all nodes, ensure proper ownership of the configuration directory:

    controller:

    root@controller:/etc/swift# chown -R root:swift /etc/swift
    root@controller:/etc/swift# ls -l /etc/swift
    total 144
    -rw-r----- 1 root swift   205 Feb  8  2023 account-server.conf
    -rw-r--r-- 1 root swift  9858 Apr 19 06:31 account.builder
    -rw-r--r-- 1 root swift  1493 Apr 19 06:31 account.ring.gz
    drwxr-xr-x 2 root swift  4096 Apr 19 06:55 backups
    -rw-r----- 1 root swift   236 Feb  8  2023 container-server.conf
    -rw-r--r-- 1 root swift  9858 Apr 19 06:48 container.builder
    -rw-r--r-- 1 root swift  1479 Apr 19 06:48 container.ring.gz
    -rw-r----- 1 root swift   284 Feb  8  2023 object-expirer.conf
    -rw-r----- 1 root swift   200 Feb  8  2023 object-server.conf
    -rw-r--r-- 1 root swift  9858 Apr 19 06:55 object.builder
    -rw-r--r-- 1 root swift  1461 Apr 19 06:55 object.ring.gz
    -rw-r--r-- 1 root swift 63357 Apr 19 02:00 proxy-server.conf
    -rw-r--r-- 1 root swift  8757 Apr 19 07:17 swift.conf
    root@controller:/etc/swift# 

    object1:

    root@object1:/etc/swift# chown -R root:swift /etc/swift
    root@object1:/etc/swift# ls -l /etc/swift
    total 116
    -rw-r----- 1 root swift 13586 Apr 19 05:19 account-server.conf
    -rw-r----- 1 root swift   205 Apr 19 04:18 account-server.conf.bak
    -rw-r--r-- 1 root swift  1493 Apr 19 06:31 account.ring.gz
    -rw-r----- 1 root swift 23328 Apr 19 05:24 container-server.conf
    -rw-r----- 1 root swift   236 Apr 19 04:18 container-server.conf.bak
    -rw-r--r-- 1 root swift  1479 Apr 19 06:48 container.ring.gz
    -rw-r----- 1 root swift   284 Feb  8  2023 object-expirer.conf
    -rw-r----- 1 root swift 34187 Apr 19 05:27 object-server.conf
    -rw-r----- 1 root swift   200 Apr 19 04:18 object-server.conf.bak
    -rw-r--r-- 1 root swift  1461 Apr 19 06:55 object.ring.gz
    -rw-r--r-- 1 root swift  8757 Apr 19 07:17 swift.conf
    root@object1:/etc/swift# 

    object2:

    root@object2:/etc/swift# chown -R root:swift /etc/swift
    root@object2:/etc/swift# ls -l /etc/swift
    total 104
    -rw-r----- 1 root swift 13605 Apr 19 06:28 account-server.conf
    -rw-r--r-- 1 root swift  1493 Apr 19 06:31 account.ring.gz
    -rw-r----- 1 root swift 23328 Apr 19 06:31 container-server.conf
    -rw-r--r-- 1 root swift  1479 Apr 19 06:48 container.ring.gz
    -rw-r----- 1 root swift   284 Feb  8  2023 object-expirer.conf
    -rw-r----- 1 root swift 34187 Apr 19 06:34 object-server.conf
    -rw-r--r-- 1 root swift  1461 Apr 19 06:55 object.ring.gz
    -rw-r--r-- 1 root swift  8757 Apr 19 07:17 swift.conf
    root@object2:/etc/swift# 

    5.?On the controller node and any other nodes running the proxy service, restart the Object Storage proxy service including its dependencies:

    root@controller:/etc/swift# service memcached restart
    root@controller:/etc/swift# service swift-proxy restart
    root@controller:/etc/swift# root@controller:/etc/swift# systemctl status memcached
    ● memcached.service - memcached daemonLoaded: loaded (/lib/systemd/system/memcached.service; enabled; vendor preset: enabled)Active: active (running) since Sat 2025-04-19 07:23:06 UTC; 29s agoDocs: man:memcached(1)Main PID: 27846 (memcached)Tasks: 10 (limit: 9350)Memory: 2.9MCPU: 46msCGroup: /system.slice/memcached.service└─27846 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 10.0.20.11 -P /var/run/memcached/memcached.pidApr 19 07:23:06 controller systemd[1]: Started memcached daemon.
    root@controller:/etc/swift# systemctl status swift-proxy
    ● swift-proxy.service - OpenStack Swift proxy serverLoaded: loaded (/lib/systemd/system/swift-proxy.service; enabled; vendor preset: enabled)Active: active (running) since Sat 2025-04-19 07:23:14 UTC; 32s agoDocs: man:swift-proxy-server(1)Main PID: 27870 (swift-proxy-ser)Tasks: 5 (limit: 9350)Memory: 99.6MCPU: 1.293sCGroup: /system.slice/swift-proxy.service├─27870 /usr/bin/python3 /usr/bin/swift-proxy-server /etc/swift/proxy-server.conf├─27875 /usr/bin/python3 /usr/bin/swift-proxy-server /etc/swift/proxy-server.conf├─27876 /usr/bin/python3 /usr/bin/swift-proxy-server /etc/swift/proxy-server.conf├─27877 /usr/bin/python3 /usr/bin/swift-proxy-server /etc/swift/proxy-server.conf└─27878 /usr/bin/python3 /usr/bin/swift-proxy-server /etc/swift/proxy-server.confApr 19 07:23:15 controller proxy-server[27878]: STDERR: The option "log_name" is not known to keystonemiddleware
    Apr 19 07:23:15 controller proxy-server[27878]: STDERR: The option "auth_url" is not known to keystonemiddleware
    Apr 19 07:23:15 controller proxy-server[27878]: STDERR: The option "project_domain_id" is not known to keystonemiddleware
    Apr 19 07:23:15 controller proxy-server[27878]: STDERR: The option "user_domain_id" is not known to keystonemiddleware
    Apr 19 07:23:15 controller proxy-server[27878]: STDERR: The option "project_name" is not known to keystonemiddleware
    Apr 19 07:23:15 controller proxy-server[27878]: STDERR: The option "username" is not known to keystonemiddleware
    Apr 19 07:23:15 controller proxy-server[27878]: STDERR: The option "password" is not known to keystonemiddleware
    Apr 19 07:23:15 controller proxy-server[27878]: STDERR: The option "__name__" is not known to keystonemiddleware
    Apr 19 07:23:15 controller proxy-server[27878]: AuthToken middleware is set with keystone_authtoken.service_token_roles_required set to False. This is backwards compatible but deprecated behaviour. Please set this to Tru
    e.
    Apr 19 07:23:15 controller proxy-server[27870]: Started child 27878 from parent 27870
    root@controller:/etc/swift# 

    6. On the storage nodes, start the Object Storage services:

    object1:

    root@object1:/etc/swift# swift-init all start
    Starting account-replicator...(/etc/swift/account-server.conf)
    Starting account-auditor...(/etc/swift/account-server.conf)
    Starting object-reconstructor...(/etc/swift/object-server.conf)
    Starting object-auditor...(/etc/swift/object-server.conf)
    Starting object-server...(/etc/swift/object-server.conf)
    Starting object-updater...(/etc/swift/object-server.conf)
    Starting container-sync...(/etc/swift/container-server.conf)
    Starting object-replicator...(/etc/swift/object-server.conf)
    Starting container-replicator...(/etc/swift/container-server.conf)
    Starting container-sharder...(/etc/swift/container-server.conf)
    Unable to locate config for container-reconciler
    Starting container-auditor...(/etc/swift/container-server.conf)
    Starting account-server...(/etc/swift/account-server.conf)
    Starting container-updater...(/etc/swift/container-server.conf)
    Starting account-reaper...(/etc/swift/account-server.conf)
    Starting container-server...(/etc/swift/container-server.conf)
    Unable to load internal client from config: '/etc/swift/internal-client.conf' ([Errno 2] No such file or directory: '/etc/swift/internal-client.conf')root@object1:/etc/swift# 查看服務狀態,如果有問題,reboot后查看:root@object1:~# systemctl list-units --type=service --all | grep swiftswift-account-auditor.service                                                             loaded    active   running OpenStack Swift account auditorswift-account-reaper.service                                                              loaded    active   running OpenStack Swift account reaperswift-account-replicator.service                                                          loaded    active   running OpenStack Swift account replicatorswift-account.service                                                                     loaded    active   running OpenStack Swift account serverswift-container-auditor.service                                                           loaded    active   running OpenStack Swift container auditorswift-container-reconciler.service                                                        loaded    inactive dead    OpenStack Swift container reconcilerswift-container-replicator.service                                                        loaded    active   running OpenStack Swift container replicator
    ● swift-container-sharder.service                                                           loaded    failed   failed  OpenStack Swift container sharderswift-container-sync.service                                                              loaded    active   running OpenStack Swift container syncswift-container-updater.service                                                           loaded    active   running OpenStack Swift container updaterswift-container.service                                                                   loaded    active   running OpenStack Swift container serverswift-object-auditor.service                                                              loaded    active   running OpenStack Swift object auditorswift-object-reconstructor.service                                                        loaded    active   running OpenStack Swift object reconstructorswift-object-replicator.service                                                           loaded    active   running OpenStack Swift object replicatorswift-object-updater.service                                                              loaded    active   running OpenStack Swift object updaterswift-object.service                                                                      loaded    active   running OpenStack Swift object server
    root@object1:~# 

    object2:

    root@object2:/etc/swift# swift-init all start
    Starting container-sharder...(/etc/swift/container-server.conf)
    Starting object-updater...(/etc/swift/object-server.conf)
    Starting object-reconstructor...(/etc/swift/object-server.conf)
    Unable to locate config for container-reconciler
    Starting account-server...(/etc/swift/account-server.conf)
    Starting container-sync...(/etc/swift/container-server.conf)
    Starting object-server...(/etc/swift/object-server.conf)
    Starting account-reaper...(/etc/swift/account-server.conf)
    Starting container-updater...(/etc/swift/container-server.conf)
    Starting object-replicator...(/etc/swift/object-server.conf)
    Starting object-auditor...(/etc/swift/object-server.conf)
    Starting account-replicator...(/etc/swift/account-server.conf)
    Starting container-auditor...(/etc/swift/container-server.conf)
    Starting container-server...(/etc/swift/container-server.conf)
    Starting container-replicator...(/etc/swift/container-server.conf)
    Starting account-auditor...(/etc/swift/account-server.conf)
    Unable to load internal client from config: '/etc/swift/internal-client.conf' ([Errno 2] No such file or directory: '/etc/swift/internal-client.conf')root@object2:/etc/swift# 查看服務狀態,如果有問題,reboot后查看:root@object2:~# systemctl list-units --type=service --all | grep swiftswift-account-auditor.service                                                             loaded    active   running OpenStack Swift account auditorswift-account-reaper.service                                                              loaded    active   running OpenStack Swift account reaperswift-account-replicator.service                                                          loaded    active   running OpenStack Swift account replicatorswift-account.service                                                                     loaded    active   running OpenStack Swift account serverswift-container-auditor.service                                                           loaded    active   running OpenStack Swift container auditorswift-container-reconciler.service                                                        loaded    inactive dead    OpenStack Swift container reconcilerswift-container-replicator.service                                                        loaded    active   running OpenStack Swift container replicator
    ● swift-container-sharder.service                                                           loaded    failed   failed  OpenStack Swift container sharderswift-container-sync.service                                                              loaded    active   running OpenStack Swift container syncswift-container-updater.service                                                           loaded    active   running OpenStack Swift container updaterswift-container.service                                                                   loaded    active   running OpenStack Swift container serverswift-object-auditor.service                                                              loaded    active   running OpenStack Swift object auditorswift-object-reconstructor.service                                                        loaded    active   running OpenStack Swift object reconstructorswift-object-replicator.service                                                           loaded    active   running OpenStack Swift object replicatorswift-object-updater.service                                                              loaded    active   running OpenStack Swift object updaterswift-object.service                                                                      loaded    active   running OpenStack Swift object server
    root@object2:~# 

    九、Verify operation

    Verify operation of the Object Storage service.

    1、Source the?demo?credentials:

    root@controller:~# source demo-openrc
    root@controller ~(myproject/myuser)# cat demo-openrc 
    export OS_PROJECT_DOMAIN_NAME=Default
    export OS_USER_DOMAIN_NAME=Default
    export OS_PROJECT_NAME=myproject
    export OS_USERNAME=myuser
    export OS_PASSWORD=openstack
    export OS_AUTH_URL=http://controller:5000/v3
    export OS_IDENTITY_API_VERSION=3
    export OS_IMAGE_API_VERSION=2
    export PS1='\u@\h \W(myproject/myuser)\$ '
    root@controller ~(myproject/myuser)# 

    2、Show the service status:

    root@controller ~(myproject/myuser)# swift statAccount: AUTH_f5e75a3f7cc347ad89d20dcfe70dae01Containers: 0Objects: 0Bytes: 0
    Containers in policy "policy-0": 0Objects in policy "policy-0": 0Bytes in policy "policy-0": 0Content-Type: text/plain; charset=utf-8X-Timestamp: 1745065868.91993Accept-Ranges: bytesX-Account-Project-Domain-Id: defaultVary: AcceptX-Trans-Id: tx2212ee64f1ec492691b12-006803998dX-Openstack-Request-Id: tx2212ee64f1ec492691b12-006803998d
    root@controller ~(myproject/myuser)# 
    

    3.?Create?container

    root@controller ~(myproject/myuser)# openstack container create container1
    +---------------------------------------+------------+------------------------------------+
    | account                               | container  | x-trans-id                         |
    +---------------------------------------+------------+------------------------------------+
    | AUTH_f5e75a3f7cc347ad89d20dcfe70dae01 | container1 | txda19ce939dbb47c191f1f-00680399b2 |
    +---------------------------------------+------------+------------------------------------+
    root@controller ~(myproject/myuser)# 

    4. Upload a test file to the?container1?container:

    root@controller ~(myproject/myuser)# openstack object create container1 testswift.txt
    +---------------+------------+----------------------------------+
    | object        | container  | etag                             |
    +---------------+------------+----------------------------------+
    | testswift.txt | container1 | 0e62820c77565ac3f1a5f2afbb9a384b |
    +---------------+------------+----------------------------------+
    root@controller ~(myproject/myuser)# 

    5.?List files in the?container1?container:

    root@controller ~(myproject/myuser)# openstack object list container1
    +---------------+
    | Name          |
    +---------------+
    | testswift.txt |
    +---------------+
    root@controller ~(myproject/myuser)# 

    ?6.?Download a test file from the?container1?container:

    root@controller ~(myproject/myuser)# openstack object save container1 testswift.txt

    7. Horizon下查看:

    本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
    如若轉載,請注明出處:http://www.pswp.cn/web/76454.shtml
    繁體地址,請注明出處:http://hk.pswp.cn/web/76454.shtml
    英文地址,請注明出處:http://en.pswp.cn/web/76454.shtml

    如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

    相關文章

    06-libVLC的視頻播放器:推流RTMP

    創建媒體對象 libvlc_media_t* m = libvlc_media_new_path(m_pInstance, inputPath.toStdString().c_str()); if (!m) return -1; // 創建失敗返回錯誤 libvlc_media_new_path:根據文件路徑創建媒體對象。注意:toStdString().c_str() 在Qt中可能存在臨時字符串析構問題,建議…

    少兒編程路線規劃

    少兒編程路線規劃—一文寫明白 現在有很多的編程機構&#xff0c;五花八門的。我有幸也見識到了大家的營銷策略。這些策略有黑有白吧&#xff0c;從業幾年&#xff0c;沉淀下來一些客戶角度的干貨&#xff0c;分享給大家。 如果是想以很遠很遠的就業為目的&#xff0c;畢業就…

    ios app的ipa文件提交最簡單的方法

    ipa文件是ios的app打包后生成的二級制文件&#xff0c;在上架app store connect或做testflight測試的時候&#xff0c;它提示我們需要使用xcode、transporter或xcode命令行等方式來上傳。 而xcode、transporter或xcode命令行的安裝都需要使用mac電腦&#xff0c;假如沒有mac電…

    怎么查看LLM Transformer 架構進行并行計算和設備映射

    怎么查看LLM Transformer 架構進行并行計算和設備映射 num_hidden_layers = model.config.num_hidden_layers print(num_hidden_layers) print(model) LLM(大語言模型)通常是基于 Transformer 架構 構建的,它由多個模塊化的層(Layer)堆疊組成,每個層都有其獨特的作用。…

    微信小程序獲得當前城市,獲得當前天氣

    // // 獲取用戶當前所在城市 // wx.getLocation({// type: wgs84, // 默認為 wgs84 返回 gps 坐標,gcj02 返回可用于 wx.openLocation 的坐標 // success: function(res) {// console.log(獲取位置成功, res); // // 使用騰訊地圖API進行逆地址解析 // wx…

    美國國土安全部終止資助,CVE漏洞數據庫項目面臨停擺危機

    &#xff08;圖片來源&#xff1a;Jerome460 / Shutterstock&#xff09; 25年漏洞追蹤體系即將終結 美國非營利研發組織MITRE宣布&#xff0c;其與美國國土安全部&#xff08;DHS&#xff09;簽訂的"通用漏洞披露&#xff08;CVE&#xff09;"數據庫維護合同將于2…

    Kafka下載和使用(Windows版)

    Apache Kafka 是一個高吞吐量的分布式消息系統&#xff0c;廣泛應用于日志收集、實時流處理等場景。本文將以 Windows 系統為例&#xff0c;詳細介紹 Kafka 的安裝和使用方法。 一、安裝方式 在 Windows 系統上運行 Apache Kafka&#xff0c;通常有兩種方式&#xff1a; 1.W…

    RBAC的使用

    1、簡述RBAC的作用及工作流程 Rbac基于角色訪問控制&#xff0c;用于管理用戶對集群資源的訪問權限&#xff0c;通過定義角色和綁定規則&#xff0c;將用戶與權限進行關聯&#xff0c;作用&#xff1a;權限精細化管理&#xff0c;操作便捷與統一管理&#xff0c;動態調整權限。…

    【2025年泰迪杯數據挖掘挑戰賽】A題 數據分析+問題建模與求解+Python代碼直接分享

    目錄 2025年泰迪杯數據挖掘挑戰賽A題完整論文&#xff1a;建模與求解Python代碼1問題一的思路與求解1.1 問題一的思路1.1.1對統計數據進行必要說明&#xff1a;1.1.2統計流程&#xff1a;1.1.3特殊情況的考慮&#xff1a; 1.2 問題一的求解1.2.1代碼實現1.2.2 問題一結果代碼分…

    Ethan獨立開發產品日報 | 2025-04-18

    1. Wiza Monitor 跟蹤工作變動&#xff0c;并獲取 Slack 和電子郵件通知。 Wiza Monitor是一款工作變動跟蹤工具&#xff0c;可以實時追蹤客戶和潛在客戶的職位變動&#xff0c;您還能通過電子郵件和Slack接收提醒&#xff0c;并自動更新您的客戶關系管理系統&#xff08;CRM…

    【工具變量】A股上市公司信息披露質量KV指數測算數據集(含do代碼 1991-2024年)

    KV指數&#xff08;Key Value Index&#xff09;作為評估信息披露質量的關鍵指標&#xff0c;在證券市場&#xff0c;尤其是A股市場上市公司信息披露監管與評估中占據重要地位。該指數通過系統化、定量化的方法&#xff0c;對企業發布的信息進行全面剖析與打分&#xff0c;精準…

    【java實現+4種變體完整例子】排序算法中【基數排序】的詳細解析,包含基礎實現、常見變體的完整代碼示例,以及各變體的對比表格

    基數排序詳解及代碼示例 基數排序原理 基數排序通過處理每一位數字進行排序&#xff0c;分為 LSD&#xff08;最低位優先&#xff09; 和 MSD&#xff08;最高位優先&#xff09; 兩種方式。核心步驟&#xff1a; 確定最大值&#xff1a;計算數組中最大數的位數。逐位排序&am…

    服務治理-服務發現和負載均衡

    第一步&#xff1a;引入依賴 第二步&#xff1a;配置地址 改寫購物車服務的代碼 負載均衡成功實現。 假如有一個服務掛了&#xff0c;比如說8081&#xff0c;cart-service能不能正常訪問&#xff0c;感知到。 再重新啟動8081端口。 不管服務宕機也好&#xff0c;還是服務剛啟動…

    專題十六:虛擬路由冗余協議——VRRP

    一、VRRP簡介 VRRP&#xff08;Virtual Router Redundancy Protocol&#xff09;虛擬路由冗余協議通過把幾臺設備聯合組成一臺虛擬的設備&#xff0c;使用一定的機制保證當主機的下一跳設備出現故障時&#xff0c;及時將業務切換到備份設備&#xff0c;從而保持通訊的連續性和…

    UE5 關卡序列

    文章目錄 介紹創建一個關卡序列編輯動畫添加一個物體編輯動畫時間軸顯示秒而不是幀時間軸跳轉到一個確定的時間時間軸的顯示范圍更改關鍵幀的動畫插值方式操作多個關鍵幀 播放動畫 介紹 類似于Unity的Animation動畫&#xff0c;可以用來錄制場景中物體的動畫 創建一個關卡序列…

    openbmb/MiniCPM-V-2_6 和 AIDC-AI/Ovis2-1B 的網絡結構體對比

    openbmb/MiniCPM-V-2_6和Ovis2作為多模態大模型&#xff0c;在架構設計上既有共性也有顯著差異。以下從核心模塊、技術實現和任務適配三個維度展開對比分析&#xff1a; 一、核心模塊架構對比 1. 視覺編碼器 MiniCPM-V-2_6&#xff1a; 架構&#xff1a;基于SigLIP-400M輕量級…

    鴻蒙學習筆記(5)-HTTP請求數據

    一、Http請求數據 http模塊是鴻蒙內置的一個模塊&#xff0c;提供了網絡請求的能力。不需要再寫比較原始的AJAS代碼。 ps:在項目中如果要訪問網絡資源&#xff0c;不管是圖片文件還是網絡請求&#xff0c;必須給項目開放權限。 &#xff08;1&#xff09;網絡連接方式 HTTP數…

    使用Redis5.X部署一個集群

    文章目錄 1.用Redis5.x來創建Cluste2. 查看節點信息 nodes3. 添加節點 add-node4.刪除節點 del-node5.手動指定從節點 replicate6.檢查集群健康狀態 check 建議使用5.x版本。 首先&#xff0c;下載Redis&#xff0c;根據自己的環境選擇版本。 一鍵啟動Redis集群文件配置。 ech…

    實現窗口函數

    java 實現窗口函數 public class SlidingWin {public static void main(String[] args) {SlidingWin slidingWin = new SlidingWin();double v = slidingWin.SlidWin(2);System.out.println(v);}public double SlidWin(int k){int [] array =new int[]{2,4,5,6,9,10,12,23,1,…

    Docker Compose 命令實現動態構建和部署

    Docker Compose 命令實現動態構建和部署 一、編寫支持動態版本號的 docker-compose.yml version: 3.8services:myapp:build: context: . # Dockerfile所在目錄args:APP_VERSION: ${TAG:-latest} # 從環境變量獲取版本號&#xff0c;默認latestimage: myapp:${TAG:-latest} …