您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)openstack中swift如何安裝,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
項(xiàng)目--對象存儲(chǔ)--容器 在容器里你創(chuàng)建的即使是一個(gè)文件夾,那么體現(xiàn)在硬盤里,也是一個(gè)文件,也就是對象object
[root@h2 ~(keystone_admin)]# openstack service list +----------------------------------+------------+--------------+ | ID | Name | Type | +----------------------------------+------------+--------------+ | 30c62c3c0797462a8bd4ff059a71296e | swift | object-store | [root@h2 ~(keystone_admin)]# keystone endpoint-list | grep 30c62c3c0797462a8bd4ff059a71296e | 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@h2 ~(keystone_admin)]# swift list h2 [root@h2 ~(keystone_admin)]# swift list h2 test1/ test1/k1.pem [root@h2 ~(keystone_admin)]# find /srv/node/swiftloopback/ -type f -name "*.data" /srv/node/swiftloopback/objects/188901/27f/b87961659e1149b7094bb52b5d60f27f/1467698512.58656.data ##刪除k1后就沒有了 /srv/node/swiftloopback/objects/59261/c81/39df7c7803321e4878fdcec1ac469c81/1467698493.15690.data
映射 :ring(環(huán)) 映射到硬盤
容器 在容器里面創(chuàng)建對象
對象 文件就是對象
賬戶 權(quán)限
ring文件 保存到硬盤
account.ring.gz 賬戶
container.ring.gz 容器
object.ring.gz 對象
保存到硬盤里的目錄,這個(gè)目錄為zone /srv/node/swiftloopback/ 掛載點(diǎn) 必須放在/srv/node/目錄下
zone1
zone2 兩個(gè)相同,備份
packstack方式安裝完成后,上傳一個(gè)文件,只在硬盤里保留一份
對象先映射到 虛擬節(jié)點(diǎn)/分區(qū)partition 2^n 再映射到zone
目的:減少數(shù)據(jù)的遷移量
swift服務(wù)
1 一致性服務(wù) consisteny server
auditor 定期掃描,如果出現(xiàn)問題,就把有問題的文件放隔離區(qū)
replicate 從另外的zone復(fù)制相同的文件過來,實(shí)現(xiàn)數(shù)據(jù)同步
update 如果replicate失效了,那么等段時(shí)間再試
2 代維服務(wù)proxy server
接受用戶發(fā)送過來的請求,比如上傳、刪除等請求
3 存儲(chǔ)服務(wù)
容器服務(wù)器 container server
對象服務(wù)器 object server
賬戶服務(wù)器 acount server
安裝軟件
[root@h5 ~]# yum list openstack-swift* [root@h5 ~]# yum -y install openstack-swift.noarch openstack-swift-account.noarch openstack-swift-container.noarch openstack-swift-object.noarch openstack-swift-proxy.noarch memcache* python-swiftclient
任何服務(wù)都要向keystone進(jìn)行注冊
[root@h5 ~(keystone_admin)]# keystone user-create --name swift --pass hequan [root@h5 ~(keystone_admin)]# keystone tenant-create --name services [root@h5 ~(keystone_admin)]# keystone user-role-add --user swift --tenant services --role admin
創(chuàng)建服務(wù),指定endpoint
[root@h5 ~(keystone_admin)]# keystone service-create --name swift --type object-store --description "swift" keystone endpoint-create --service-id 0995c9a9ed4847da86435bca9a7be8fc --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 準(zhǔn)備了2個(gè)分區(qū)
zone1 zone2 在/srv/node 12 /dev/sdb1 /srv/node/zone1 xfs defaults 0 0 ##掛載 13 /dev/sdb2 /srv/node/zone2 xfs defaults 0 0
[root@h5 ~(keystone_admin)]# chown -R swift.swift /srv/node/
[root@h5 swift(keystone_admin)]# cat swift.conf [swift-hash] swift_hash_path_suffix = %SWIFT_HASH_PATH_SUFFIX% [root@h2 ~(keystone_admin)]# find /srv/node/swiftloopback/ -type f -name "*.data" /srv/node/swiftloopback/objects/102340/afe/63f12ea37cca17f0227381adcf93eafe/1467982747.16551.data zone 對象類型/分區(qū)的編號(hào)/sufix/文件名字的hash /上傳文件的時(shí)間戳 [root@h2 ~(keystone_admin)]# date --date=@1467982747.16551 2016年 07月 08日 星期五 20:59:07 CST
創(chuàng)建ring文件的準(zhǔn)備工作 創(chuàng)建模板,設(shè)定有幾個(gè)備份,有多少分區(qū)。
[root@h5 swift(keystone_admin)]# swift-ring-builder account.builder create 12 2 1 [root@h5 swift(keystone_admin)]# swift-ring-builder object.builder create 12 2 1 [root@h5 swift(keystone_admin)]# swift-ring-builder container.builder create 12 2 1
指定映射位置
[root@h5 swift]# vim account-server.conf #3個(gè)都要改ip 6 bind_ip = 192.168.1.204 [root@h5 swift(keystone_admin)]# swift-ring-builder account.builder add z1-192.168.1.204:6202/zone1 100 [root@h5 swift(keystone_admin)]# swift-ring-builder account.builder add z2-192.168.1.204:6202/zone2 100 [root@h5 swift(keystone_admin)]# swift-ring-builder object.builder add z1-192.168.1.204:6200/zone1 100 [root@h5 swift(keystone_admin)]# swift-ring-builder object.builder add z2-192.168.1.204:6200/zone2 100 [root@h5 swift(keystone_admin)]# swift-ring-builder container.builder add z1-192.168.1.204:6201/zone1 100 [root@h5 swift(keystone_admin)]# swift-ring-builder container.builder add z2-192.168.1.204:6201/zone2 100
創(chuàng)建ring文件
[root@h5 swift(keystone_admin)]# swift-ring-builder account.builder rebalance [root@h5 swift(keystone_admin)]# swift-ring-builder object.builder rebalance [root@h5 swift(keystone_admin)]# swift-ring-builder container.builder rebalance [root@h5 swift(keystone_admin)]# ls *.gz account.ring.gz container.ring.gz object.ring.gz
啟動(dòng)服務(wù)
[root@h5 srv(keystone_admin)]# systemctl start openstack-swift-account openstack-swift-object openstack-swift-container [root@h5 srv(keystone_admin)]# systemctl is-active openstack-swift-account openstack-swift-object openstack-swift-container active active active [root@h5 srv(keystone_admin)]# systemctl enable openstack-swift-account openstack-swift-object openstack-swift-container
代維服務(wù)proxy server
[root@h5 swift(keystone_admin)]# vim proxy-server.conf 53 [filter:authtoken] 54 paste.filter_factory = keystonemiddleware.auth_token:filter_factory 55 admin_tenant_name = services 56 admin_user = swift 57 admin_password = hequan 58 # 59 identity_uri = http://192.168.1.204:35357/ 60 auth_port = 35357 61 auth_protocol = http 62 #auth_uri = http://192.168.1.204:5000/
[root@h5 swift(keystone_admin)]# systemctl start openstack-swift-proxy.service [root@h5 swift(keystone_admin)]# systemctl enable openstack-swift-proxy.service [root@h5 swift(keystone_admin)]# systemctl start memcached.service [root@h5 swift(keystone_admin)]# systemctl enable memcached.service [root@h5 swift(keystone_admin)]# swift post h2 [root@h5 swift(keystone_admin)]# swift list h2 [root@h5 swift(keystone_admin)]# swift upload h2 /etc/hosts 任意一個(gè)分區(qū)掛了,還是可以正常查看 兩個(gè)都掛了,就看不到了
關(guān)于“openstack中swift如何安裝”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。