Presentation is loading. Please wait.

Presentation is loading. Please wait.

Swift の機能・利用方法の説明 北陸先端科学技術大学院大学 松井 大輔 一般社団法人クラウド利用促進機構 (CUPA) 荒井 康宏.

Similar presentations


Presentation on theme: "Swift の機能・利用方法の説明 北陸先端科学技術大学院大学 松井 大輔 一般社団法人クラウド利用促進機構 (CUPA) 荒井 康宏."— Presentation transcript:

1 Swift の機能・利用方法の説明 北陸先端科学技術大学院大学 松井 大輔 一般社団法人クラウド利用促進機構 (CUPA) 荒井 康宏

2 自己紹介 名前:松井大輔 – スポーツ選手ではありません – そんな名前で大丈夫か? 職業:学生 – 修士課程を修了済み – 現在研究生 研究分野 – クラウド関連 Swift 、 OpenNebula – テストベッド StarBED 、 PlanetLab その他 –Twitter: @nanodayo – ブログ : http://nanodayo.com/http://nanodayo.com/

3 Swift の概要 分散オブジェクトストレージ – ファイルのダウンロード / アップロードが可能 元々は RackSpace の Cloud Files サービス –OSS 化 Amazon S3 に相当 大容量のファイルを想定 – バックアップ – メールデータ –VM イメージ – 最大 5GB のファイル – テラバイト・ペタバイトを想定 複数台のサーバで構築 – 規模拡張 容量の増設 – 冗長化 – 一般的な性能の PC を想定 動的にサーバを追加可能 Server File

4 サーバの拡張・冗長化

5 FTP の場合の規模拡張・冗長化 FTP Server NFS Server FTP Server NFS Server クライアン ト ミラーサーバを構築する方法 rsync で同期 FTP Server NFS Server rsync で同期 NFS で容量増設 × クライアントが 他のサーバを選択 NFS で容量増設 NFS Server NFS で容量増設

6 FTP の場合の規模拡張・冗長化 (2) クライアン ト Load Balancer を利用する方法 × Load Balancer FTP Server NFS Server FTP Server NFS Server FTP Server NFS Server NFS で容量増設 NFS Server NFS で容量増設 rsync で同期

7 増設・冗長化しやすい構造 クライアン ト Load Balancer FTP Server rsync で同期 × FTP Server rsync で同期 FTP Server サーバを追加して 容量増設 目的のファイルに合わせて サーバ選択 クラスタに分けて冗長化 FTP Server 交換などの構成変更 増設後のファイル分配 増設後のクラスタ再構築

8 リクエストの仲介 ユーザ認証 Proxy Server の URL を通知 Token の発行 ファイルを保存 ディレクトリを保存 アカウントを保存 互いに設定ファイルで指 定 Swift を構成するサーバ群 クライアン ト 各サーバは Ring ファイルで指 定 Container Rings Object Rings Account Rings Object Server のリス ト Container Server のリスト Account Server のリス ト クライアントは Proxy Server と通信 Auth Server Account Server Container Server Object Server Container Server Account Server Proxy Server

9 Auth Server Proxy Server Account Server Container Server Object Server Container Server Account Server リクエストの仲介 ファイルを保存 ディレクトリを保存 アカウントを保存 Swift の場合の規模拡張・冗長化 クライアン ト サーバを増やして Ring を更新する PUT の段階で冗長化 Object Rings Account Rings Object Server のリス ト Container Server のリスト Account Server のリス ト クライアントは Proxy Server と通信 Object Server Container Server Account Server Container Rings

10 Ring ファイル Object/Container/Account Server のリスト –Proxy Server がこれらのサーバを参照するのに使用 –Replicator なども使用 Ring に含まれる情報 – サーバのアドレス・ポート –Replica の数 –Zone Replication に影響 コマンドで作成・変更 –swift-ring-builder サーバを動的に追加可能 Object Server zone1 zone2 2 replicas, 2 zones, 4 devices, … zone1-192.168.100.1:6020 … zone1-192.168.100.2:6020 … zone2-192.168.200.1:6020 … zone2-192.168.200.2:6020 … ・・・ replicator で同期

11 Swift の利用方法 サーバ – 発表では割愛 –Eucalyptus Wiki に設定方法などを記載 Swift のインストール 設定ファイルと Ring ファイルを作成 サーバプログラムの実行 構築用スクリプトも掲載 今回ボツになったネタも掲載予定 クライアント –CloudFiles 対応クライアントが必要 GUI は現行 CyberDuck のみ CloudFiles API Library あり – 頑張れば curl でも可能 大丈夫だ、問題ない そんなクライアント で 大丈夫か?

12 クライアントからの利用方法

13 Cloud Files プロトコル RackSpace でも使用 HTTP ベース – メッセージの種類は 4 つ HEAD, GET, PUT, DELETE –SSL 対応可能 用語・制約 – ファイルは object – ディレクトリは container –Object は Container の中にしか作れない –Container の中に Container は作れない –http:// : / / / CyberDuck が CloudFiles プロトコルに対応

14 CyberDuck GUI のファイル転送クライアント 様々なプロトコルに対応 –FTP 、 FTPS 、 SFTP 、 Amazon S3 などなど Mac では人気のクライアント Windows 版も Private Beta で配布

15 CyberDuck からの Swift 利用 サーバのアドレスを変更できない orz

16 CyberDuck からの利用 (2) Mac の場合 –defaults コマンドで設定するとサーバを変更可 能 # defaults write ch.sudo.cyberduck protocol.cf.swift.enable true 変更しても接続できず orz – 調査中 Windows の場合 –Defaults コマンドに相当する設定はできない –CyberDuck のヘルプによると変えられないら しい あぁ、やっぱり Windows は駄目だった よ あいつは設定を聞かないからね

17 curl からの利用 事前準備 –Auth Server 上でアカウントを作成 swift-auth-add-user コマンド # swift-auth-add-user –K –a 実行例: # swift-auth-add-user –K devauth –a test tester testing 認証 –# curl -v -H 'X-Storage-User: test:tester‘ -H 'X-Storage-Pass: testing‘ http://127.0.0.1:11000/v1.0

18 認証の結果 # curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:11000/v1.0 * about to connect() to 127.0.0.1 port 11000 (#0) * Trying 127.0.0.1... connected * Connected to 127.0.0.1 (127.0.0.1) port 11000 (#0) > GET /v1.0 HTTP/1.1 > User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 > Host: 127.0.0.1:11000 > Accept: */* > X-Storage-User: test:tester > X-Storage-Pass: testing > < HTTP/1.1 204 No Content < X-Storage-Url: http://127.0.0.1:8080/v1/AUTH_8023b2fd83f34c34b8e799a7249fe9aa < X-Storage-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5 < X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5 < Content-Length: 0 < Date: Wed, 01 Sep 2010 00:07:13 GMT < * Connection #0 to host 127.0.0.1 left intact * Closing connection #0 これらの値を控え る

19 curl からの PUT の方法 認証時に控えた値を指定する –X-Storage-Url –X-Auth-Token ディレクトリ作成 –# curl -X PUT -v -H ‘X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5 ‘ http://127.0.0.1:8080/v1/AUTH_8023b2fd83f34c34b8e799a7249fe9a a/aaaa ファイルアップロード –# curl -X PUT -T test -v -H 'X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5‘ http://127.0.0.1:8080/v1/AUTH_8023b2fd83f34c34b8e799a7249fe9a a/aaaa

20 PUT の結果 ( ディレクトリ ) # curl -X PUT -v -H 'X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5' http://127.0.0.1:8080/v1/AUTH_8023b2fd83f34c34b8e799a7249fe9aa/aaaa * About to connect() to 127.0.0.1 port 8080 (#0) * Trying 127.0.0.1... connected * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > PUT /v1/AUTH_8023b2fd83f34c34b8e799a7249fe9aa/aaaa HTTP/1.1 > User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 > Host: 127.0.0.1:8080 > Accept: */* > X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5 > < HTTP/1.1 201 Created < Content-Length: 18 < Content-Type: text/plain; charset=UTF-8 < Date: Mon, 15 Nov 2010 06:39:52 GMT < 201 Created * Connection #0 to host 127.0.0.1 left intact * Closing connection #0

21 PUT の結果前半(ファイル) # curl -X PUT -T test -v -H 'X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5‘ http://127.0.0.1:8080/v1/AUTH_8023b2fd 83f34c34b8e799a7249fe9aa/aaaa * About to connect() to 127.0.0.1 port 8080 (#0) * Trying 127.0.0.1... connected * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > PUT /v1/AUTH_8023b2fd83f34c34b8e799a7249fe9aa/aaaa/test HTTP/1.1 > User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 > Host: 127.0.0.1:8080 > Accept: */* > X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5 > Content-Length: 45 > Expect: 100-continue > 後半に続く

22 PUT の結果後半(ファイル) < HTTP/1.1 100 Continue < HTTP/1.1 201 Created < Content-Length: 118 < Content-Type: text/plain; charset=UTF-8 < Etag: 922c0f15457dfc631ae9ff06abd1bc82 < Last-Modified: Mon, 15 Nov 2010 06:45:17 GMT < Date: Mon, 15 Nov 2010 06:45:18 GMT < 201 Created 201 Created * Connection #0 to host 127.0.0.1 left intact * Closing connection #0

23 curl からの GET の方法 認証時に控えた値を指定する –X-Auth-Token –X-Storage-Url –PUT と同様 ファイルでもディレクトリでも同様 (URL の違いの み ) –# curl -X GET -v -H ‘X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5 ‘ http://127.0.0.1:8080/v1/AUTH_8023b2fd83f34c34b8e799a7249fe9a a/aaaa –# curl -X GET -v -H ‘X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5 ‘ http://127.0.0.1:8080/v1/AUTH_8023b2fd83f34c34b8e799a7249fe9a a/aaaa/test

24 GET の結果 ( ディレクトリ ) # curl -X GET -v -H 'X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5' http://127.0.0.1:8080/v1/AUTH_8023b2fd83f34c34b8e799a7249fe9aa/aaaa * About to connect() to 127.0.0.1 port 8080 (#0) * Trying 127.0.0.1... connected * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > GET /v1/AUTH_8023b2fd83f34c34b8e799a7249fe9aa/aaaa HTTP/1.1 > User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 > Host: 127.0.0.1:8080 > Accept: */* > X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5 > < HTTP/1.1 200 OK < X-Container-Object-Count: 1 < X-Container-Bytes-Used: 45 < Content-Length: 5 < Content-Type: text/plain; charset=utf8 < Date: Mon, 15 Nov 2010 06:48:38 GMT < test * Connection #0 to host 127.0.0.1 left intact * Closing connection #0 ファイル一覧が表示される

25 GET の結果(ファイル) # curl -X GET -v -H 'X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5' http://127.0.0.1:8080/v1/AUTH_8023b2fd83f34c34b8e799a7249fe9aa/aaaa/test * About to connect() to 127.0.0.1 port 8080 (#0) * Trying 127.0.0.1... connected * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > GET /v1/AUTH_8023b2fd83f34c34b8e799a7249fe9aa/aaaa/test HTTP/1.1 > User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 > Host: 127.0.0.1:8080 > Accept: */* > X-Auth-Token: AUTH_tkc01a591b5cb140ed9b2377256c87f8c5 > < HTTP/1.1 200 OK < Last-Modified: Mon, 15 Nov 2010 06:45:17 GMT < Etag: 922c0f15457dfc631ae9ff06abd1bc82 < Content-Length: 45 < Content-Type: application/octet-stream < Date: Mon, 15 Nov 2010 06:50:51 GMT < オトートノ カタキヲ トルノデス * Connection #0 to host 127.0.0.1 left intact * Closing connection #0 ファイルの中身が表示される

26 Cloud Files API RackSpace が公開 –http://www.rackspacecloud.com/cloud_hostin g_products/files/apihttp://www.rackspacecloud.com/cloud_hostin g_products/files/api Github にもあり 対応している言語 –PHP –Python –Ruby –Java –.NET(C#) 一番いいクライアントを 頼む

27 まとめ Swift の機能と概要 –Auth Server –Proxy Server –Object Server –Container Server –Account Server 動的にサーバを追加可能 – 容量の増設 – 冗長化 サーバの構築方法 – 詳しくは Wiki に クライアントからの利用 –CyberDuck からはまだ繋げず –curl でも一応可能 Wiki に curl 用スクリプトも記載 –API あり 大丈夫だ、 (Swift はきっと ) 問題な い そうだな、次はこれを見ている人 にも 手伝ってもらおうかな

28 おわりに 資料置き場 –http://eucalyptus.linux4u.jp/wiki/index.php?Swift/ 概要 Eucalyputas Wiki の Swift/ 概要のページ – インストール・設定方法など –Eucalyputs 日本語 Wiki に記載 –http://eucalyptus.linux4u.jp/wiki/http://eucalyptus.linux4u.jp/wiki/ CloudFiles –http://tech-rumble.blogspot.com/2009/08/rackspace- cloudfiles.htmlhttp://tech-rumble.blogspot.com/2009/08/rackspace- cloudfiles.html CloudFiles API –http://www.rackspacecloud.com/cloud_hosting_products/files/apihttp://www.rackspacecloud.com/cloud_hosting_products/files/api CyberDuck –http://cyberduck.ch/http://cyberduck.ch/

29 おわりに ( のおまけ ) 今回没になったネタ – 各種サーバの設定 –Swift のメッセージの流れ エルシャダイ –http://elshaddai.jp/http://elshaddai.jp/ エルシャダイ Wiki –http://www16.atwiki.jp/enoch/pages/1.htmlhttp://www16.atwiki.jp/enoch/pages/1.html – セリフ集

30 通知する URL を変える ファイルを保存 ディレクトリを保存 アカウントを保存 Proxy Server の冗長化 クライアン ト Container Rings Object Rings Account Rings Object Server のリス ト Container Server のリスト Account Server のリス ト Auth Server Account Server Container Server Object Server Container Server Account Server Proxy Server


Download ppt "Swift の機能・利用方法の説明 北陸先端科学技術大学院大学 松井 大輔 一般社団法人クラウド利用促進機構 (CUPA) 荒井 康宏."

Similar presentations


Ads by Google