
班级:20网络3
学号:30
姓名:徐鑫
swift *** 作截图
设置后端存储截图[root@xiandian ~]# source /etc/keystone/admin-openrc.sh
[root@xiandian ~]# openstack role list
+----------------------------------+------------------+
| ID | Name |
+----------------------------------+------------------+
| 384c446de0dc4c80bc4ef187c555dacd | user |
| 5adf91f71f7646cb89917e2f975aa68d | heat_stack_owner |
| 710e4f3907264eb3b65e97e27990f30b | admin |
| 8229ef312d194bbda9aceefa4b8362cd | heat_stack_user |
| c83aed0bc3784e4abe7dbf1f095b51e4 | ResellerAdmin |
+----------------------------------+------------------+
[root@xiandian ~]# openstack service list
+----------------------------------+------------+----------------+
| ID | Name | Type |
+----------------------------------+------------+----------------+
| 07b314e21ad44d1e8c38466d4be75a4c | ceilometer | metering |
| 1af6174c6dd043bf8f16adcb97bbad28 | nova | compute |
| 25b8eef99c70400ab16266cd795bcc02 | aodh | alarming |
| 2b73f27e09ef4f0fa717153f88f8ac8c | keystone | identity |
| 32b9a24cda164a6a806308246197a476 | cinder | volume |
| 6793669d2ea74fcd832aa2661558587a | cinderv2 | volumev2 |
| 68805ded3673497e9f9e98737a1c6a32 | heat-cfn | cloudformation |
| 7d25ec1551f349fab321db31b029acbc | glance | image |
| 959540c2be1a40d9b7f790d87d9377b0 | neutron | network |
| 9e24529c11a04ffa96e32c57fb0f5186 | heat | orchestration |
| b40175bd02224fb78e1a1e26f810587e | swift | object-store |
+----------------------------------+------------+----------------+
[root@xiandian ~]# #查看swift组件
[root@xiandian ~]# openstack-service list | grep swift
openstack-swift-account-auditor
openstack-swift-account-reaper
openstack-swift-account-replicator
openstack-swift-account
openstack-swift-container-auditor
openstack-swift-container-replicator
openstack-swift-container-updater
openstack-swift-container
openstack-swift-object-auditor
openstack-swift-object-replicator
openstack-swift-object-updater
openstack-swift-object
openstack-swift-proxy
[root@xiandian ~]# #1,创建容器,上传下载和删除对象;2.上传大容量文件;容器管理,设置权限;4将swift 设置为glance.cinder的后端存储
[root@xiandian ~]# #查看当前平台的容器
[root@xiandian ~]# openstack container list
[root@xiandian ~]# #查看swift容器
[root@xiandian ~]# swift list
[root@xiandian ~]# #创建swift容器
[root@xiandian ~]# swift post test30
[root@xiandian ~]# openstack container list
+--------+
| Name |
+--------+
| test30 |
+--------+
[root@xiandian ~]# swift list
test30
[root@xiandian ~]# #查看容器内部对象情况
[root@xiandian ~]# swift list test30
[root@xiandian ~]# #上传对象到容器,首先在当前目录下创建一个文件,然后上传到test30
[root@xiandian ~]# touch one.txt
[root@xiandian ~]# ls
one.txt
[root@xiandian ~]# swift upload test30 one.txt
one.txt
[root@xiandian ~]# swift list test30
one.txt
[root@xiandian ~]# #上传目录
[root@xiandian ~]# mkdir file30
[root@xiandian ~]# ls
file30 one.txt
[root@xiandian ~]# swift upload test30 file30/
file30/
[root@xiandian ~]# swift list test30
file30/
one.txt
[root@xiandian ~]# #上传文件到指定容器目录下
[root@xiandian ~]# touch two.doc
[root@xiandian ~]# touch three.png
[root@xiandian ~]# swift upload test30/file30 two.doc
file30/two.doc
[root@xiandian ~]# swift list test30
file30/
file30/two.doc
one.txt
[root@xiandian ~]# swift upload test30/file30 three.png
file30/three.png
[root@xiandian ~]# swift list test30
file30/
file30/three.png
file30/two.doc
one.txt
[root@xiandian ~]# #查看容器具体状态
[root@xiandian ~]# swift stat test30
Account: AUTH_0ab2dbde4f754b699e22461426cd0774
Container: test30
Objects: 4
Bytes: 0
Read ACL:
Write ACL:
Sync To:
Sync Key:
Accept-Ranges: bytes
X-Storage-Policy: Policy-0
X-Timestamp: 1639387112.48490
X-Trans-Id: tx76005d2cc8d1434dae2e3-0061b711f3
Content-Type: text/plain; charset=utf-8
[root@xiandian ~]# #查看当前account下的swift的装填
[root@xiandian ~]# swift stat
Account: AUTH_0ab2dbde4f754b699e22461426cd0774
Containers: 1
Objects: 3
Bytes: 0
Containers in policy "policy-0": 1
Objects in policy "policy-0": 3
Bytes in policy "policy-0": 0
X-Account-Project-Domain-Id: 3ac89594c8e944a9b5bb567fca4e75aa
X-Timestamp: 1639387112.46752
X-Trans-Id: tx8830d43e00e1410582d93-0061b71234
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes
[root@xiandian ~]# swift post test
[root@xiandian ~]# swift stat
Account: AUTH_0ab2dbde4f754b699e22461426cd0774
Containers: 2
Objects: 4
Bytes: 0
Containers in policy "policy-0": 2
Objects in policy "policy-0": 4
Bytes in policy "policy-0": 0
X-Account-Project-Domain-Id: 3ac89594c8e944a9b5bb567fca4e75aa
X-Timestamp: 1639387112.46752
X-Trans-Id: txed49d21ab154445bb71c7-0061b7129f
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes
[root@xiandian ~]# #从容器中下载对象
[root@xiandian ~]# swift download test30 file30/two.doc
file30/two.doc [auth 0.390s, headers 0.658s, total 0.658s, 0.000 MB/s]
[root@xiandian ~]# ls
file30 one.txt three.png two.doc
[root@xiandian ~]# ls file30/
two.doc
[root@xiandian ~]# #从容器中删除对象
[root@xiandian ~]# swift delete test30 file30/two.doc
file30/two.doc
[root@xiandian ~]# swift list test30
file30/
file30/three.png
one.txt
[root@xiandian ~]# #2,上传>1gb大容量文件
[root@xiandian ~]# #创建1gb大小的文件
[root@xiandian ~]# dd if=/dev/zero of=file30/example30-1Gb bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 1.69548 s, 633 MB/s
[root@xiandian ~]# ls file30/
example30-1Gb two.doc
[root@xiandian ~]# swift upload teat30 -S 102400000 file30/example30-1Gb
file30/example30-1Gb segment 0
file30/example30-1Gb segment 3
file30/example30-1Gb segment 6
file30/example30-1Gb segment 9
file30/example30-1Gb segment 5
file30/example30-1Gb segment 2
file30/example30-1Gb segment 1
file30/example30-1Gb segment 10
file30/example30-1Gb segment 7
file30/example30-1Gb segment 8
file30/example30-1Gb segment 4
file30/example30-1Gb
[root@xiandian ~]# swift list file30
Container u'file30' not found
[root@xiandian ~]# swift list test30
[root@xiandian ~]# #3.设置容器权限
[root@xiandian ~]# openstack user list
+----------------------------------+-------------------+
| ID | Name |
+----------------------------------+-------------------+
| 020cce9b69a44aef984fa8aba5135f3f | heat_domain_admin |
| 2c8b1e282f804fc58bc8cdfe7518d80f | neutron |
| 372c371d6c4a4d5aa099376499fa21ef | aodh |
| 413c222a0c0d476fa77e3a096f9da216 | heat |
| 46faed53c3534611a83f586d55951246 | glance |
| 53a1cf0ad2924532aa4b7b0750dec282 | admin |
| 73191a8367e4410da4bf764263ade04c | demo |
| 95f197fef75a490cbe926350d2688512 | cinder |
| 97dcfcb9a3b84dd5a47d40c01425e8f5 | swift |
| a0024f4b405745b999aaa1276844dec6 | nova |
| d46602d109214aea92ec4f9f0e4223e2 | ceilometer |
+----------------------------------+-------------------+
[root@xiandian ~]# #设置用户demo对test30具有可读权限
[root@xiandian ~]# swift post -r demo test30
[root@xiandian ~]# #设置用户glance对test30具有可读可写的权限
[root@xiandian ~]# swift post -r glance -w glance test30
[root@xiandian ~]# #4.将swift设置为glance的后端存储
[root@xiandian ~]# vi /etc/glance/glance-api.conf
[root@xiandian ~]# systemctl restart openstack-glance-api.conf
Failed to restart openstack-glance-api.conf.service: Unit openstack-glance-api.conf.service failed to load: No such file or directory.
[root@xiandian ~]#
[root@xiandian ~]# systemctl restart openstack-glance-api.conf
Failed to restart openstack-glance-api.conf.service: Unit openstack-glance-api.conf.service failed to load: No such file or directory.
[root@xiandian ~]# vi /etc/glance/glance-api.conf
[root@xiandian ~]# systemctl restart openstack-glance-api.conf
Failed to restart openstack-glance-api.conf.service: Unit openstack-glance-api.conf.service failed to load: No such file or directory.
[root@xiandian ~]# systemctl restart openstack-glance-api.service
[root@xiandian ~]# systemctl restart openstack-glance-registry.service
[root@xiandian ~]# swift post RD_Republic
[root@xiandian ~]# swift post IT_Private
[root@xiandian ~]# mkdi
mkdict mkdir
[root@xiandian ~]# mkdir netwrok30
[root@xiandian ~]# touch iaas.txt
[root@xiandian ~]# touch pass.doc
[root@xiandian ~]# swift upload IT_Private network/
Local file 'network/' not found
^[[A[root@xiandian swift upload IT_Private network30/
Local file 'network30/' not found
[root@xiandian ~]# ls
example30-1Gb file30 iaas.txt netwrok30 one.txt pass.doc three.png two.doc
[root@xiandian ~]# mkdir network30
[root@xiandian ~]# swift upload IT_Private network30/
network30/
[root@xiandian ~]# swift upload IT_Private/network30 iaas.txt
network30/iaas.txt
[root@xiandian ~]# swift upload IT_Private/network30 pass.doc
network30/pass.doc
[root@xiandian ~]# swift upload RD_Republic one.txt
one.txt
[root@xiandian ~]# swift post -r demo -w demo IT_Private
[root@xiandian ~]# swift post -r demo RD_Republic
[root@xiandian ~]# swift stat RD_Republic
Account: AUTH_0ab2dbde4f754b699e22461426cd0774
Container: RD_Republic
Objects: 1
Bytes: 0
Read ACL: demo
Write ACL:
Sync To:
Sync Key:
Accept-Ranges: bytes
X-Trans-Id: txf0b5267e674b4f6eb2b83-0061b722c6
X-Storage-Policy: Policy-0
X-Timestamp: 1639391384.76476
Content-Type: text/plain; charset=utf-8
[root@xiandian ~]# swift list IT_Private
network30/
network30/iaas.txt
network30/pass.doc
[root@xiandian ~]#
#**属性设置**
vi /etc/glance/glance-api.conf
[DEFAULT]
rpc_backend = rabbit
default_store = swift
stores = glance.store.swift.Store, glance.store.filesystem.Store
swift_store_auth_version = 3
swift_store_auth_address = http://xiandian:5000/v3
swift_store_user = service:swift
swift_store_key = 000000
swift_store_container = glance
swift_store_create_container_put = True
swift_store_large_object_size = 5120
swift_store_large_object_chunk_size = 200
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)