中文字幕理论片,69视频免费在线观看,亚洲成人app,国产1级毛片,刘涛最大尺度戏视频,欧美亚洲美女视频,2021韩国美女仙女屋vip视频

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Swift和Keystone單機安裝總結 ? OpenStack中國社區(qū)

一般網(wǎng)上搜索到的資料都是介紹整個Openstack的安裝過程的,通常都是長篇累牘,非常復雜。因為個人的虛擬機環(huán)境,沒有太高調(diào)配置,不可能完整運行Openstack的各種服務,只想體驗一下Swift,于是試著只安裝Swift和Keystone。對于Openstack支持最好的也就算是Ubuntu發(fā)行版了,甚至在較新的13.0版以上都直接集成了。

因為只安裝單機版本的Swift和Keystone,因此不需要雙網(wǎng)卡,所有業(yè)務和控制都走一個網(wǎng)絡即可。網(wǎng)絡規(guī)劃簡單。

首先,下載安裝Ubuntu,這里選擇12.04 LTS版本。安裝軟件包:

通用工具:sudo apt-get install openssh-serverKeystone:sudo apt-get install keystone python-keystone python-keystoneclientSwift:sudo apt-get install swift swift-proxy swift-account swift-container swift-object

ssh server是為了遠程登錄使用,在Windows下使用終端工具登錄便于與Linux系統(tǒng)交互。Keystone 安裝完成后即可正常運行,不需要作任何配置。默認情況下,Keystone使用SQLite來存儲數(shù)據(jù)。執(zhí)行如下命令同步Keystone的數(shù)據(jù)庫:

sudo service keystone restartsudo keystone-manage db_sync

Swift安裝和配置過程稍微復雜一些。首先要為Swift準備存儲節(jié)點。Swift的三個Ring使用的是XFS的文件系統(tǒng),因此需要為其新增一塊虛擬硬盤,這里在一塊硬盤上面模擬4個虛擬節(jié)點,來模擬Swfit環(huán)。

在虛擬機管理界面上面為系統(tǒng)添加一塊硬盤,重啟系統(tǒng)后,可以看到該硬盤已經(jīng)被系統(tǒng)識別。本系統(tǒng)上面的硬盤設備名為:/dev/sdb,使用fdisk /dev/sdb為該硬盤創(chuàng)建分區(qū),先建擴展分區(qū),再建一個主分區(qū)。然后再給該分區(qū)創(chuàng)建文件系統(tǒng),使用mkfs.xfs命令創(chuàng)建xfs文件系統(tǒng)。這些操作可以單獨再網(wǎng)絡上搜索到詳盡的指導,這里不再詳述。創(chuàng)建好系統(tǒng)后,將該XFS格式的文件系統(tǒng)mount到系統(tǒng)目錄下,這里mount到/swift目錄。然后使用mount命令,可以看到系統(tǒng)已經(jīng)多了一個XFS的分區(qū):/dev/sdb5 on /swift type xfs (rw)。最好能把該分區(qū)信息寫到fstab中,這樣系統(tǒng)啟動時即會掛載該分區(qū)。

在/swfit目錄下新建四個子目錄:

root@u1:/swift# ls -l總用量 0drwxr-xr-x 3 swift swift 31 3月 18 21:35 node1drwxr-xr-x 3 swift swift 31 3月 18 21:35 node2drwxr-xr-x 3 swift swift 31 3月 18 21:35 node3drwxr-xr-x 3 swift swift 31 3月 18 21:35 node4root@u1:/swift#

指導手冊中也有介紹采用回環(huán)文件作為存儲空間的方法,需要的可以自己操作。

建立運行環(huán)境:

for i in {1..4}; do sudo ln -s /swift/node$i /srv/node$i; done;sudo mkdir -p /etc/swift/account-server /etc/swift/container-server /etc/swift/object-server /srv/node1/device /srv/node2/device /srv/node3/device /srv/node4/devicesudo mkdir /run/swift

將如下命令寫入系統(tǒng)啟動腳本中:

mkdir /run/swiftchown swift:swift /run/swift

使用Rsync來維護對象副本,許多swift服務都使用它保持對象一致性及進行更新操作。

編輯 /etc/default/rsync文件:Set RSYNC_ENABLE=true

然后編輯 /etc/rsyncd.conf配置文件,如下所示:

# General stuffuid = swiftgid = swiftlog file = /var/log/rsyncd.logpid file = /run/rsyncd.pidaddress = 127.0.0.1# Account Server replication settings[account6012]max connections = 25path = /srv/node1/read only = falselock file = /run/lock/account6012.lock[account6022]max connections = 25path = /srv/node2/read only = falselock file = /run/lock/account6022.lock[account6032]max connections = 25path = /srv/node3/read only = falselock file = /run/lock/account6032.lock[account6042]max connections = 25path = /srv/node4/read only = falselock file = /run/lock/account6042.lock# Container server replication settings[container6011]max connections = 25path = /srv/node1/read only = falselock file = /run/lock/container6011.lock[container6021]max connections = 25path = /srv/node2/read only = falselock file = /run/lock/container6021.lock[container6031]max connections = 25path = /srv/node3/read only = falselock file = /run/lock/container6031.lock[container6041]max connections = 25path = /srv/node4/read only = falselock file = /run/lock/container6041.lock# Object Server replication settings[object6010]max connections = 25path = /srv/node1/read only = falselock file = /run/lock/object6010.lock[object6020]max connections = 25path = /srv/node2/read only = falselock file = /run/lock/object6020.lock[object6030]max connections = 25path = /srv/node3/read only = falselock file = /run/lock/object6030.lock[object6040]max connections = 25path = /srv/node4/read only = falselock file = /run/lock/object6040.lock

最后重新啟動服務完成rsync配置:

sudo service rsync restart
創(chuàng)建并編輯 /etc/swift/swift.conf文件,并寫入如下配置:

[swift-hash]# random unique string that can never change (DO NOT LOSE). I’m using 03c9f48da2229770.# od -t x8 -N 8 -A n <; /dev/random# The above command can be used to generate random a string.swift_hash_path_suffix = 03c9f48da2229770

配置Swift代理服務器

代理服務器是swift的門衛(wèi),它的職責是檢測合法性。它將審查:一、請求是否偽造,二、請求使用資源的用戶身份。具體操作由keystone之類的認證服務器來協(xié)助完成。

創(chuàng)建并編輯 /etc/swift/proxy-server.conf并增加如下內(nèi)容:

[DEFAULT]bind_port = 8080user = swiftswift_dir = /etc/swift[pipeline:main]# Order of execution of modules defined belowpipeline = catch_errors healthcheck cache authtoken keystone proxy-server[app:proxy-server]use = egg:swift#proxyallow_account_management = trueaccount_autocreate = trueset log_name = swift-proxyset log_facility = LOG_LOCAL0set log_level = INFOset access_log_name = swift-proxyset access_log_facility = SYSLOGset access_log_level = INFOset log_headers = Trueaccount_autocreate = True[filter:healthcheck]use = egg:swift#healthcheck[filter:catch_errors]use = egg:swift#catch_errors[filter:cache]use = egg:swift#memcacheset log_name = cache[filter:authtoken]paste.filter_factory = keystone.middleware.auth_token:filter_factoryauth_protocol = httpauth_host = 127.0.0.1auth_port = 35357auth_token = adminservice_protocol = httpservice_host = 127.0.0.1service_port = 5000admin_token = adminadmin_tenant_name = serviceadmin_user = swiftadmin_password = swiftdelay_auth_decision = 0[filter:keystone]paste.filter_factory = keystone.middleware.swift_auth:filter_factoryoperator_roles = admin, swiftoperatoris_admin = true

配置Swift賬戶服務器
默認swift容器服務配置文件為 /etc/swift/account-server.conf:

[DEFAULT]bind_ip = 0.0.0.0workers = 2[pipeline:main]pipeline = account-server[app:account-server]use = egg:swift#account[account-replicator][account-auditor][account-reaper]

所有的account server配置文件都在 /etc/swift/account-server目錄中。與 /srv里的設備相對應,我們創(chuàng)建1.conf、2.conf等等文件,并將它們放到/etc/swift/account-server/下。以下是/etc/swift/account-server/1.conf配置文件的內(nèi)容:

[DEFAULT]devices = /srv/node1mount_check = falsebind_port = 6012user = swiftlog_facility = LOG_LOCAL2[pipeline:main]pipeline = account-server[app:account-server]use = egg:swift#account[account-replicator]vm_test_mode = no[account-auditor][account-reaper]

對其它設備也是如此,比如/srv/node2、/srv/node3、/srv/node4等,我們分別創(chuàng)建2.conf,3.conf和4.conf與之對應。現(xiàn)在利用1.conf進行復制生成其余文件,并一一設置唯一的綁定端口及本地日志值:

sudo cp /etc/swift/account-server/1.conf /etc/swift/account-server/2.confsudo cp /etc/swift/account-server/1.conf /etc/swift/account-server/3.confsudo cp /etc/swift/account-server/1.conf /etc/swift/account-server/4.conf

注意:拷貝完成后,修改其中的設備地址和日志標志符。

配置Swift容器服務器

默認swift容器服務配置文件為 /etc/swift/container-server.conf:

[DEFAULT]bind_ip = 0.0.0.0workers = 2[pipeline:main]pipeline = container-server[app:container-server]use = egg:swift#container[container-replicator][container-updater][container-auditor][container-sync]

與account-server類似,我們同樣創(chuàng)建 /etc/swift/container-server/1.conf等等文件與 /srv設備匹配,這是1.conf文件內(nèi)容:

[DEFAULT]devices = /srv/node1mount_check = falsebind_port = 6011user = swiftlog_facility = LOG_LOCAL2[pipeline:main]pipeline = container-server[app:container-server]use = egg:swift#container[container-replicator]vm_test_mode = no[container-updater]

同Account一樣,需要為每一個設備準備一份配置。

配置Swift對象服務器,默認swift容器服務配置文件為 /etc/swift/object-server.conf:

[DEFAULT]bind_ip = 0.0.0.0workers = 2[pipeline:main]pipeline = object-server[app:object-server]use = egg:swift#object[object-replicator][object-updater][object-auditor]

與account-server和container-server一樣,我們同樣創(chuàng)建 /etc/swift/object-server/1.conf等等文件與 /srv設備匹配,這是1.conf文件內(nèi)容:

[DEFAULT]devices = /srv/node1mount_check = falsebind_port = 6010user = swiftlog_facility = LOG_LOCAL2[pipeline:main]pipeline = object-server[app:object-server]use = egg:swift#object[object-replicator]vm_test_mode = no[object-updater][object-auditor]

配置Swift Ring服務器
Ring是swift的一個極為重要的組件,它維護著對象的真實物理位置信息,對象的副本及多種設備。創(chuàng)建與對象服務、容器服務和賬戶服務相對應的ring-builder文件:

pushd /etc/swiftsudo swift-ring-builder object.builder create 18 3 1sudo swift-ring-builder container.builder create 18 3 1sudo swift-ring-builder account.builder create 18 3 1

注意:執(zhí)行以上命令時需要在 /etc/swift目錄下。
命令中的參數(shù)指定了分區(qū)、副本和小時的數(shù)量,用來限制分區(qū)多次移動??梢詤⒖糾an頁面中的swift-ring-builder獲取更多信息。

現(xiàn)在添加區(qū)域以均衡ring服務。命令格式如下:

swift-ring-builder <builder_file> add <zone>-<ip_address>:<port>/<device><weight>

執(zhí)行下列命令:

sudo swift-ring-builder object.builder add z1-127.0.0.1:6010/device 1sudo swift-ring-builder object.builder add z2-127.0.0.1:6020/device 1sudo swift-ring-builder object.builder add z3-127.0.0.1:6030/device 1sudo swift-ring-builder object.builder add z4-127.0.0.1:6040/device 1sudo swift-ring-builder object.builder rebalancesudo swift-ring-builder container.builder add z1-127.0.0.1:6011/device 1sudo swift-ring-builder container.builder add z2-127.0.0.1:6021/device 1sudo swift-ring-builder container.builder add z3-127.0.0.1:6031/device 1sudo swift-ring-builder container.builder add z4-127.0.0.1:6041/device 1sudo swift-ring-builder container.builder rebalancesudo swift-ring-builder account.builder add z1-127.0.0.1:6012/device 1sudo swift-ring-builder account.builder add z2-127.0.0.1:6022/device 1sudo swift-ring-builder account.builder add z3-127.0.0.1:6032/device 1sudo swift-ring-builder account.builder add z4-127.0.0.1:6042/device 1sudo swift-ring-builder account.builder rebalance

到此,所有的配置也就完成了,注意所有以上涉及修改的文件或者目錄,都需要將文件的屬主設定為swift和swift用戶組。

啟動Swift服務,使用以下命令啟動swift和REST API:

sudo swift-init main startsudo swift-init rest start

到此,所有的Swift配置就已經(jīng)做完了。

現(xiàn)在Swift已經(jīng)是可以正常工作的了,但是目前系統(tǒng)里面是沒有任何賬號和容器的,不能上傳對象。

需要使用Keystone的客戶端來創(chuàng)建賬號。

對于Keystone有幾個概念:tenant,user,role,service,endpoint,對于這些概念,可以參考其他文章的介紹。這里tenant對于swift來說是account,只有有了account才能創(chuàng)建container,user是身份,user有用戶名和密碼,role可以認為是組隊概念。endpoint是服務入口,是需要和service以及tenant綁定的。下面在Keystone上面一一創(chuàng)建這些實體:

#創(chuàng)建兩個租戶,對于Swift也就是兩個accountkeystone tenant-create --name servicekeystone tenant-create --name account2#創(chuàng)建一個用戶,用戶名和密碼都是swiftkeystone user-create --name swift --pass swift --email swift@shentar.mekeystone user-create --name shentar --pass shentar --email shentar@shentar.me#創(chuàng)建一個角色keystone role-create --name admin#創(chuàng)建兩個服務,一個是keystone,另外一個是swift。keystone service-create --name swift --type object-store --description 'OpenStack Storage Service'keystone service-create --name keystone --type identity --description 'OpenStack Identity Service'列舉以上各個實體:root@u1:~# keystone user-list+----------------------------------+---------+--------------------+---------+| id | enabled | email | name |+----------------------------------+---------+--------------------+---------+| 492e829f4520429b950a3a7fbe4ae6eb | True | swift@shentar.me | swift || 914ec3cd303b4571b0dbaea1f9a0546e | True | shentar@shentar.me | shentar |+----------------------------------+---------+--------------------+---------+root@u1:~# keystone role-list+----------------------------------+-------+| id | name |+----------------------------------+-------+| 031e54d7c9d34f0fad667f423387c354 | admin |+----------------------------------+-------+root@u1:~# keystone tenant-list+----------------------------------+----------+---------+| id | name | enabled |+----------------------------------+----------+---------+| 665e59b3d6c240e8a66dbabe3ac2259d | account2 | True || d2d8fc718cde4a9e9f6d7175313efad0 | service | True |+----------------------------------+----------+---------+root@u1:~# keystone service-list+----------------------------------+----------+--------------+----------------------------+| id | name | type | description |+----------------------------------+----------+--------------+----------------------------+| 8906dfcdefa14e6388edb0e3ad264b29 | keystone | identity | OpenStack Identity Service || d01427a1449d469482798971a88bb92f | swift | object-store | OpenStack Storage Service |+----------------------------------+----------+--------------+----------------------------+#為兩個服務創(chuàng)建endpoint,注意swift服務的endpoint需要AUTH_34fb2227caae4edcb052ebec7cc78abe以這樣的內(nèi)容作為后綴,其中AUTH_后面的是tenant_id,注意到是下面的id需要以自己系統(tǒng)生成的為準,照搬這里的命令肯定會出錯。keystone endpoint-create --region myregion --service_id 8906dfcdefa14e6388edb0e3ad264b29 --publicurl 'http://192.168.1.109:5000/v2.0' --adminurl 'http://192.168.1.109:35357/v2.0' --internalurl 'http://192.168.1.109:5000/v2.0'keystone endpoint-create --region myregion --service_id d01427a1449d469482798971a88bb92f --publicurl 'http://192.168.1.109:8080/v1/AUTH_665e59b3d6c240e8a66dbabe3ac2259d' --adminurl 'http://192.168.1.109:8080/v1' --internalurl 'http://192.168.1.109:8080/v1/AUTH_665e59b3d6c240e8a66dbabe3ac2259d'keystone endpoint-create --region myregion --service_id d01427a1449d469482798971a88bb92f --publicurl 'http://192.168.1.109:8080/v1/AUTH_d2d8fc718cde4a9e9f6d7175313efad0' --adminurl 'http://192.168.1.109:8080/v1' --internalurl 'http://192.168.1.109:8080/v1/AUTH_d2d8fc718cde4a9e9f6d7175313efad0'#將用戶加入到租戶中,一個用戶只能加入到一個租戶中。將swift用戶加入到service租戶中:keystone user-role-add --user 492e829f4520429b950a3a7fbe4ae6eb --role 031e54d7c9d34f0fad667f423387c354 --tenant_id d2d8fc718cde4a9e9f6d7175313efad0#將shentar用戶也加入到service租戶中:keystone user-role-add --user 914ec3cd303b4571b0dbaea1f9a0546e --role 031e54d7c9d34f0fad667f423387c354 --tenant_id d2d8fc718cde4a9e9f6d7175313efad0

這樣就可以使用用戶名和密碼獲取token和訪問的url了:

swift -v -V 2.0 -A http://192.168.1.109:5000/v2.0/ -U service:swift -K swift stat
這條命令返回的是swift租戶在service租戶下的token和訪問的url。

同樣的

swift -v -V 2.0 -A http://192.168.1.109:5000/v2.0/ -U service:shentar -K shentar stat
返回的是shentar用戶的。
接下來就可以使用上面獲取到的token和url來發(fā)送REST HTTP請求了:

root@u1:~# curl -X PUThttp://192.168.1.109:8080/v1/AUTH_d2d8fc718cde4a9e9f6d7175313efad0/testcontainer -H "X-Auth-Token: 63de715ee3a04b669e021ee3bc333433"201 Createdroot@u1:~# curl -i -X HEAD http://192.168.1.109:8080/v1/AUTH_d2d8fc718cde4a9e9f6d7175313efad0/ -H "X-Auth-Token: 63de715ee3a04b669e021ee3bc333433"HTTP/1.1 204 No ContentX-Account-Object-Count: 0X-Account-Bytes-Used: 0X-Account-Container-Count: 1Accept-Ranges: bytesContent-Length: 0X-Trans-Id: txbfdff903df11407895042f1ec8e95299Date: Fri, 21 Mar 2014 16:12:59 GMT

到此整個Swift和Keystone也就安裝完成了。

文章來源:http://shentar.me/swift-和-keystone單機安裝總結/
文章作者:童燕群

0 
本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Openstack All in One @ centos6.3 install guide
Swift錯誤
基于開源軟件的私有云計算平臺構建
OpenStack Keystone的基本概念理解
免費OpenStack私有云
Openstack?Keystone?dashboard?swift?AllInOne
更多類似文章 >>
生活服務
熱點新聞
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服