九、安裝對(duì)象存儲(chǔ)服務(wù)(swift),不使用控制節(jié)點(diǎn)數(shù)據(jù)庫(kù)服務(wù),而於各存儲(chǔ)節(jié)點(diǎn)使用分布式SQLite數(shù)據(jù)庫(kù)。
堅(jiān)守“ 做人真誠(chéng) · 做事靠譜 · 口碑至上 · 高效敬業(yè) ”的價(jià)值觀,專業(yè)網(wǎng)站建設(shè)服務(wù)10余年為成都陽(yáng)臺(tái)護(hù)欄小微創(chuàng)業(yè)公司專業(yè)提供成都企業(yè)網(wǎng)站建設(shè)營(yíng)銷網(wǎng)站建設(shè)商城網(wǎng)站建設(shè)手機(jī)網(wǎng)站建設(shè)小程序網(wǎng)站建設(shè)網(wǎng)站改版,從內(nèi)容策劃、視覺(jué)設(shè)計(jì)、底層架構(gòu)、網(wǎng)頁(yè)布局、功能開(kāi)發(fā)迭代于一體的高端網(wǎng)站建設(shè)服務(wù)。
9.1對(duì)象存儲(chǔ)服務(wù)包括的組件
Proxy servers (swift-proxy-server)代理服務(wù),接收API或HTTP請(qǐng)求,執(zhí)行上傳文件、修改源數(shù)據(jù)、WEB瀏覽時(shí)列表文件和創(chuàng)建容器等操作。通常使用CACHE技術(shù)(memcache)提高性能
Account servers (swift-account-server)賬戶服務(wù),管理對(duì)象存儲(chǔ)中的賬戶定義。
Container servers (swift-container-server)容器服務(wù),在對(duì)象存儲(chǔ)中管理容器或文件夾映……
Object servers (swift-object-server)對(duì)象服務(wù),在存儲(chǔ)節(jié)點(diǎn)管理實(shí)際的對(duì)象,比如文件。
Various periodic processes執(zhí)行各種週期性任務(wù),比如複製服務(wù)確保群集中數(shù)據(jù)一致性和可用性。其他包括審計(jì)、更新、以及資源回收等。
WSGI middleware處理認(rèn)證,通常使用OPENSTACK Identity
swift client為用戶提供命令行接口使用REST API
swift-init初始化和構(gòu)建RING文件腳本
swift-recon一個(gè)命令行工具,用於檢索群集的各種度量和測(cè)試信息。
swift-ring-builder存儲(chǔ)RING構(gòu)建和再平衡工具
9.2控制節(jié)點(diǎn)安裝配置代理服務(wù)(proxy service),用於處理用戶、容器以及對(duì)象操作請(qǐng)求,可以部署多個(gè)節(jié)點(diǎn)提高性能和冗余。可以不基於OPENSTACK其他組件安裝,自身可提供認(rèn)證機(jī)制。
9.2.1創(chuàng)建用戶以及API訪問(wèn)點(diǎn)
[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] 此項(xiàng)也需要取消注釋 use = egg:swift#keystoneauth operator_roles = admin,user [filter:authtoken] 移除或註釋此配置組下其他項(xiàng)目 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安裝配置存儲(chǔ)節(jié)點(diǎn)
9.3.1準(zhǔn)備存儲(chǔ)節(jié)點(diǎn):支持所有具備extended attributes (xattr)文件系統(tǒng),推薦使用XFS文件系統(tǒng)。###在兩節(jié)點(diǎn)均執(zhí)行如下準(zhǔn)備操作。
[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 ###對(duì)應(yīng)存儲(chǔ)節(jié)點(diǎn)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創(chuàng)建和分發(fā)initial rings(在控制節(jié)點(diǎn)執(zhí)行,安裝有proxy service)
9.4.1創(chuàng)建賬戶RING
[root@comtroller1 ~]# cd /etc/swift/ ##切換目錄 [root@comtroller1 swift]# swift-ring-builder account.builder create 10 3 1 ###沒(méi)有輸出 [root@comtroller1 swift]# swift-ring-builder account.builder add --region 1 --zone 1 --ip 10.0.0.51 --port 6002 --device sdb --weight 100 ###將各個(gè)存儲(chǔ)節(jié)點(diǎn)硬盤添加到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 ##驗(yàn)證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創(chuàng)建容器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創(chuàng)建對(duì)象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分發(fā)RING配置文件:拷貝account.ring.gz, container.ring.gz, and object.ring.gz到每個(gè)存儲(chǔ)節(jié)點(diǎn)或運(yùn)行proxy service節(jié)點(diǎn)的/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結(jié)束安裝並啟動(dòng)服務(wù)
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配置默認(rèn)存儲(chǔ)策略
[storage-policy:0] name = Policy-0 default = yes
9.5.3將配置文件拷貝到各個(gè)存儲(chǔ)節(jié)點(diǎn)
[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變更文件和文件夾權(quán)限
[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啟動(dòng)控制節(jié)點(diǎn)的SWIFT代理服務(wù)
[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啟動(dòng)各存儲(chǔ)節(jié)點(diǎn)服務(wù)
[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驗(yàn)證
[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 ###解決錯(cuò)誤/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狀態(tài) 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容器中的對(duì)象 cirros-0.3.4-x86_64-disk.img [root@comtroller1 ~]# swift delete container1 cirros-0.3.4-x86_64-disk.img ##刪除容器中對(duì)象 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 ##上傳對(duì)象到容器 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 ##從容器中下載對(duì)象 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