このチュートリアルでは、DebianSqueezeでスタンドアロンストレージサーバーをセットアップする方法を示します。ここでは、NFSの代わりにGlusterFSを使用します。クライアントシステムは、ローカルファイルシステムであるかのようにストレージにアクセスできます。GlusterFSは、数ペタバイトに拡張できるクラスター化されたファイルシステムです。 InfinibandRDMAまたはTCP/IP相互接続を介してさまざまなストレージブリックを1つの大規模な並列ネットワークファイルシステムに集約します。ストレージブリックは、SATA-IIRAIDおよびInfinibandHBAを備えたx86_64サーバーなどの任意のコモディティハードウェアで作成できます。
これがあなたのために働くという保証はありません!
1予備メモ
このチュートリアルでは、サーバーとクライアントの2つのシステムを使用します。
- server1.example.com:IPアドレス192.168.0.100(サーバー)
- client1.example.com:IPアドレス192.168.0.101(クライアント)
両方のシステムが、もう一方のシステムのホスト名を解決できる必要があります。 DNSを介してこれを実行できない場合は、両方のシステムで次のようになるように/ etc/hostsファイルを編集する必要があります。
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost 192.168.0.100 server1.example.com server1 192.168.0.101 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 |
(次の設定では、ホスト名の代わりにIPアドレスを使用することもできます。IPアドレスを使用する場合は、ホスト名を解決できるかどうかを気にする必要はありません。)
2GlusterFSサーバーのセットアップ
server1.example.com:
GlusterFSはDebianSqueezeのパッケージとして入手できるため、次のようにインストールできます。
apt-get install glusterfs-server
コマンド
glusterfs --version
インストールしたばかりのGlusterFSバージョン(この場合は3.0.5)が表示されます:
[メール保護]:〜#glusterfs --version
2010年7月13日16:44:21に構築されたglusterfs3.0.5
リポジトリリビジョン:v3.0.5
Copyright(c)2006-2009 Gluster Inc.
GlusterFSには、まったく保証がありません。
GNU General Public Licenseの条件に基づいて、GlusterFSのコピーを再配布できます。
[メールで保護]:〜#
次に、いくつかのディレクトリを作成します:
mkdir / data /
mkdir / data / export
mkdir / data / export-ns
次に、GlusterFSサーバー構成ファイル/etc/glusterfs/glusterfsd.volを作成します(最初に元の/etc/glusterfs/glusterfsd.volファイルのバックアップを作成します)。これは、エクスポートされるディレクトリ(/ data / export)とその内容を定義します。クライアントは接続を許可されています(192.168.0.101 =client1.example.com):
cp /etc/glusterfs/glusterfsd.vol /etc/glusterfs/glusterfsd.vol_orig
cat / dev / null> /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 option mandatory-locks on 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.101 # Edit and add list of allowed clients comma separated IP addrs(names) here subvolumes brick end-volume |
IPアドレスにワイルドカードを使用することが可能であり(192.168. *など)、コンマで区切って複数のIPアドレスを指定できることに注意してください(例:192.168.0.101,192.168.0.102)。
その後、GlusterFSサーバーを起動します:
/etc/init.d/glusterfs-server start
3GlusterFSクライアントのセットアップ
client1.example.com:
クライアントでは、次のようにGlusterFSクライアントをインストールできます。
apt-get install glusterfs-client
次に、次のディレクトリを作成します。
mkdir /mnt/glusterfs
次に、ファイル/etc/glusterfs/glusterfs.volを作成します(最初に元の/etc/glusterfs/glusterfs.volファイルのバックアップを作成します):
cp /etc/glusterfs/glusterfs.vol /etc/glusterfs/glusterfs.vol_orig
cat / dev / null> /etc/glusterfs/glusterfs.vol
vi /etc/glusterfs/glusterfs.vol
volume remote type protocol/client option transport-type tcp option remote-host server1.example.com # can be IP or hostname option remote-subvolume brick end-volume volume writebehind type performance/write-behind option window-size 4MB subvolumes remote end-volume volume cache type performance/io-cache option cache-size 512MB subvolumes writebehind end-volume |
オプションremote-host行で正しいサーバーホスト名またはIPアドレスを使用していることを確認してください!
それでおしまい!これで、次の2つのコマンドのいずれかを使用して、GlusterFSファイルシステムを/ mnt/glusterfsにマウントできます。
glusterfs -f /etc/glusterfs/glusterfs.vol /mnt/glusterfs
または
mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs
これで、出力に新しいシェアが表示されるはずです...
mount
[メールで保護]:〜#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 fusectl(rw)
/etc/glusterfs/glusterfs.vol on / mnt / glusterfs type destroy.glusterfs(rw、allow_other、default_permissions、 max_read =131072)
[メールで保護]:〜#
...そして...
df -h
[メールで保護]:〜#df -h
Filesystem Used Available Use%Mounted on
/ dev / sda1 29G 278M 27G 3%/
tmp / RW
のudev 244M、100K 244M 1%/ devの
TMPFS 249M 0 249M 0%は/ dev / SHM
/etc/glusterfs/glusterfs.vol
29G 1.2G 27G 5% / mnt / glusterfs
[メール保護]:〜#
GlusterFS共有をクライアントに手動でマウントする代わりに、/ etc / fstabを変更して、クライアントの起動時に共有が自動的にマウントされるようにすることができます。
/ etc / fstabを開き、次の行を追加します。
vi /etc/fstab
[...] /etc/glusterfs/glusterfs.vol /mnt/glusterfs glusterfs defaults,_netdev 0 0 |
変更した/etc/ fstabが機能しているかどうかをテストするには、クライアントを再起動します。
reboot
再起動後、出力に共有が表示されます...
df -h
...そして...
mount
/ etc / fstabを変更しても問題が解決しない場合は、/ etc / fstabへの変更を元に戻し、代わりにこの行を/etc/rc.localに追加します(exit 0行の前):
vi /etc/rc.local
[...] /bin/mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs [...] |
これにより、ネットワークが起動した後に共有が確実にマウントされます。
4つのリンク
- GlusterFS:http://www.gluster.org/
- Debian:http://www.debian.org/