gluster objectストレージを試してみた

Glusterfsではバージョン3.3以降でHTTPで読み書きが出来る機能(Objectストレージ, 以下UFO) が追加されている。
これについて、Scientific linux 6.3 + glusterfs 3.3.1 (ノード名: scfc-virt2)で確認した。

基本的には本家(?)の記事が参考になるが、パッケージ置き場の追加は手動で行う必要があるので注意。
https://access.redhat.com/site/documentation/en-US/Red_Hat_Storage/2.0/html/Administration_Guide/chap-User_Guide-UFO.html

パッケージ置き場としては、こちらを使用した。
http://download.gluster.org/pub/gluster/glusterfs/3.3/3.3.1/EPEL.repo/glusterfs-epel.repo

パッケージインストール

yum install glusterfs-server glusterfs-swift glusterfs-swift-proxy glusterfs-swift-account glusterfs-swift-container glusterfs-swift-object glusterfs-swift-plugin
※ swift関連のパッケージは全てインストールしないと上手く動作しないので注意

ボリューム作成

まずボリュームを作成する。ボリューム名は後で使用するUFOの設定と合わせる必要があるので注意。(ここでは"test"を使用)

service glusterd start
mkdir /root/glusterfs/
cd /root/glusterfs/
mkdir test
gluster volume create test scfc-virt2:/root/glusterfs/test/
gluster volume list
gluster volume start test
mount -t glusterfs localhost:/test /mnt/
ls /mnt/
umount /mnt

Swift部分の設定変更

まずSSL設定とユーザー設定を実施した。(SSL設定はオプションと思われる)

/etc/swift以下のdiff はこちらになる。

 diff --git a/proxy-server.conf b/proxy-server.conf
 index 1fcde8e..61e14d0 100644
 --- a/proxy-server.conf
 +++ b/proxy-server.conf
 @@ -3,6 +3,12 @@ bind_port = 8080
 user = root
 log_facility = LOG_LOCAL1
 
 +bind_port = 443
 +cert_file = /etc/swift/cert.crt
 +key_file = /etc/swift/cert.key
 +
 +
 +
 [pipeline:main]
 pipeline = healthcheck cache tempauth proxy-server
 
 @@ -14,6 +20,10 @@ account_autocreate = true
 [filter:tempauth]
 use = egg:swift#tempauth
 
 +
 +user_test_tester = testing .admin
 +
 +
 [filter:healthcheck]
 use = egg:swift#healthcheck

※ 事前にSSL鍵を作っておく必要あり

# cd /etc/swift
# openssl req -new -x509 -nodes -out cert.crt -keyout cert.key

Swift 起動

[root@scfc-virt2 ~]# swift-init main start
Starting proxy-server...(/etc/swift/proxy-server.conf)
Starting container-server...(/etc/swift/container-server/1.conf)
Starting account-server...(/etc/swift/account-server/1.conf)
Starting object-server...(/etc/swift/object-server/1.conf)
[root@scfc-virt2 ~]# 

※ 上手くいかない場合 /var/log/messages を確認する。。

動作確認

認証を実施:
# curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass:testing' -k https://localhost:443/auth/v1.0
 ///
 < HTTP/1.1 200 OK
 < X-Storage-Url: https://127.0.0.1:443/v1/AUTH_test
 < X-Storage-Token: AUTH_tkbf93f02e7e6842bb98374849cedcb6d1
 < X-Auth-Token: AUTH_tkbf93f02e7e6842bb98374849cedcb6d1
 < Content-Length: 0
 < Date: Sat, 30 Mar 2013 09:38:43 GMT
 < 
 * Connection #0 to host localhost left intact
 * Closing connection #0
 ///

コンテナー名を列記:
# curl -v -X GET -H 'X-Auth-Token: AUTH_tkbf93f02e7e6842bb98374849cedcb6d1' https://localhost:443/v1/AUTH_test -k
///
 < HTTP/1.1 204 No Content
 < X-Account-Container-Count: 0
 < X-Account-Object-Count: 0
 < X-Bytes-Used: 0
 < X-Object-Count: 0
 < X-Account-Bytes-Used: 0
 < X-Type: Account
 < X-Container-Count: 0
 < Accept-Ranges: bytes
 < Content-Length: 0
 < Date: Sat, 30 Mar 2013 10:05:14 GMT
 < 
 * Connection #0 to host localhost left intact
 * Closing connection #0
///
※ "test"という名前のvolumeが無いと、ここで503エラーが発生。

ファイル作成:
# curl -T /tmp/mmm -X PUT -k -H 'X-Auth-Token: AUTH_tkbf93f02e7e6842bb98374849cedcb6d1' -H 'transfer-encoding: chunked' https://localhost:443/v1/AUTH_test/hello/aaa
※ ファイルが作成されているかの確認は、/mnt/gluster-objects かbrickの置き場所(/root/glusterfs/test)で実施する。 

まとめ

差し当たりGlusterのUFOを動かすことが出来た。実際に実施していることはHTTPでファイルGET/PUTを受けてプロキシ上にマウントされた glusterfsに読み書きしているだけのようなので、あまり新しいことはないが、、セグメントを越えたりリバースプロキシ経由でglusterに読み書き出来たりするので、オンプレミスの環境ではかなり使い勝手がよくなる気がしている。。(特にセグメント越えでCIFSが遅い場合や、、閲覧元がWindowsUnixでない場合)

※ 今のところ、ユーザー名が proxy-server.conf に直書きするしかなく、かつ、反映時に再起動が必要なのが運用上少々辛い気がする(ロードバランサーを使えば出来なくはないかもしれないが)