GNU/Linux >> Linux の 問題 >  >> Cent OS

CentOS 5.4でのGlusterFSによる高可用性ストレージ-2つのストレージサーバー間での自動ファイルレプリケーション(ミラー)

このチュートリアルでは、GlusterFSを使用する2つのストレージサーバー(CentOS 5.4)を使用して高可用性ストレージをセットアップする方法を示します。各ストレージサーバーは他のストレージサーバーのミラーになり、ファイルは両方のストレージサーバーに自動的に複製されます。クライアントシステム(CentOS 5.4も)は、ローカルファイルシステムであるかのようにストレージにアクセスできます。GlusterFSは、数ペタバイトに拡張できるクラスター化されたファイルシステムです。 InfinibandRDMAまたはTCP/IP相互接続を介してさまざまなストレージブリックを1つの大規模な並列ネットワークファイルシステムに集約します。ストレージブリックは、SATA-IIRAIDおよびInfinibandHBAを備えたx86_64サーバーなどの任意のコモディティハードウェアで作成できます。

これがあなたのために働くという保証はありません!

1予備メモ

このチュートリアルでは、3つのシステム、2つのサーバー、および1つのクライアントを使用します。

  • server1.example.com:IPアドレス192.168.0.100(サーバー)
  • server2.example.com:IPアドレス192.168.0.101(サーバー)
  • client1.example.com:IPアドレス192.168.0.102(クライアント)

3つのシステムすべてが、他のシステムのホスト名を解決できる必要があります。 DNSを介してこれを実行できない場合は、/ etc / hostsファイルを編集して、3つのシステムすべてで次の行が含まれるようにする必要があります。

vi /etc/hosts
[...]
192.168.0.100           server1.example.com server1
192.168.0.101           server2.example.com server2
192.168.0.102           client1.example.com client1
[...]

(次の設定では、ホスト名の代わりにIPアドレスを使用することもできます。IPアドレスを使用する場合は、ホスト名を解決できるかどうかを気にする必要はありません。)

2GlusterFSサーバーのセットアップ

server1.example.com/server2.example.com:

GlusterFSはCentOS5.4のパッケージとしては利用できないため、自分で作成する必要があります。まず、前提条件をインストールします:

yum groupinstall 'Development Tools'
yum groupinstall 'Development Libraries'
yum install libibverbs-devel fuse-devel

次に、最新のGlusterFSリリースをhttp://www.gluster.org/download.phpからダウンロードし、次のようにビルドします。

cd / tmp
wget http://ftp.gluster.com/pub/gluster/glusterfs/2.0/LATEST/glusterfs-2.0.9.tar.gz
tar xvfz glusterfs-2.0.9.tar .gz
cd glusterfs-2.0.9
./configure

./configureコマンドの最後に、次のようなメッセージが表示されます。

[...]
GlusterFS構成の概要
===========================
FUSEクライアント:はい
Infiniband動詞:はい
epoll IOマルチプレックス:はい
Berkeley-DB:はい
libglusterfsclient:はい
argp-standalone:いいえ

[[email protected] glusterfs-2.0.9]#

make &&make install
ldconfig

後でGlusterFSのバージョンを確認してください(2.0.9である必要があります):

glusterfs --version

[[メール保護]glusterfs-2.0.9]#glusterfs --version
glusterfs2.0.9は2010年3月1日15:34:50にビルドされました
リポジトリのリビジョン:v2.0.9
著作権( c)2006-2009 Gluster Inc.
GlusterFSには、まったく保証がありません。
GNU General Public Licenseの条件に基づいて、GlusterFSのコピーを再配布できます。
[[email protected] glusterfs-2.0.9]#

次に、いくつかのディレクトリを作成します:

mkdir / data /
mkdir / data / export
mkdir / data / export-ns
mkdir / etc / glusterfs

次に、エクスポートするディレクトリ(/ data / export)と接続を許可するクライアント(192.168.0.102 =client1.example.com)を定義するGlusterFSサーバー構成ファイル/etc/glusterfs/glusterfsd.volを作成します。

vi /etc/glusterfs/glusterfsd.vol
volume posix
  type storage/posix
  option directory /data/export
end-volume

volume locks
  type features/locks
  subvolumes posix
end-volume

volume brick
  type performance/io-threads
  option thread-count 8
  subvolumes locks
end-volume

volume server
  type protocol/server
  option transport-type tcp
  option auth.addr.brick.allow 192.168.0.102
  subvolumes brick
end-volume

IPアドレスにワイルドカードを使用することが可能であり(192.168. *など)、コンマで区切って複数のIPアドレスを指定できることに注意してください(例:192.168.0.102,192.168.0.103)。

その後、次のシンボリックリンクを作成します...

ln -s /usr/local/sbin/glusterfsd /sbin/glusterfsd

...次に、GlusterFSサーバーのシステム起動リンクを表示して起動します:

chkconfig --levels 35 glusterfsd on
/etc/init.d/glusterfsd start

3GlusterFSクライアントのセットアップ

client1.example.com:

GlusterFSはCentOS5.4のパッケージとしては利用できないため、自分で作成する必要があります。まず、前提条件をインストールします:

yum groupinstall 'Development Tools'
yum groupinstall 'Development Libraries'
yum install libibverbs-devel fuse-devel

次に、ヒューズカーネルモジュールをロードします...

modprobe fuse

...そして、次の内容のファイル/etc/rc.modulesを作成して、システムが起動するたびにヒューズカーネルモジュールが自動的にロードされるようにします。

vi /etc/rc.modules
modprobe fuse

ファイルを実行可能にします:

chmod +x /etc/rc.modules 

次に、GlusterFS 2.0.9ソースをダウンロードし(これはサーバーにインストールされているものと同じバージョンであることに注意してください!)、次のようにGlusterFSをビルドします。

cd / tmp
wget http://ftp.gluster.com/pub/gluster/glusterfs/2.0/LATEST/glusterfs-2.0.9.tar.gz
tar xvfz glusterfs-2.0.9.tar .gz
cd glusterfs-2.0.9
./configure

./configureコマンドの最後に、次のようなメッセージが表示されます。

[...]
GlusterFS構成の概要
===========================
FUSEクライアント:はい
Infiniband動詞:はい
epoll IOマルチプレックス:はい
Berkeley-DB:はい
libglusterfsclient:はい
argp-standalone:いいえ

make &&make install
ldconfig

後でGlusterFSのバージョンを確認してください(2.0.9である必要があります):

glusterfs --version

[[email protected] glusterfs-2.0.9]#glusterfs --version
glusterfs2.0.9ビルドオン2010年3月1日15:58:06
リポジトリリビジョン:v2.0.9
著作権( c)2006-2009 Gluster Inc.
GlusterFSには、まったく保証がありません。
GNU General Public Licenseの条件に基づいて、GlusterFSのコピーを再配布できます。
[[email protected] glusterfs-2.0.9]#

次に、次の2つのディレクトリを作成します。

mkdir / mnt / glusterfs
mkdir / etc / glusterfs

次に、ファイル/etc/glusterfs/glusterfs.vol:

を作成します。
vi /etc/glusterfs/glusterfs.vol
volume remote1
  type protocol/client
  option transport-type tcp
  option remote-host server1.example.com
  option remote-subvolume brick
end-volume

volume remote2
  type protocol/client
  option transport-type tcp
  option remote-host server2.example.com
  option remote-subvolume brick
end-volume

volume replicate
  type cluster/replicate
  subvolumes remote1 remote2
end-volume

volume writebehind
  type performance/write-behind
  option window-size 1MB
  subvolumes replicate
end-volume

volume cache
  type performance/io-cache
  option cache-size 512MB
  subvolumes writebehind
end-volume

オプションのリモートホスト行で正しいサーバーホスト名またはIPアドレスを使用していることを確認してください!

それでおしまい!これで、次の2つのコマンドのいずれかを使用して、GlusterFSファイルシステムを/ mnt/glusterfsにマウントできます。

glusterfs -f /etc/glusterfs/glusterfs.vol /mnt/glusterfs

または

mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs

これで、出力に新しいシェアが表示されるはずです...

mount

[[email protected]〜]#mount
/ dev / mapper / VolGroup00-LogVol00 on / type ext3(rw)
proc on / proc type proc(rw)
sysfs on / sys type sysfs(rw)
devpts on / dev / pts type devpts(rw、gid =5、mode =620)
/ dev / sda1 on / boot type ext3(rw)
tmpfs on / dev / shm type tmpfs(rw)
none on / proc / sys / fs / binfmt_misc type binfmt_misc(rw)
sunrpc on / var / lib / nfs / rpc_pipefs type rpc_pipefs(rw)
/ mnt / glusterfsタイプのヒューズのglusterfs#/ etc / glusterfs / glusterfs.vol(rw、allow_other、default_permissions、max_read =131072)
[[email protected]〜]#

...そして...

df -h

[[メール保護]〜]#df -h
ファイルシステム使用済み使用率使用率
/ dev / mapper / VolGroup00-LogVol00
25 TMPFS 187M 0 187M 0%は/ dev / SHM
glusterfs#の/ etc / glusterfs / glusterfs.vol
28G 2.3G 25G 9%/ mnt / glusterfs
[[メール保護]〜]#

(server1.example.comとserver2.example.comにはそれぞれGlusterFSファイルシステム用に28GBのスペースがありますが、データがミラーリングされているため、クライアントには56GB(2 x 28GB)は表示されず、28GBしか表示されません。)

>

GlusterFS共有をクライアントに手動でマウントする代わりに、/ etc / fstabを変更して、クライアントの起動時に共有が自動的にマウントされるようにすることができます。

/ etc / fstabを開き、次の行を追加します。

vi /etc/fstab  
[...]
/etc/glusterfs/glusterfs.vol  /mnt/glusterfs  glusterfs  defaults  0  0

変更した/etc/ fstabが機能しているかどうかをテストするには、クライアントを再起動します。

reboot 

再起動後、出力に共有が表示されます...

df -h

...そして...

mount

4つのテスト

それでは、GlusterFS共有にいくつかのテストファイルを作成しましょう:

client1.example.com:

/ mnt / glusterfs/test1にタッチします
/mnt / glusterfs/test2にタッチします

次に、server1.example.comとserver2.example.comの/ data/exportディレクトリを確認しましょう。 test1ファイルとtest2ファイルは各ノードに存在する必要があります:

server1.example.com/server2.example.com:

ls -l /data/export 

[[メール保護]〜]#ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2010-02-22 16:50 test1
-rw-r--r--1ルートルート02010-02-2216:50 test2
[[メール保護]〜]#

ここで、server1.example.comをシャットダウンし、client1.example.comのGlusterFS共有でいくつかのファイルを追加/削除します。

server1.example.com:

shutdown -h now

client1.example.com:

touch / mnt / glusterfs / test3
touch / mnt / glusterfs / test4
rm -f / mnt / glusterfs / test2

変更は、server2.example.comの/ data/exportディレクトリに表示されます。

server2.example.com:

ls -l /data/export 

[[メール保護]〜]#ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2010-02-22 16:50 test1
-rw-r--r--1ルートルート02010-02-2216:53 test3
-rw-r--r--1ルートルート02010-02-2216:53 test4
[[メール保護]〜]#

server1.example.comを再度起動して、/ data/exportディレクトリを確認してみましょう。

server1.example.com:

ls -l /data/export 

[[メール保護]〜]#ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2010-02-22 16:50 test1
-rw-r--r--1ルートルート02010-02-2216:50 test2
[[メール保護]〜]#

ご覧のとおり、server1.example.comは、ダウン中に発生した変更に気づいていません。これは簡単に修正できます。必要なのは、client1.example.comのGlusterFS共有で読み取りコマンドを呼び出すことだけです。例:

client1.example.com:

ls -l /mnt/glusterfs/

[[メール保護]〜]#ls -l / mnt / glusterfs /
total 0
-rw-r--r-- 1 root root 0 2010-02-22 16:50 test1
-rw-r--r--1ルートルート02010-02-2216:53 test3
-rw-r--r--1ルートルート02010-02-2216:53 test4
[[メール保護]〜]#

ここで、server1.example.comの/ data / exportディレクトリをもう一度確認すると、変更がそのノードに複製されていることがわかります。

server1.example.com:

ls -l /data/export 

[[メール保護]〜]#ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2010-02-22 16:50 test1
-rw-r--r--1ルートルート02010-02-2216:53 test3
-rw-r--r--1ルートルート02010-02-2216:53 test4
[[メール保護]〜]#

  • GlusterFS:http://www.gluster.org/
  • CentOS:http://www.centos.org/

Cent OS
  1. Debian WheezyでのGlusterFS3.2.xによる高可用性ストレージ-2つのストレージサーバー間での自動ファイルレプリケーション(ミラー)

  2. CentOS5.4でGlusterFSを使用してNFSのようなスタンドアロンストレージサーバーを作成する

  3. CentOS 5.4でのGlusterFSによる高可用性ストレージ-2つのストレージサーバー間での自動ファイルレプリケーション(ミラー)

  1. CentOS5.4上のGlusterFSを使用した4つのストレージノードに分散されたレプリケートされたストレージ

  2. CentOS5.4上のGlusterFSを使用した4つのストレージノードにまたがる分散ストレージ

  3. CentOS5.4のGlusterFSを使用した4つのストレージノード間のストライピング

  1. CentOS6.3上のGlusterFS3.2.xを使用した高可用性ストレージ-2つのストレージサーバー間での自動ファイルレプリケーション(ミラーリング)

  2. CentOS6.3でGlusterFS3.2.xを使用してNFSのようなスタンドアロンストレージサーバーを作成する

  3. CentOS6.3上のGlusterFS3.2.xを使用した4つのストレージノード間のストライピング