FTP2 NFS FTP Server Load Balancer rsync NFS
FTPの場合の規模拡張・冗長化(2) NFSで容量増設 FTP Server Load Balancer クライアント × rsyncで同期 NFS Server NFSで容量増設 FTP Server Load Balancerを利用する方法 NFS Server NFSで容量増設 NFS Server
Swiftを構成するサーバ群 ファイルを保存 ユーザ認証 Proxy ServerのURLを通知 Tokenの発行 Object Server Auth Server Object Server ディレクトリを保存 互いに設定ファイルで指定 Container Server Proxy Server クライアント Container Server クライアントは リクエストの仲介 Proxy Serverと通信 Object Rings Container Rings Object Container Serverのリスト アカウントを保存 Account Rings Account Serverのリスト Account Server 各サーバはRingファイルで指定
Swiftの場合の規模拡張・冗長化 ファイルを保存 Object Server Auth Server Object Server ディレクトリを保存 Container Server Proxy Server クライアントは Proxy Serverと通信 Container Server リクエストの仲介 アカウントを保存 Object Rings Container Rings Object Container Serverのリスト Account Rings Account Serverのリスト Account Server サーバを増やしてRingを更新する PUTの段階で冗長化 Account Server
Ringファイル • Object/Container/Account Serverのリスト – Proxy Serverがこれらのサーバを参照するのに使用 – Replicatorなども使用 2 replicas, 2 zones, 4 devices, … • Ringに含まれる情報 – サーバのアドレス・ポート – Replicaの数 – Zone • Replicationに影響 • コマンドで作成・変更 – swift-ring-builder • サーバを動的に追加可能 zone 1 -192. 168. 100. 1: 6020 … zone 1 -192. 168. 100. 2: 6020 … zone 2 -192. 168. 200. 1: 6020 … zone 2 -192. 168. 200. 2: 6020 … ・・・ zone 1 Object Server zone 2 Object Server replicatorで同期 Object Server
Cloud Filesプロトコル • Rack. Spaceでも使用 • HTTPベース – メッセージの種類は 4つ • HEAD, GET, PUT, DELETE – SSL対応可能 • 用語・制約 – – – ファイルはobject ディレクトリはcontainer ObjectはContainerの中にしか作れない Containerの中にContainerは作れない http: //<Server>: <port>/<X-Storage-Url>/<container>/<object> • Cyber. DuckがCloud. Filesプロトコルに対応
curlからの利用 • 事前準備 – Auth Server上でアカウントを作成 • swift-auth-add-userコマンド • # swift-auth-add-user –K <adkey> –a <account> <user> <pass> • 実行例:# swift-auth-add-user –K devauth –a tester testing • 認証 – # curl -v -H 'X-Storage-User: tester‘ -H 'X-Storage-Pass: testing‘ http: //127. 0. 0. 1: 11000/v 1. 0
認証の結果 # curl -v -H 'X-Storage-User: tester' -H 'X-Storage-Pass: testing' http: //127. 0. 0. 1: 11000/v 1. 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 /v 1. 0 HTTP/1. 1 > User-Agent: curl/7. 19. 7 (i 486 -pc-linux-gnu) libcurl/7. 19. 7 Open. SSL/0. 9. 8 k zlib/1. 2. 3. 3 libidn/1. 15 > Host: 127. 0. 0. 1: 11000 > Accept: */* > X-Storage-User: tester > X-Storage-Pass: testing > < HTTP/1. 1 204 No Content < X-Storage-Url: http: //127. 0. 0. 1: 8080/v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa < X-Storage-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5 < X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5 < 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
curlからのPUTの方法 • 認証時に控えた値を指定する – X-Storage-Url – X-Auth-Token • ディレクトリ作成 – # curl -X PUT -v -H ‘X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5 ‘ http: //127. 0. 0. 1: 8080/v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa /aaaa • ファイルアップロード – # curl -X PUT -T test -v -H 'X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5‘ http: //127. 0. 0. 1: 8080/v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa /aaaa
PUTの結果(ディレクトリ) # curl -X PUT -v -H 'X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5' http: //127. 0. 0. 1: 8080/v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa/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 /v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa/aaaa HTTP/1. 1 > User-Agent: curl/7. 19. 7 (i 486 -pc-linux-gnu) libcurl/7. 19. 7 Open. SSL/0. 9. 8 k zlib/1. 2. 3. 3 libidn/1. 15 > Host: 127. 0. 0. 1: 8080 > Accept: */* > X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5 > < 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
PUTの結果前半(ファイル) # curl -X PUT -T test -v -H 'X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5‘ http: //127. 0. 0. 1: 8080/v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa/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 /v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa/aaaa/test HTTP/1. 1 > User-Agent: curl/7. 19. 7 (i 486 -pc-linux-gnu) libcurl/7. 19. 7 Open. SSL/0. 9. 8 k zlib/1. 2. 3. 3 libidn/1. 15 > Host: 127. 0. 0. 1: 8080 > Accept: */* > X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5 > Content-Length: 45 > Expect: 100 -continue > 後半に続く
PUTの結果後半(ファイル) < HTTP/1. 1 100 Continue < HTTP/1. 1 201 Created < Content-Length: 118 < Content-Type: text/plain; charset=UTF-8 < Etag: 922 c 0 f 15457 dfc 631 ae 9 ff 06 abd 1 bc 82 < Last-Modified: Mon, 15 Nov 2010 06: 45: 17 GMT < Date: Mon, 15 Nov 2010 06: 45: 18 GMT < <html> <head> <title>201 Created</title> </head> <body> <h 1>201 Created</h 1> </body> * Connection #0 to host 127. 0. 0. 1 left intact * Closing connection #0
curlからのGETの方法 • 認証時に控えた値を指定する – X-Auth-Token – X-Storage-Url – PUTと同様 • ファイルでもディレクトリでも同様(URLの違いのみ) – # curl -X GET -v -H ‘X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5 ‘ http: //127. 0. 0. 1: 8080/v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa /aaaa/test
GETの結果(ディレクトリ) # curl -X GET -v -H 'X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5' http: //127. 0. 0. 1: 8080/v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa/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 /v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa/aaaa HTTP/1. 1 > User-Agent: curl/7. 19. 7 (i 486 -pc-linux-gnu) libcurl/7. 19. 7 Open. SSL/0. 9. 8 k zlib/1. 2. 3. 3 libidn/1. 15 > Host: 127. 0. 0. 1: 8080 > Accept: */* > X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5 > < HTTP/1. 1 200 OK < X-Container-Object-Count: 1 < X-Container-Bytes-Used: 45 < Content-Length: 5 < Content-Type: text/plain; charset=utf 8 < Date: Mon, 15 Nov 2010 06: 48: 38 GMT < test * Connection #0 to host 127. 0. 0. 1 left intact * Closing connection #0 ファイル一覧が表示される
GETの結果(ファイル) # curl -X GET -v -H 'X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5' http: //127. 0. 0. 1: 8080/v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa/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 /v 1/AUTH_8023 b 2 fd 83 f 34 c 34 b 8 e 799 a 7249 fe 9 aa/aaaa/test HTTP/1. 1 > User-Agent: curl/7. 19. 7 (i 486 -pc-linux-gnu) libcurl/7. 19. 7 Open. SSL/0. 9. 8 k zlib/1. 2. 3. 3 libidn/1. 15 > Host: 127. 0. 0. 1: 8080 > Accept: */* > X-Auth-Token: AUTH_tkc 01 a 591 b 5 cb 140 ed 9 b 2377256 c 87 f 8 c 5 > < HTTP/1. 1 200 OK < Last-Modified: Mon, 15 Nov 2010 06: 45: 17 GMT < Etag: 922 c 0 f 15457 dfc 631 ae 9 ff 06 abd 1 bc 82 < 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 ファイルの中身が表示される
Cloud Files API • Rack. Spaceが公開 – http: //www. rackspacecloud. com/cloud_hosting _products/files/api • Githubにもあり • 対応している言語 – PHP – Python – Ruby – Java –. NET(C#) 一番いいクライアントを頼む
おわりに • 資料置き場 – http: //eucalyptus. linux 4 u. jp/wiki/index. php? Swift/概要 • Eucalyputas WikiのSwift/概要のページ – インストール・設定方法など – Eucalyputs 日本語 Wikiに記載 – http: //eucalyptus. linux 4 u. jp/wiki/ • Cloud. Files – http: //tech-rumble. blogspot. com/2009/08/rackspacecloudfiles. html • Cloud. Files API – http: //www. rackspacecloud. com/cloud_hosting_products/files/api • Cyber. Duck – http: //cyberduck. ch/
- Slides: 29