资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

openstack安装(liberty)--安装对象存储服务

九、安装对象存储服务(swift),不使用控制節點數據庫服務,而於各存儲節點使用分布式SQLite數據庫。

坚守“ 做人真诚 · 做事靠谱 · 口碑至上 · 高效敬业 ”的价值观,专业网站建设服务10余年为成都阳台护栏小微创业公司专业提供成都企业网站建设营销网站建设商城网站建设手机网站建设小程序网站建设网站改版,从内容策划、视觉设计、底层架构、网页布局、功能开发迭代于一体的高端网站建设服务。

9.1对象存储服务包括的组件

Proxy servers (swift-proxy-server)代理服務,接收API或HTTP請求,執行上傳文件、修改源數據、WEB瀏覽時列表文件和創建容器等操作。通常使用CACHE技術(memcache)提高性能

Account servers (swift-account-server)賬戶服務,管理對象存儲中的賬戶定義。

Container servers (swift-container-server)容器服務,在對象存儲中管理容器或文件夾映……

Object servers (swift-object-server)對象服務,在存儲節點管理實際的對象,比如文件。

Various periodic processes執行各種週期性任務,比如複製服務確保群集中數據一致性和可用性。其他包括審計、更新、以及資源回收等。

WSGI middleware處理認證,通常使用OPENSTACK Identity

swift client為用戶提供命令行接口使用REST API

swift-init初始化和構建RING文件腳本

swift-recon一個命令行工具,用於檢索群集的各種度量和測試信息。

swift-ring-builder存儲RING構建和再平衡工具

9.2控制节点安裝配置代理服務(proxy service),用於處理用戶、容器以及對象操作請求,可以部署多個節點提高性能和冗余。可以不基於OPENSTACK其他組件安裝,自身可提供認證機制。

9.2.1創建用戶以及API訪問點

[root@comtroller1 ~]# . admin-openrc.sh 
[root@comtroller1 ~]# openstack user create --domain default --password-prompt swift
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | default                          |
| enabled   | True                             |
| id        | 9f9d73e380ac4db0af601604ee45ea02 |
| name      | swift                            |
+-----------+----------------------------------+
[root@comtroller1 ~]# openstack role add --project service --user swift admin
[root@comtroller1 ~]# openstack service create --name swift --description "OpenStack Object Storage" object-store
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Object Storage         |
| enabled     | True                             |
| id          | 6cbf871fbf5f4cb192a1e1337e59e5ed |
| name        | swift                            |
| type        | object-store                     |
+-------------+----------------------------------+
[root@comtroller1 ~]# openstack endpoint create --region RegionOne object-store public http://controller1:8080/v1/AUTH_%\(tenant_id\)s
+--------------+-----------------------------------------------+
| Field        | Value                                         |
+--------------+-----------------------------------------------+
| enabled      | True                                          |
| id           | 9850ec8e31b7434090cca0d881355b46              |
| interface    | public                                        |
| region       | RegionOne                                     |
| region_id    | RegionOne                                     |
| service_id   | 6cbf871fbf5f4cb192a1e1337e59e5ed              |
| service_name | swift                                         |
| service_type | object-store                                  |
| url          | http://controller1:8080/v1/AUTH_%(tenant_id)s |
+--------------+-----------------------------------------------+
[root@comtroller1 ~]# openstack endpoint create --region RegionOne object-store internal http://controller1:8080/v1/AUTH_%\(tenant_id\)s
+--------------+-----------------------------------------------+
| Field        | Value                                         |
+--------------+-----------------------------------------------+
| enabled      | True                                          |
| id           | 11a006619fc24414accc7117a4daabc9              |
| interface    | internal                                      |
| region       | RegionOne                                     |
| region_id    | RegionOne                                     |
| service_id   | 6cbf871fbf5f4cb192a1e1337e59e5ed              |
| service_name | swift                                         |
| service_type | object-store                                  |
| url          | http://controller1:8080/v1/AUTH_%(tenant_id)s |
+--------------+-----------------------------------------------+
[root@comtroller1 ~]# openstack endpoint create --region RegionOne object-store admin http://controller1:8080/v1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 4d52cf1cf9ab4eab8e14c5db7a564960 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 6cbf871fbf5f4cb192a1e1337e59e5ed |
| service_name | swift                            |
| service_type | object-store                     |
| url          | http://controller1:8080/v1       |
+--------------+----------------------------------+

9.2.2安裝配置組件

[root@comtroller1 ~]# yum install openstack-swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware memcached -y
[root@comtroller1 ~]# curl -o /etc/swift/proxy-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/proxy-server.conf-sample?h=stable/liberty
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 29655  100 29655    0     0  14194      0  0:00:02  0:00:02 --:--:-- 14188
[root@comtroller1 ~]# vi /etc/swift/proxy-server.conf 
[DEFAULT]
bind_port = 8080
user = swift
swift_dir = /etc/swift
[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]
use = egg:swift#proxy
account_autocreate = true
[filter:keystoneauth]  此项也需要取消注释
use = egg:swift#keystoneauth
operator_roles = admin,user
[filter:authtoken] 移除或註釋此配置組下其他項目
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
auth_uri = http://controller1:5000
auth_url = http://controller1:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = swift
password = swift
delay_auth_decision = true
[filter:cache]
use = egg:swift#memcache
memcache_servers = 127.0.0.1:11211

9.3安裝配置存儲節點

9.3.1準備存儲節點:支持所有具備extended attributes (xattr)文件系統,推薦使用XFS文件系統。###在兩節點均執行如下準備操作。

[root@object1 ~]# yum install xfsprogs rsync -y
[root@object1 ~]# ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdc
[root@object1 ~]# mkfs.xfs /dev/sdb
meta-data=/dev/sdb               isize=256    agcount=4, agsize=8388608 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=33554432, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=16384, 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=256    agcount=4, agsize=8388608 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=33554432, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=16384, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@object1 ~]# mkdir -p /srv/node/sdb
[root@object1 ~]# mkdir -p /srv/node/sdc
[root@object1 ~]# vi /etc/fstab 
/dev/sdb /srv/node/sdb xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
/dev/sdc /srv/node/sdc xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
[root@object1 ~]# mount /srv/node/sdb
[root@object1 ~]# mount /srv/node/sdc
[root@object1 ~]# vi /etc/rsyncd.conf 
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 10.0.0.51     ###對應存儲節點IP地址
[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
[root@object1 ~]# systemctl enable rsyncd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
[root@object1 ~]# systemctl start rsyncd.service
[root@object1 ~]# systemctl status rsyncd.service

9.3.2安裝配置組件

[root@object1 ~]# yum install openstack-swift-account openstack-swift-container  openstack-swift-object  -y
[root@object1 ~]# curl -o /etc/swift/account-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/account-server.conf-sample?h=stable/liberty
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6147  100  6147    0     0   4344      0  0:00:01  0:00:01 --:--:--  4347
[root@object1 ~]# curl -o /etc/swift/container-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/container-server.conf-sample?h=stable/liberty
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6976  100  6976    0     0    516      0  0:00:13  0:00:13 --:--:--  2087
[root@object1 ~]# 
[root@object1 ~]# curl -o /etc/swift/object-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/object-server.conf-sample?h=stable/liberty
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11819  100 11819    0     0   9234      0  0:00:01  0:00:01 --:--:--  9240
[root@object1 ~]# vi /etc/swift/account-server.conf 
[DEFAULT]
bind_ip = 10.0.0.51
bind_port = 6002
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = true
[pipeline:main]
pipeline = healthcheck recon account-server
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
[root@object1 ~]# vi /etc/swift/container-server.conf 
[DEFAULT]
bind_ip = 10.0.0.51
bind_port = 6001
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = true
[pipeline:main]
pipeline = healthcheck recon container-server
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
[root@object1 ~]# vi /etc/swift/object-server.conf 
[DEFAULT]
bind_ip = 10.0.0.51
bind_port = 6000
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = true
[pipeline:main]
pipeline = healthcheck recon object-server
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock
[root@object1 ~]# chown -R swift:swift /srv/node
[root@object1 ~]# mkdir -p /var/cache/swift
[root@object1 ~]# chown -R root:swift /var/cache/swift

9.4創建和分發initial rings(在控制節點執行,安裝有proxy service)

9.4.1創建賬戶RING

[root@comtroller1 ~]# cd /etc/swift/   ##切換目錄
[root@comtroller1 swift]# swift-ring-builder account.builder create 10 3 1   ###沒有輸出
[root@comtroller1 swift]# swift-ring-builder account.builder add  --region 1 --zone 1 --ip 10.0.0.51 --port 6002 --device sdb --weight 100     ###將各個存儲節點硬盤添加到RING
Device d0r1z1-10.0.0.51:6002R10.0.0.51:6002/sdb_"" with 100.0 weight got id 0
[root@comtroller1 swift]# swift-ring-builder account.builder add  --region 1 --zone 2 --ip 10.0.0.51 --port 6002 --device sdc --weight 100
Device d1r1z2-10.0.0.51:6002R10.0.0.51:6002/sdc_"" with 100.0 weight got id 1
[root@comtroller1 swift]# swift-ring-builder account.builder add  --region 1 --zone 3 --ip 10.0.0.52 --port 6002 --device sdb --weight 100
Device d2r1z3-10.0.0.52:6002R10.0.0.52:6002/sdb_"" with 100.0 weight got id 2
[root@comtroller1 swift]# swift-ring-builder account.builder add  --region 1 --zone 4 --ip 10.0.0.52 --port 6002 --device sdc --weight 100
Device d3r1z4-10.0.0.52:6002R10.0.0.52:6002/sdc_"" with 100.0 weight got id 3
[root@comtroller1 swift]# swift-ring-builder account.builder    ##驗證RING配置
account.builder, build version 4
1024 partitions, 3.000000 replicas, 1 regions, 4 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  6002       10.0.0.51              6002       sdb 100.00          0 -100.00 
             1       1     2       10.0.0.51  6002       10.0.0.51              6002       sdc 100.00          0 -100.00 
             2       1     3       10.0.0.52  6002       10.0.0.52              6002       sdb 100.00          0 -100.00 
             3       1     4       10.0.0.52  6002       10.0.0.52              6002       sdc 100.00          0 -100.00 
[root@comtroller1 swift]# swift-ring-builder account.builder rebalance  ##再平衡RING
Reassigned 1024 (100.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00

9.4.2創建容器RING

[root@comtroller1 ~]# cd /etc/swift/
[root@comtroller1 swift]# swift-ring-builder container.builder create 10 3 1
[root@comtroller1 swift]# swift-ring-builder container.builder add  --region 1 --zone 1 --ip 10.0.0.51 --port 6001 --device sdb --weight 100
Device d0r1z1-10.0.0.51:6001R10.0.0.51:6001/sdb_"" with 100.0 weight got id 0
[root@comtroller1 swift]# swift-ring-builder container.builder add  --region 1 --zone 2 --ip 10.0.0.51 --port 6001 --device sdc --weight 100
Device d1r1z2-10.0.0.51:6001R10.0.0.51:6001/sdc_"" with 100.0 weight got id 1
[root@comtroller1 swift]# swift-ring-builder container.builder add  --region 1 --zone 3 --ip 10.0.0.52 --port 6001 --device sdb --weight 100
Device d2r1z3-10.0.0.52:6001R10.0.0.52:6001/sdb_"" with 100.0 weight got id 2
[root@comtroller1 swift]# swift-ring-builder container.builder add  --region 1 --zone 4 --ip 10.0.0.52 --port 6001 --device sdc --weight 100
Device d3r1z4-10.0.0.52:6001R10.0.0.52:6001/sdc_"" with 100.0 weight got id 3
[root@comtroller1 swift]# swift-ring-builder container.builder
container.builder, build version 4
1024 partitions, 3.000000 replicas, 1 regions, 4 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  6001       10.0.0.51              6001       sdb 100.00          0 -100.00 
             1       1     2       10.0.0.51  6001       10.0.0.51              6001       sdc 100.00          0 -100.00 
             2       1     3       10.0.0.52  6001       10.0.0.52              6001       sdb 100.00          0 -100.00 
             3       1     4       10.0.0.52  6001       10.0.0.52              6001       sdc 100.00          0 -100.00 
[root@comtroller1 swift]# swift-ring-builder container.builder rebalance
Reassigned 1024 (100.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00

9.4.3創建對象RING

[root@comtroller1 ~]# cd /etc/swift/
[root@comtroller1 swift]# swift-ring-builder object.builder create 10 3 1
[root@comtroller1 swift]# swift-ring-builder object.builder add  --region 1 --zone 1 --ip 10.0.0.51 --port 6000 --device sdb --weight 100
Device d0r1z1-10.0.0.51:6000R10.0.0.51:6000/sdb_"" with 100.0 weight got id 0
[root@comtroller1 swift]# swift-ring-builder object.builder add  --region 1 --zone 2 --ip 10.0.0.51 --port 6000 --device sdc --weight 100
Device d1r1z2-10.0.0.51:6000R10.0.0.51:6000/sdc_"" with 100.0 weight got id 1
[root@comtroller1 swift]# swift-ring-builder object.builder add  --region 1 --zone 3 --ip 10.0.0.52 --port 6000 --device sdb --weight 100
Device d2r1z3-10.0.0.52:6000R10.0.0.52:6000/sdb_"" with 100.0 weight got id 2
[root@comtroller1 swift]# swift-ring-builder object.builder add  --region 1 --zone 4 --ip 10.0.0.52 --port 6000 --device sdc --weight 100
Device d3r1z4-10.0.0.52:6000R10.0.0.52:6000/sdc_"" with 100.0 weight got id 3
[root@comtroller1 swift]# swift-ring-builder object.builder
object.builder, build version 4
1024 partitions, 3.000000 replicas, 1 regions, 4 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  6000       10.0.0.51              6000       sdb 100.00          0 -100.00 
             1       1     2       10.0.0.51  6000       10.0.0.51              6000       sdc 100.00          0 -100.00 
             2       1     3       10.0.0.52  6000       10.0.0.52              6000       sdb 100.00          0 -100.00 
             3       1     4       10.0.0.52  6000       10.0.0.52              6000       sdc 100.00          0 -100.00
[root@comtroller1 swift]# swift-ring-builder object.builder rebalance
Reassigned 1024 (100.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00

9.4.4分發RING配置文件:拷貝account.ring.gz, container.ring.gz, and object.ring.gz到每個存儲節點或運行proxy service節點的/etc/swift/目錄下

[root@comtroller1 swift]# ll *.ring.gz
-rw-r--r-- 1 root root 1445 Aug  4 11:28 account.ring.gz
-rw-r--r-- 1 root root 1443 Aug  4 11:34 container.ring.gz
-rw-r--r-- 1 root root 1438 Aug  4 11:37 object.ring.gz
[root@comtroller1 swift]# scp *.ring.gz root@10.0.0.51:/etc/swift/
The authenticity of host '10.0.0.51 (10.0.0.51)' can't be established.
ECDSA key fingerprint is ce:93:44:a9:4d:03:93:c7:df:bf:6a:c0:a4:7e:13:8a.
Are you sure you want to continue connecting (yes/no)? yes    
Warning: Permanently added '10.0.0.51' (ECDSA) to the list of known hosts.
root@10.0.0.51's password: 
account.ring.gz                                                                                 100% 1445     1.4KB/s   00:00    
container.ring.gz                                                                               100% 1443     1.4KB/s   00:00    
object.ring.gz                                                                                  100% 1438     1.4KB/s   00:00    
[root@comtroller1 swift]# scp *.ring.gz root@10.0.0.52:/etc/swift/
The authenticity of host '10.0.0.52 (10.0.0.52)' can't be established.
ECDSA key fingerprint is 12:a5:46:52:af:56:1c:1a:f1:f7:ae:04:ee:f4:4c:05.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.52' (ECDSA) to the list of known hosts.
root@10.0.0.52's password: 
account.ring.gz                                                                                 100% 1445     1.4KB/s   00:00    
container.ring.gz                                                                               100% 1443     1.4KB/s   00:00    
object.ring.gz                                                                                  100% 1438     1.4KB/s   00:00

9.5結束安裝並啟動服務

9.5.1取得配置文件

[root@comtroller1 ~]# curl -o /etc/swift/swift.conf   https://git.openstack.org/cgit/openstack/swift/plain/etc/swift.conf-sample?h=stable/liberty

9.5.2配置HASH_PATH_SUFFIX和HASH_PATH_PREFIX

[root@comtroller1 ~]# vi /etc/swift/swift.conf
swift_hash_path_suffix = openstack
swift_hash_path_prefix = openstack

9.5.2配置默认存储策略

[storage-policy:0]
name = Policy-0
default = yes

9.5.3将配置文件拷贝到各个存储节点

[root@comtroller1 ~]# scp /etc/swift/swift.conf root@10.0.0.51:/etc/swift/
root@10.0.0.51's password: 
swift.conf                                                                                      100% 7202     7.0KB/s   00:00    
[root@comtroller1 ~]# scp /etc/swift/swift.conf root@10.0.0.52:/etc/swift/
root@10.0.0.52's password: 
swift.conf

9.5.4变更文件和文件夹权限

[root@comtroller1 ~]# chown -R root:swift /etc/swift
[root@object1 ~]# chown -R root:swift /etc/swift
[root@object2 ~]# chown -R root:swift /etc/swift

9.5.5启动控制节点的SWIFT代理服务

[root@comtroller1 ~]# systemctl enable openstack-swift-proxy.service memcached.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-swift-proxy.service to /usr/lib/systemd/system/openstack-swift-proxy.service.
[root@comtroller1 ~]# systemctl start openstack-swift-proxy.service memcached.service

9.5.6启动各存储节点服务

[root@object1 ~]# systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service  openstack-swift-account-reaper.service openstack-swift-account-replicator.service
[root@object1 ~]# systemctl start openstack-swift-account.service openstack-swift-account-auditor.service  openstack-swift-account-reaper.service openstack-swift-account-replicator.service
[root@object1 ~]# systemctl enable openstack-swift-container.service  openstack-swift-container-auditor.service openstack-swift-container-replicator.service  openstack-swift-container-updater.service
[root@object1 ~]# systemctl start openstack-swift-container.service   openstack-swift-container-auditor.service openstack-swift-container-replicator.service   openstack-swift-container-updater.service
[root@object1 ~]# systemctl enable openstack-swift-object.service openstack-swift-object-auditor.service   openstack-swift-object-replicator.service openstack-swift-object-updater.service
[root@object1 ~]# systemctl start openstack-swift-object.service openstack-swift-object-auditor.service  openstack-swift-object-replicator.service openstack-swift-object-updater.service
[root@object2 ~]# systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service  openstack-swift-account-reaper.service openstack-swift-account-replicator.service
[root@object2 ~]# systemctl start openstack-swift-account.service openstack-swift-account-auditor.service  openstack-swift-account-reaper.service openstack-swift-account-replicator.service
[root@object2 ~]# systemctl enable openstack-swift-container.service  openstack-swift-container-auditor.service openstack-swift-container-replicator.service  openstack-swift-container-updater.service
[root@object2 ~]# systemctl start openstack-swift-container.service   openstack-swift-container-auditor.service openstack-swift-container-replicator.service   openstack-swift-container-updater.service
[root@object2 ~]# systemctl enable openstack-swift-object.service openstack-swift-object-auditor.service   openstack-swift-object-replicator.service openstack-swift-object-updater.service
[root@object2 ~]# systemctl start openstack-swift-object.service openstack-swift-object-auditor.service  openstack-swift-object-replicator.service openstack-swift-object-updater.service

9.6驗證

[root@comtroller1 ~]# echo "export OS_AUTH_VERSION=3" | tee -a admin-openrc.sh demo-openrc.sh
[root@comtroller1 ~]# echo "export OS_REGION_NAME=RegionOne" | tee -a admin-openrc.sh demo-openrc.sh ###解决错误/usr/lib/python2.7/site-packages/keystoneclient/service_catalog.py:196: UserWarning: Providing attr without filter_value to get_urls() is deprecated as of the 1.7.0 release and may be removed in the 2.0.0 release. Either both should be provided or neither should be provided.
[root@comtroller1 ~]# . demo-openrc.sh 
[root@comtroller1 ~]# swift stat  ##查看swift状态
                        Account: AUTH_db6bcde12cc947119ecab8c211fa4f35
                     Containers: 1
                        Objects: 1
                          Bytes: 13287936
Containers in policy "policy-0": 1
   Objects in policy "policy-0": 1
     Bytes in policy "policy-0": 13287936
    X-Account-Project-Domain-Id: default
                    X-Timestamp: 1470286741.05862
                     X-Trans-Id: txa608922c24224805bfd25-0057a2e160
                   Content-Type: text/plain; charset=utf-8
                  Accept-Ranges: bytes
[root@comtroller1 ~]# swift list  ##查看swift中的容器
container1
[root@comtroller1 ~]# swift list container1  ##查看swift容器中的对象
cirros-0.3.4-x86_64-disk.img
[root@comtroller1 ~]# swift delete container1 cirros-0.3.4-x86_64-disk.img  ##删除容器中对象
cirros-0.3.4-x86_64-disk.img
[root@comtroller1 ~]# swift list container1
[root@comtroller1 ~]# swift upload container1 cirros-0.3.4-x86_64-disk.img   ##上传对象到容器
cirros-0.3.4-x86_64-disk.img
[root@comtroller1 ~]# ls
admin-openrc.sh  anaconda-ks.cfg  cirros-0.3.4-x86_64-disk.img  demo-openrc.sh  --os-project-domain-id  --os-project-name  token
[root@comtroller1 ~]# rm cirros-0.3.4-x86_64-disk.img 
rm: remove regular file ‘cirros-0.3.4-x86_64-disk.img’? y
[root@comtroller1 ~]# swift download container1 cirros-0.3.4-x86_64-disk.img  ##从容器中下载对象
cirros-0.3.4-x86_64-disk.img [auth 0.637s, headers 0.682s, total 1.000s, 36.568 MB/s]
[root@comtroller1 ~]# ls
admin-openrc.sh  anaconda-ks.cfg  cirros-0.3.4-x86_64-disk.img  demo-openrc.sh  --os-project-domain-id  --os-project-name  token
[root@comtroller1 ~]# swift post test_container   ##建立容器
[root@comtroller1 ~]# swift list
container1
test_container
[root@comtroller1 ~]# swift delete test_container  ##删除容器
test_container
[root@comtroller1 ~]# swift list
container1

名称栏目:openstack安装(liberty)--安装对象存储服务
网页网址:http://www.cdkjz.cn/article/pidide.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220