GlusterFS · 2 min read · Feb 09, 2026

Debian SqueezeでGlusterFS 3.0.xを使用したNFSのようなスタンドアロンストレージサーバーの作成

このチュートリアルでは、Debian Squeeze上にスタンドアロンストレージサーバーを設定する方法を示します。NFSの代わりに、ここではGlusterFSを使用します。クライアントシステムは、ローカルファイルシステムのようにストレージにアクセスできるようになります。GlusterFSは、数ペタバイトにスケール可能なクラスターファイルシステムです。Infiniband RDMAまたはTCP/IPインターコネクトを介して、さまざまなストレージブリックを1つの大きな並列ネットワークファイルシステムに集約します。ストレージブリックは、SATA-II RAIDおよびInfiniband HBAを備えた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 # IPv6対応ホストに対しては以下の行が望ましい ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters |

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

2 GlusterFSサーバーの設定

server1.example.com:

GlusterFSはDebian Squeeze用のパッケージとして利用可能であるため、次のようにインストールできます:

apt-get install glusterfs-server

コマンド

glusterfs --version

は、今インストールしたGlusterFSのバージョン(この場合は3.0.5)を表示するはずです:

root@server1:~# glusterfs --version  
glusterfs 3.0.5 built on Jul 13 2010 16:44:21  
Repository revision: v3.0.5  
Copyright (c) 2006-2009 Gluster Inc.   
GlusterFSは完全に無保証で提供されます。  
GNU一般公衆ライセンスの条件の下でGlusterFSのコピーを再配布することができます。  
root@server1:~#

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

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 # 許可されたクライアントのIPアドレス(名前)をカンマ区切りでここに追加 subvolumes brick end-volume |

IPアドレスにワイルドカード(192.168.*のような)を使用することが可能であり、カンマで区切って複数のIPアドレスを指定することもできます(例:192.168.0.101,192.168.0.102)。

その後、GlusterFSサーバーを起動します:

/etc/init.d/glusterfs-server start

3 GlusterFSクライアントの設定

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 # IPまたはホスト名 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 |

option remote-host行に正しいサーバーホスト名またはIPアドレスを使用していることを確認してください!

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

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

または

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

次の出力に新しい共有が表示されるはずです…

mount
root@client1:~# 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 fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)  
root@client1:~#

… と…

df -h
root@client1:~# df -h  
Filesystem            Size  Used Avail Use% Mounted on  
/dev/sda1             29G  778M   27G   3% /  
tmpfs                 249M     0  249M   0% /lib/init/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  
root@client1:~#

クライアントで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 リンク

Share: X/Twitter LinkedIn

新しい投稿を受信箱で受け取る

スパムはありません。いつでも購読を解除できます。