Google Strage を CentOSで利用してみる(お試し版)
GoogleIO2010で発表されたGoogle Storageですが、利用できるようになったので試してみました。
気になるお値段
※他を使っているわけでは無いので、詳しくは語れませんが、Amazon S3よりもちょっと高いけど、1ファイルあたりの制限が無いのは良いとかそんな感じ?
でもプレビューの間は容量 100G 通信量 月300Gまでは無料なそうな。
これは使ってみるしか無いと思いつかってみました。
とりあえずエントリページから申し込んで、(だいぶ待たされました)
使えるようになると、このような
Google Storage ManagerといったWeb版の管理ツールが使えるようになっていました。
ChromeとかだとドラッグでBucket(フォルダ的な物?)にアップロード出来たりするようです。
Windowsでフォルダぶち込んでみたのですが、アップロードされたファイルはディレクトリセパレータが違うのか上のような感じになって、ちょっと戸惑いがち。
他にもgsutilというpythonのコマンドが一応用意されていて、それを使ってGS上にbacketの作成やローカルサーバー上からのファイルコピーとかできるようになっています。
gsutiを初めて使うときにアクセスキーと秘密鍵を要求してくるので、ここで鍵を作成しておく必要があります。
あとは
> gsutil mb gs://new1
とかでbacket作成(使えない名前とかも有る?)
> gsutil cp /tmp/pgdump.sql gs://new1/pgdump.sql
でファイルコピーとかが出来ました。
※ただ今メインで利用しているOSがCentOS5.3な事もあり、
それに入っているPythonが2.4なのでそのままでは使えなかったりして、ちょっとはまった。
gsutil の 1127行目あたり
⇒でもGAEを使うことも鑑みて、Python2.5系に上げたほうが幸せかも。
悩みどころ
(参考)
gsutilのオプション
SYNOPSIS
gsutil [-d] [-h header]... command args
-d option shows HTTP protocol detail.
-h option allows you to specify additional HTTP headers, for example:
gsutil -h "Cache-Control:public,max-age=3600" -h "Content-Type:gzip" cp * gs://bucket
Commands:
Concatenate object content to stdout:
cat [-h] uri...
-h Prints short header for each object.
Copy objects:
cp [-a canned_acl] [-t] [-z ext1,ext2,...] src_uri dst_uri
- or -
cp [-a canned_acl] [-t] [-z extensions] uri... dst_uri
-a Sets named canned_acl when uploaded objects created (list below).
-t Sets MIME type based on file extension.
-z 'txt,html' Compresses file uploads with the given extensions.
Get ACL XML for a bucket or object (save and edit for "setacl" command):
getacl uri
List buckets or objects:
ls [-l] uri...
-l Prints long listing.
Make buckets:
mb uri...
Move/rename objects:
mv src_uri dst_uri
- or -
mv uri... dst_uri
Remove buckets:
rb uri...
Remove objects:
rm uri...
Set ACL on buckets and/or objects:
setacl file-or-canned_acl_name uri...
Omitting URI scheme defaults to "file". For example, "dir/file.txt" is
equivalent to "file://dir/file.txt"
URIs support object name wildcards, for example:
gsutil cp gs://mybucket/[a-f]*.doc localdir
Source directory or bucket names are implicitly wildcarded, so
gsutil cp localdir gs://mybucket
will recursively copy localdir.
canned_acl_name can be one of: "public-read", "public-read-write",
"authenticated-read", "bucket-owner-read", "bucket-owner-full-control"
気になるお値段
- Storage—$0.17/gigabyte/month
- Network
- Upload data to Google
- $0.10/gigabyte
- Download data from Google
- $0.15/gigabyte for Americas and EMEA
- $0.30/gigabyte for Asia-Pacific
- Upload data to Google
- Requests
- PUT, POST, LIST—$0.01 per 1,000 requests
- GET, HEAD—$0.01 per 10,000 requests
※他を使っているわけでは無いので、詳しくは語れませんが、Amazon S3よりもちょっと高いけど、1ファイルあたりの制限が無いのは良いとかそんな感じ?
でもプレビューの間は容量 100G 通信量 月300Gまでは無料なそうな。
これは使ってみるしか無いと思いつかってみました。
とりあえずエントリページから申し込んで、(だいぶ待たされました)
使えるようになると、このような
Google Storage ManagerといったWeb版の管理ツールが使えるようになっていました。
ChromeとかだとドラッグでBucket(フォルダ的な物?)にアップロード出来たりするようです。
Windowsでフォルダぶち込んでみたのですが、アップロードされたファイルはディレクトリセパレータが違うのか上のような感じになって、ちょっと戸惑いがち。
他にもgsutilというpythonのコマンドが一応用意されていて、それを使ってGS上にbacketの作成やローカルサーバー上からのファイルコピーとかできるようになっています。
gsutiを初めて使うときにアクセスキーと秘密鍵を要求してくるので、ここで鍵を作成しておく必要があります。
あとは
> gsutil mb gs://new1
とかでbacket作成(使えない名前とかも有る?)
> gsutil cp /tmp/pgdump.sql gs://new1/pgdump.sql
でファイルコピーとかが出来ました。
※ただ今メインで利用しているOSがCentOS5.3な事もあり、
それに入っているPythonが2.4なのでそのままでは使えなかったりして、ちょっとはまった。
gsutil の 1127行目あたり
if float('%d.%d%d'
%(sys.version_info[0], sys.version_info[1], sys.version_info[2])
) < 2.51:を無理やり2.4に置き換えてみたところ動くことは確認。
⇒でもGAEを使うことも鑑みて、Python2.5系に上げたほうが幸せかも。
悩みどころ
(参考)
gsutilのオプション
SYNOPSIS
gsutil [-d] [-h header]... command args
-d option shows HTTP protocol detail.
-h option allows you to specify additional HTTP headers, for example:
gsutil -h "Cache-Control:public,max-age=3600" -h "Content-Type:gzip" cp * gs://bucket
Commands:
Concatenate object content to stdout:
cat [-h] uri...
-h Prints short header for each object.
Copy objects:
cp [-a canned_acl] [-t] [-z ext1,ext2,...] src_uri dst_uri
- or -
cp [-a canned_acl] [-t] [-z extensions] uri... dst_uri
-a Sets named canned_acl when uploaded objects created (list below).
-t Sets MIME type based on file extension.
-z 'txt,html' Compresses file uploads with the given extensions.
Get ACL XML for a bucket or object (save and edit for "setacl" command):
getacl uri
List buckets or objects:
ls [-l] uri...
-l Prints long listing.
Make buckets:
mb uri...
Move/rename objects:
mv src_uri dst_uri
- or -
mv uri... dst_uri
Remove buckets:
rb uri...
Remove objects:
rm uri...
Set ACL on buckets and/or objects:
setacl file-or-canned_acl_name uri...
Omitting URI scheme defaults to "file". For example, "dir/file.txt" is
equivalent to "file://dir/file.txt"
URIs support object name wildcards, for example:
gsutil cp gs://mybucket/[a-f]*.doc localdir
Source directory or bucket names are implicitly wildcarded, so
gsutil cp localdir gs://mybucket
will recursively copy localdir.
canned_acl_name can be one of: "public-read", "public-read-write",
"authenticated-read", "bucket-owner-read", "bucket-owner-full-control"

コメント
コメントを投稿