项目--对象存储--容器 在容器里你创建的即使是一个文件夹,那么体现在硬盘里,也是一个文件,也就是对象object
[root@h1~(keystone_admin)]#openstackservicelist +----------------------------------+------------+--------------+ |ID|Name|Type| +----------------------------------+------------+--------------+ |30c62c3c0797462a8bd4ff059a71296e|swift|object-store| [root@h1~(keystone_admin)]#keystoneendpoint-list|grep30c62c3c0797462a8bd4ff059a71296e |2408bc6cb5164053b86c0983fd39961a|RegionOne|http://192.168.1.201:8080/v1/AUTH_%(tenant_id)s|http://192.168.1.201:8080/v1/AUTH_%(tenant_id)s|http://192.168.1.201:8080|30c62c3c0797462a8bd4ff059a71296e| [root@h1~(keystone_admin)]#swiftlist h1 [root@h1~(keystone_admin)]#swiftlisth1 test1/ test1/k1.pem [root@h1~(keystone_admin)]#find/srv/node/swiftloopback/-typef-name"*.data" /srv/node/swiftloopback/objects/188901/27f/b87961659e1149b7094bb52b5d60f27f/1467698512.58656.data##删除k1后就没有了 /srv/node/swiftloopback/objects/59261/c81/39df7c7803321e4878fdcec1ac469c81/1467698493.15690.data
映射 :ring(环) 映射到硬盘
容器 在容器里面创建对象
对象 文件就是对象
账户 权限
ring文件 保存到硬盘
account.ring.gz 账户
container.ring.gz 容器
object.ring.gz 对象
保存到硬盘里的目录,这个目录为zone /srv/node/swiftloopback/ 挂载点 必须放在/srv/node/目录下
zone1
zone2 两个相同,备份
packstack方式安装完成后,上传一个文件,只在硬盘里保留一份
对象先映射到 虚拟节点/分区partition 2^n 再映射到zone
目的:减少数据的迁移量
swift服务
1 一致性服务 consisteny server
2 代维服务proxy server
3 存储服务
容器服务器 container server
对象服务器 object server
账户服务器 acount server
安装软件
[root@h4~]#yumlistopenstack-swift* [root@h4~]#yum-yinstallopenstack-swift.noarchopenstack-swift-account.noarchopenstack-swift-container.noarchopenstack-swift-object.noarchopenstack-swift-proxy.noarchmemcache*python-swiftclient
任何服务都要向keystone进行注册
[root@h4~(keystone_admin)]#keystoneuser-create--nameswift--passhequan [root@h4~(keystone_admin)]#keystonetenant-create--nameservices [root@h4~(keystone_admin)]#keystoneuser-role-add--userswift--tenantservices--roleadmin
创建服务,指定endpoint
[root@h4~(keystone_admin)]#keystoneservice-create--nameswift--typeobject-store--description"swift" keystoneendpoint-create--service-id0995c9a9ed4847da86435bca9a7be8fc--publicurl'http://192.168.1.204:8080/v1/AUTH_%(tenant_id)s'--internalurl'http://192.168.1.204:8080/v1/AUTH_%(tenant_id)s'--adminurl'http://192.168.1.204:8080'
配置swift 准备了2个分区
zone1zone2在/srv/node 12/dev/sdb1/srv/node/zone1xfsdefaults00##挂载 13/dev/sdb2/srv/node/zone2xfsdefaults00
[root@h4~(keystone_admin)]#chown-Rswift.swift/srv/node/
[root@h4swift(keystone_admin)]#catswift.conf [swift-hash] swift_hash_path_suffix=%SWIFT_HASH_PATH_SUFFIX% [root@h1~(keystone_admin)]#find/srv/node/swiftloopback/-typef-name"*.data" /srv/node/swiftloopback/objects/102340/afe/63f12ea37cca17f0227381adcf93eafe/1467982747.16551.data zone对象类型/分区的编号/sufix/文件名字的hash/上传文件的时间戳 [root@h1~(keystone_admin)]#date--date=@1467982747.16551 2016年07月08日星期五20:59:07CST
创建ring文件的准备工作 创建模板,设定有几个备份,有多少分区。
[root@h4swift(keystone_admin)]#swift-ring-builderaccount.buildercreate1221 [root@h4swift(keystone_admin)]#swift-ring-builderobject.buildercreate1221 [root@h4swift(keystone_admin)]#swift-ring-buildercontainer.buildercreate1221
指定映射位置
[root@h4swift]#vimaccount-server.conf#3个都要改ip 6bind_ip=192.168.1.204 [root@h4swift(keystone_admin)]#swift-ring-builderaccount.builderaddz1-192.168.1.204:6202/zone1100 [root@h4swift(keystone_admin)]#swift-ring-builderaccount.builderaddz2-192.168.1.204:6202/zone2100 [root@h4swift(keystone_admin)]#swift-ring-builderobject.builderaddz1-192.168.1.204:6200/zone1100 [root@h4swift(keystone_admin)]#swift-ring-builderobject.builderaddz2-192.168.1.204:6200/zone2100 [root@h4swift(keystone_admin)]#swift-ring-buildercontainer.builderaddz1-192.168.1.204:6201/zone1100 [root@h4swift(keystone_admin)]#swift-ring-buildercontainer.builderaddz2-192.168.1.204:6201/zone2100
创建ring文件
[root@h4swift(keystone_admin)]#swift-ring-builderaccount.builderrebalance [root@h4swift(keystone_admin)]#swift-ring-builderobject.builderrebalance [root@h4swift(keystone_admin)]#swift-ring-buildercontainer.builderrebalance [root@h4swift(keystone_admin)]#ls*.gz account.ring.gzcontainer.ring.gzobject.ring.gz
启动服务
[root@h4srv(keystone_admin)]#systemctlstartopenstack-swift-accountopenstack-swift-objectopenstack-swift-container [root@h4srv(keystone_admin)]#systemctlis-activeopenstack-swift-accountopenstack-swift-objectopenstack-swift-container active active active [root@h4srv(keystone_admin)]#systemctlenableopenstack-swift-accountopenstack-swift-objectopenstack-swift-container
代维服务proxy server
[root@h4swift(keystone_admin)]#vimproxy-server.conf 53[filter:authtoken] 54paste.filter_factory=keystonemiddleware.auth_token:filter_factory 55admin_tenant_name=services 56admin_user=swift 57admin_password=hequan 58# 59identity_uri=http://192.168.1.204:35357/ 60auth_port=35357 61auth_protocol=http 62#auth_uri=http://192.168.1.204:5000/
[root@h4swift(keystone_admin)]#systemctlstartopenstack-swift-proxy.service [root@h4swift(keystone_admin)]#systemctlenableopenstack-swift-proxy.service [root@h4swift(keystone_admin)]#systemctlstartmemcached.service [root@h4swift(keystone_admin)]#systemctlenablememcached.service [root@h4swift(keystone_admin)]#swiftposth1 [root@h4swift(keystone_admin)]#swiftlist h1 [root@h4swift(keystone_admin)]#swiftuploadh1/etc/hosts 任意一个分区挂了,还是可以正常查看 两个都挂了,就看不到了