GlusterFS とは
GlusterFS は、オープンソースのネットワーク/クラスター ファイルシステムであり、スタック可能なユーザー空間設計に基づいています。このチュートリアルでは、GlusterFS を使用して 2 台の Linux マシン間でストレージの高可用性 (つまり、ファイルのリアルタイム レプリケーション) を実現します。 glusterfs は、クラウド コンピューティング、ストリーミング メディア サービス、コンテンツ配信ネットワークなど、さまざまな分野でそのアプリケーションを見つけました。このチュートリアルでは、ブリックという用語を使用します (ボリュームに割り当てられたストレージ ファイルシステムです)。
私たちの場合、2 台の Centos 6.2 マシンを使用しており、Apache ドキュメント ルート (/var/www/html) の glusterfs 静的ファイルを使用すると、これらのマシン間で複製されます。これを達成するには、以下の手順に従ってください。
ステップ 1 :両方のノードで epel リポジトリを有効にします:
# yum -y install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
ステップ 2 :両方のノードで GlusterFS リポジトリを有効にします:
# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/glusterfs-epel.repo
ステップ 3 :両方のノードで yum を使用して必要なすべてのパッケージをインストールします:
# yum -y install pyxattr python-webob1.0 python-paste-deploy1.5 python-sphinx10 git autoconf automake bison dos2unix flex fuse-devel libaio-devel libibverbs-devel libtool libxml2-devel lvm2-devel make openssl-devel pkgconfig python-devel python-eventlet python-netifaces python-paste-deploy python-simplejson python-sphinx python-webob readline-devel rpm-build systemtap-sdt-devel tar
ステップ 4 :GlusterFS ソフトウェアを両方のノードにインストールします:
# yum install glusterfs{-fuse,-server} # yum install xfsdump xfsprogs
ステップ 5 :両方のノードで GlusterFS サービスを開始します:
# /etc/init.d/glusterd start ; chkconfig glusterd on
ステップ 6 :両方のノードで GlusterFS クライアントの Linux コアにヒューズ モジュールを追加します:
# /sbin/modprobe fuse
サーバーの再起動後に機能させるには:
# echo "modprobe fuse" > /etc/sysconfig/modules/fuse.modules # chmod +x /etc/sysconfig/modules/fuse.modules
ステップ 7 :信頼できるストレージに両方のノードを追加します:
– 「site1.thegeekdiary.com」で、以下のコマンドを実行します:
# gluster peer probe site2.thegeekdiary.com
「Site2.thegeekdiary.com」で、以下のコマンドを実行します:
# gluster peer probe site1.thegeekdiary.com注意 :ファイアウォールを使用している場合は、site1.thegeekdiary.com と site2.thegeekdiary.com で TCP ポート 111、24007、24008、24009 が開いていることを確認してください。
信頼できるストレージのステータスを確認するには、以下のコマンドを使用します:
# glusterfs peer status
ステップ 8 :両方のノードに以下のディレクトリを作成してください。
# mkdir -p /opt/gfs-data
マスター ノード (site1.thegeekdiary.com) で、以下のコマンドを実行します:
# gluster volume create apache replica 2 site1.thegeekdiary.com:/opt/gfs-data site2.thegeekdiary.com:/opt/gfs-data
ステップ 9 :両方のノードでボリュームを開始します。
# gluster volume start apache
次に、site1.thegeekdiary.com にボリュームをマウントします:
# mount.glusterfs site1.thegeekdiary.com:/apache /var/www/html
また、ボリュームを site2.thegeekdiary.com にマウントします:
# mount.glusterfs site2.thegeekdiary:/apache /var/www/html
Permanent Mount の場合は、/etc/fstab ファイルに以下のエントリを追加してください。
site1.thegeekdiary.com:/apache /var/www/html glusterfs defaults,_netdev 0 0
ステップ 10 :ファイル レプリケーションのテスト。
/var/www/html フォルダーに移動し、「site1.thegeekdiary.com」からファイルを変更して、変更が別のノード「site2.thegeekdiary.com」に反映されているかどうかを確認します。