GNU/Linux >> Linux の 問題 >  >> Debian

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

このチュートリアルでは、4つの単一ストレージサーバー(Debian Lennyを実行)をGlusterFSを使用して分散レプリケートストレージに結合する方法を示します。ノード1と2(replication1)および3と4(replication2)は相互にミラーリングし、replication1とreplication2は1つの大きなストレージサーバー(ディストリビューション)に結合されます。基本的に、これはネットワーク上のRAID10です。replication1から1台、replication2から1台のサーバーを失っても、分散ボリュームは引き続き機能します。クライアントシステム(Debian Lennyも)は、ローカルファイルシステムであるかのようにストレージにアクセスできます。GlusterFSは、数ペタバイトに拡張できるクラスター化されたファイルシステムです。 InfinibandRDMAまたはTCP/IP相互接続を介してさまざまなストレージブリックを1つの大規模な並列ネットワークファイルシステムに集約します。ストレージブリックは、SATA-IIRAIDおよびInfinibandHBAを備えたx86-64サーバーなどの任意のコモディティハードウェアで作成できます。

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

1予備メモ

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

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

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

vi /etc/hosts
127.0.0.1       localhost.localdomain   localhost
192.168.0.100   server1.example.com     server1
192.168.0.101   server2.example.com     server2
192.168.0.102   server3.example.com     server3
192.168.0.103   server4.example.com     server4
192.168.0.104   client1.example.com     client1

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

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

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

server1.example.com/server2.example.com/server3.example.com/server4.example.com:

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

aptitude install sshfs build-essential flex bison byacc libdb4.6 libdb4.6-dev

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

cd / tmp
wget http://ftp.gluster.com/pub/gluster/glusterfs/2.0/LATEST/glusterfs-2.0.1.tar.gz
tar xvfz glusterfs-2.0.1.tar .gz
cd glusterfs-2.0.1
./configure --prefix =/ usr> / dev / null

server1:/tmp/glusterfs-2.0.1# ./configure --prefix =/ usr> / dev / null

GlusterFS configure summary
===========================
FUSE client:no
Infiniband verbs:no
epoll IO multiplex:yes
Berkeley-DB:はい
libglusterfsclient:はい
mod_glusterfs:no()
argp-standalone:no

server1:/tmp/glusterfs-2.0.1#

make &&make install
ldconfig

コマンド

glusterfs --version

コンパイルしたばかりのGlusterFSバージョン(この場合は2.0.1)が表示されます:

server1:/tmp/glusterfs-2.0.1# glusterfs --version
glusterfs2.0.1ビルド日2009年5月29日17:23:10
リポジトリリビジョン:5c1d9108c1529a1155963cb1911f8870a674ab5b
Copyright(c)2006 -2009 Z RESEARCH Inc.
GlusterFSには、まったく保証がありません。
GNU General Public Licenseの条件に基づいて、GlusterFSのコピーを再配布できます。
server1:/tmp/glusterfs-2.0.1#

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

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

次に、エクスポートするディレクトリ(/ data / export)と接続を許可するクライアント(192.168.0.104 =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.104
  subvolumes brick
end-volume

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

その後、glusterfsdinitスクリプトのシステム起動リンクを作成します...

update-rc.d glusterfsd defaults

...そしてglusterfsdを開始します:

/etc/init.d/glusterfsd start

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

client1.example.com:

クライアントに、fuseとGlusterFSをインストールする必要があります。 Debianリポジトリからlibfuse2パッケージをインストールする代わりに、GlusterFSをより適切にサポートするパッチを適用したバージョンをインストールします。

まず、前提条件を再度インストールします:

aptitude install sshfs build-essential flex bison byacc libdb4.6 libdb4.6-dev

次に、次のようにヒューズを作成します(最新のパッチが適用されたヒューズのバージョンは、ftp://ftp.zresearch.com/pub/gluster/glusterfs/fuse/にあります):

cd / tmp
wget ftp://ftp.zresearch.com/pub/gluster/glusterfs/fuse/fuse-2.7.4glfs11.tar.gz
tar-zxvffuse-2.7.4glfs11.tar。 gz
cdヒューズ-2.7.4glfs11
./configure
make &&make install

その後、GlusterFSをビルドします(サーバー上と同じように)...

cd / tmp
wget http://ftp.gluster.com/pub/gluster/glusterfs/2.0/LATEST/glusterfs-2.0.1.tar.gz
tar xvfz glusterfs-2.0.1.tar .gz
cd glusterfs-2.0.1
./configure --prefix =/ usr> / dev / null

make &&make install
ldconfig
glusterfs --version

...そして次の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 remote3
  type protocol/client
  option transport-type tcp
  option remote-host server3.example.com
  option remote-subvolume brick
end-volume

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

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

volume replicate2
  type cluster/replicate
  subvolumes remote3 remote4
end-volume

volume distribute
  type cluster/distribute
  subvolumes replicate1 replicate2
end-volume

volume writebehind
  type performance/write-behind
  option window-size 1MB
  subvolumes distribute
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

client1:/tmp/glusterfs-2.0.1# mount
/ dev / sda1 on / type ext3(rw、errors =remount-ro)
tmpfs on / lib / init / rw type tmpfs(rw、 nosuid、mode =0755)
proc on / proc type proc(rw、noexec、nosuid、nodev)
sysfs on / sys type sysfs(rw、noexec、nosuid、nodev)
udev on / dev type tmpfs(rw、mode =0755)
tmpfs on / dev / shm type tmpfs(rw、nosuid、nodev)
devpts on / dev / pts type devpts(rw、noexec、nosuid、gid =5、mode =620)
fusectl on / sys / fs / Fuse / connections type fusect(rw)
/etc/glusterfs/glusterfs.vol on / mnt / glusterfs type Fuse.glusterfs(rw、 max_read =131072、allow_other、default_permissions)
client1:/tmp/glusterfs-2.0.1#

...そして...

df -h

client1:/tmp/glusterfs-2.0.1# df -h
Filesystem Used Available Use%Mounted on
/ dev / sda1 tmp 29G 935M 27G 4%/
udev 10M 80K 10M 1%/ dev
tmpfs glu ster 1/2 G 44G 4%/mnt/glusterfs
client1:/tmp/glusterfs-2.0.1#

(分散ストレージのサイズは、replication1 + Replication2によって計算されます。ここで、両方のレプリケーションボリュームは最小のブリックと同じ大きさです。)

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:

touch / mnt / glusterfs / test1
touch / mnt / glusterfs / test2
touch / mnt / glusterfs / test3
touch / mnt / glusterfs / test4
touch / mnt / glusterfs / test5
touch / mnt / glusterfs / test6

次に、server1.example.com、server2.example.com、server3.example.com、およびserver4.example.comの/ data/exportディレクトリを確認しましょう。 Replication1とreplication2は、クライアント上のGlusterFS共有を構成するファイル/ディレクトリの一部のみを保持しますが、replication1(server1とserver2)またはreplication2(server3とserver4)を構成するノードには同じものが含まれていることに気付くでしょう。ファイル(ミラーリング):

server1.example.com:

ls -l /data/export 

server1:/tmp/glusterfs-2.0.1# ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test1
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test2
-rw-r--r-- 1 root root 0 2009-06-03 15: 24 test4
-rw-r--r--1ルートルート02009-06-0315:24 test5
server1:/tmp/glusterfs-2.0.1#

server2.example.com:

ls -l /data/export 

server2:/tmp/glusterfs-2.0.1# ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test1
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test2
-rw-r--r-- 1 root root 0 2009-06-03 15: 24 test4
-rw-r--r--1ルートルート02009-06-0315:24 test5
server2:/tmp/glusterfs-2.0.1#

server3.example.com:

ls -l /data/export 

server3:/tmp/glusterfs-2.0.1# ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test3
-rw-r--r--1ルートルート02009-06-0315:24 test6
server3:/tmp/glusterfs-2.0.1#

server4.example.com:

ls -l /data/export 

server4:/tmp/glusterfs-2.0.1# ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test3
-rw-r--r--1ルートルート02009-06-0315:24 test6
server4:/tmp/glusterfs-2.0.1#

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

server1.example.com/server4.example.com:

shutdown -h now

client1.example.com:

rm -f / mnt / glusterfs / test5
rm -f / mnt / glusterfs / test6

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

server2.example.com:

ls -l /data/export 

server2:/tmp/glusterfs-2.0.1# ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test1
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test2
-rw-r--r-- 1 root root 0 2009-06-03 15: 24 test4
server2:/tmp/glusterfs-2.0.1#

server3.example.com:

ls -l /data/export 

server3:/tmp/glusterfs-2.0.1# ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test3
server3:/tmp/glusterfs-2.0.1#

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

server1.example.com:

ls -l /data/export 

server1:〜#ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test1
-rw- r--r--1ルートルート02009-06-0315:24 test2
-rw-r--r--1ルートルート02009-06-0315:24 test4
- rw-r--r--1ルートルート02009-06-0315:24 test5
server1:〜#

server4.example.com:

ls -l /data/export 

server4:〜#ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test3
-rw- r--r--1ルートルート02009-06-0315:24 test6
server4:〜#

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

client1.example.com:

ls -l /mnt/glusterfs/

client1:〜#ls -l / mnt / glusterfs /
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test1
-rw -r--r--1ルートルート02009-06-0315:24 test2
-rw-r--r--1ルートルート02009-06-0315:24 test3
-rw-r--r--1ルートルート02009-06-0315:24 test4
client1:〜#

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

server1.example.com:

ls -l /data/export 

server1:〜#ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test1
-rw- r--r--1ルートルート02009-06-0315:24 test2
-rw-r--r--1ルートルート02009-06-0315:24 test4
server1 :〜#

server4.example.com:

ls -l /data/export 

server4:〜#ls -l / data / export
total 0
-rw-r--r-- 1 root root 0 2009-06-03 15:24 test3
server4:〜 #

  • GlusterFS:http://www.gluster.org/
  • Debian:http://www.debian.org/

Debian
  1. Debian8上のGlusterFSを使用した高可用性ストレージ-2つのストレージサーバー間でミラーリング

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

  3. Ubuntu12.10上のGlusterFS3.2.xを使用した4つのストレージノードに分散されたレプリケートされたストレージ

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

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

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

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

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

  3. DebianSqueezeでのGlusterFS3.0.xによる高可用性ストレージ-2つのストレージサーバー間での自動ファイルレプリケーション