[[
GlusterFS
]]
めでぃあきすらぼ
現在位置:
めでぃあきすらぼ
»
分散ストレージ
»
GlusterFS
文書の表示
最近の変更
索引
ログイン
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== GlusterFS ====== 元々はオープンソースで開発がされていた分散ストレージシステムの1つ [[http://www.gluster.org/|GlusterFS]] 現在は、Redhatが取り込んでRed Hat Storage Serverとしてリリースしている。 いつもの通りCentOS/Scientific Linuxな環境に構築をしてみる。 英語は苦手だが、とりあえず[[http://www.gluster.org/community/documentation/index.php/QuickStart|QuickStart]]に目を通してみる。 Step 1 – Have at least two nodes * A 64 bit OS * A working network connection * At least two virtual disks, one for the OS installation, and one to be used to serve Gluster storage. This will emulate a real world deployment, where you would want seperate disks for Gluster storage than the OS install. なんて事が書いてある。 いくら英語が苦手なオイラでも**64bit OS**じゃないとダメ!!って事はわかるぞ。よーし、64bit OSを用意すりゃ良いんだろ? って思って64bitで検証してたんだけど 32bitしかインストール出来ないようなダメなサーバーくんをなんとか使えないのだろうか?という心の声が聞こえてきたのでソースファイルがあるならコンパイルしちゃえば良いのかな?とか思ってダウンロードサイトを見に行ってみたら。。。 ダウンロードサイトはここね [[http://download.gluster.org/pub/gluster/glusterfs/3.3/3.3.1/CentOS/epel-6/|CentOS Gluster]] ん? あーーーーーーーー i386があるじゃないか!!いやいや、フォルダだけかも・・・・・・ はい、ちゃんとRPMが存在しました(--;) なんてこったい。 そんな訳で、glusterfs-epel.repoを編集する <code> # Place this file in your /etc/yum.repos.d/ directory [glusterfs-epel] name=GlusterFS is a clustered file-system capable of scaling to several petabytes. baseurl=http://download.gluster.org/pub/gluster/glusterfs/3.3/3.3.1/CentOS/epel-6/$basearch/ enabled=1 skip_if_unavailable=1 gpgcheck=0 [glusterfs-swift-epel] name=GlusterFS is a clustered file-system capable of scaling to several petabytes. baseurl=http://download.gluster.org/pub/gluster/glusterfs/3.3/3.3.1/CentOS/epel-6/noarch enabled=1 skip_if_unavailable=1 gpgcheck=0 [glusterfs-source-epel] name=GlusterFS is a clustered file-system capable of scaling to several petabytes. - Source baseurl=http://download.gluster.org/pub/gluster/glusterfs/3.3/3.3.1/CentOS/epel-6/SRPMS enabled=0 skip_if_unavailable=1 gpgcheck=0 </code> バージョンとかは適当に変えちゃってね ===== インストール ===== リポジトリの登録がちゃんと出来ていればyumでインストール出来てしまうので難しい事は何もない・・・ yum install glusterfs glusterfs-server glusterfs-fuse glusterfs-geo-replication うむぅ。32bitでも動くじゃないか! ==== 自動起動の設定をする ==== chkconfig glusterd on chkconfig glusterfsd on ついでにスタートしてみる。特にエラーもなく実行されるよ。たぶん・・・ service glusterd start service glusterfsd start ==== そうは言っても1台じゃ意味無いので2台用意する ==== お互いが名前解決できるようにhostsに登録をしておく vi /etc/hosts ==== volumeを作成 ==== gluster peer probe サーバー名2 <note warning>gluster peer probeは1台のサーバーからそれ以外のサーバーに対してのみ実行するだけ</note> gluster volume create ボリューム名 replica 2 transport tcp サーバー名1:ディレクトリ サーバー2:ディレクトリ 作成したボリュームを利用可能にする gluster volume start ボリューム名 ==== 復旧 ==== 障害が発生したサーバーと同じホスト名・同じIP・同じ設定でGlusterFSを構築します 状況の確認 gluster peer status ダウンしているノードのステータスがDisconnectedになっているはず State: Peer in Cluster (Disconnected) ボリュームにアサインされているBrickを確認 <code> gluster vol info ボリューム名 Volume Name: ボリューム名 Type: Distributed-Replicate Volume ID: a3221ea9-fe65-4e97-9f20-2960cb81187d Status: Started Number of Bricks: 2 x 2 = 4 Transport-type: tcp Bricks: Brick1: gfs00:/data/brick00 Brick3: gfs00:/data/brick02 落ちてるサーバーに含まれるBrickは表示されない。 あたりまえだけど、本来は1サーバーに複数のBrickを出しても意味は無いw </code> ボリュームのステータスを確認するには gluster vol status ボリューム名 復旧したサーバーから既存のノードを指定してpeer probeを実行 service glusterd start gluster peer probe 既存のノード ※複数のノードがある場合は全てのノードに対して実行する service glusterd restart service glusterfsd start <note warning>既存ノードから復旧したノードを指定するのではない!</note> <note warning> Glusterfs 3.4.0にはバグがあるらしく、再構築してpeerしても Volume-idを設定してくれないようだ。 この為ステータスを確認しても再構築したサーバーがオンラインにならない gluster vol status ボリューム名 Volume-idの確認 既存のサーバーで以下のコマンド実行 gluster vol info ボリューム名 表示されるVolume IDをそのまま登録は出来ない -を抜いたIDを登録しないといけない 面倒な場合は以下のコマンドで-無しのIDが表示される getfattr -d -m . -e hex BrickPath って事で設定してみる setfattr -n trusted.glusterfs.volume-id -v 確認したVolumeID ボリューム名 Glusterdを再起動する service glusterd restart これでオンラインになるはず(^^;) </note> 再レプリケーションを実行 gluster vol heal ボリューム名 full <note warning>ノード再構築時はSelf-heal daemonによる自動再レプリケーションは実施されません。再レプリケーションは上記のコマンドにfullのオプションを付けて実行する</note> ==== Quota ==== 作成したボリュームに容量制限をかけたい場合も簡単! gluster volume quota ボリューム名 enable 1GBで制限する場合 gluster volume quota ボリューム名 limit-usage / 1GB /mklを200MBで制限したい場合 gluster volume quota ボリューム名 limit-usage /mkl 200MB /とは作成したボリューム直下という意味。 <note warning> 親フォルダよりも大きいクォータ値を子フォルダに設定出来てしまう。 親フォルダに制限を設定している場合、子フォルダは自身の制限値に達していない場合でも書き込めなくなる場合がある 既に存在するファイルのトータルサイズより小さな制限値も設定してもエラーにはならない。 その場合、制限値以下にしないとファイルの編集も出来なくなる </note> 解除する場合は gluster volume quota ボリューム名 disable <note warning> disableを実行すると設定したLimitが全てクリアされます </note> ==== volumeが作成出来ない場合 ==== 一度ボリュームに追加したBrick(ディレクトリ)を再度ボリュームに追加する場合 ボリュームを削除していたとしてもボリューム作成時に以下のようなエラーが出力する事がある。 {path} or a prefix of it is already part of a volume この場合、以下のコマンドを実行する必要がある setfattr -x trusted.glusterfs.volume-id $brick_path setfattr -x trusted.gfid $brick_path rm -rf $brick_path/.glusterfs [[http://nuke.hateblo.jp/entry/20121128/1354085790|参考1]] [[http://joejulian.name/blog/glusterfs-path-or-a-prefix-of-it-is-already-part-of-a-volume/|参考2]] ==== Glusterfsをインストールしたサーバで起動時にマウントする場合 ==== Glusterfsをインストールしたサーバで作成したBrickを起動時にマウントしたい場合、通常通りfstabに追記するのだけど 起動順の問題でfstabでマウントするタイミングではGlusterfsは起動していないのでマウントができない。 うにゅ~/etc/rc.localにでもmountコマンドを書きゃいいのかと思ったら、どうやらその辺りもちゃんと出来るそうなw まず、fstabに追記する書き方 localhost:/[Brick名] [マウント先] glusterfs defaults,_netdev 0 0 **_netdev**がミソ。 どうやら_netdevを付ける事で、マウント処理を遅延させてくれるそうな。 この動きを制御してくれてるのがnetfsサービス。ちゃんと起動しておきましょう。 デフォルトはONになってる気がする・・・ chkconfig netfs on service netfs start
分散ストレージ/glusterfs.txt · 最終更新: 2016/01/12 05:28 by miyako
文書の表示
以前のリビジョン
Media Manager
文書の先頭へ