GlusterFS · 2 min read · Feb 04, 2026

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

このチュートリアルでは、Fedora 13でスタンドアロンストレージサーバーを設定する方法を示します。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ファイルを編集して、両方のシステムに次の2行を含める必要があります:

vi /etc/hosts

| [...] 192.168.0.100 server1.example.com server1 192.168.0.101 client1.example.com client1 [...] |

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

2 GlusterFSサーバーの設定

server1.example.com:

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

yum install glusterfs-server

コマンド

glusterfs --version

は、あなたがちょうどインストールしたGlusterFSのバージョンを表示するはずです(この場合は2.0.9):

[root@server1 ~]# glusterfs --version  
glusterfs 2.0.9 built on Apr 11 2010 20:39:55  
Repository revision: v2.0.9  
Copyright (c) 2006-2009 Gluster Inc.   
GlusterFS comes with ABSOLUTELY NO WARRANTY.  
You may redistribute copies of GlusterFS under the terms of the GNU General Public License.  
[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 # 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サーバーのシステム起動リンクを作成し、起動します:

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

3 GlusterFSクライアントの設定

client1.example.com:

Fedora 13用のGlusterFSクライアントrpmパッケージがありますが、問題は、GlusterFS共有にアクセスしようとすると、df: /mnt/glusterfs': Software caused connection abortやdf:/mnt/glusterfs’: Transport endpoint is not connectedのようなエラーが発生することです。これが理由で、これらの問題を回避するためにソースからGlusterFSクライアントをビルドします。

GlusterFSクライアントをビルドする前に、その前提条件をインストールします:

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

次に、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 configure summary  
===========================  
FUSE client        : yes  
Infiniband verbs   : yes  
epoll IO multiplex : yes  
Berkeley-DB        : yes  
libglusterfsclient : yes  
argp-standalone    : no  
  
[root@client1 glusterfs-2.0.9]#
make && make install  
ldconfig

その後、GlusterFSのバージョンを確認します(2.0.9であるべきです):

glusterfs --version
[root@client1 glusterfs-2.0.9]# glusterfs --version  
glusterfs 2.0.9 built on Sep 27 2010 19:20:46  
Repository revision: v2.0.9  
Copyright (c) 2006-2009 Gluster Inc.   
GlusterFS comes with ABSOLUTELY NO WARRANTY.  
You may redistribute copies of GlusterFS under the terms of the GNU General Public License.  
[root@client1 glusterfs-2.0.9]#

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

mkdir /mnt/glusterfs  
mkdir /etc/glusterfs

次に、ファイル/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
[root@client1 glusterfs-2.0.9]# mount  
/dev/mapper/vg_client1-lv_root on / type ext4 (rw)  
proc on /proc type proc (rw)  
sysfs on /sys type sysfs (rw)  
devpts on /dev/pts type devpts (rw,gid=5,mode=620)  
tmpfs on /dev/shm type tmpfs (rw)  
/dev/sda1 on /boot type ext4 (rw)  
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)  
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)  
/etc/glusterfs/glusterfs.vol on /mnt/glusterfs type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)  
[root@client1 glusterfs-2.0.9]#

… と…

df -h
[root@client1 glusterfs-2.0.9]# df -h  
Filesystem            Size  Used Avail Use% Mounted on  
/dev/mapper/vg_client1-lv_root  
                       29G  2.6G   25G  10% /  
tmpfs                 185M     0  185M   0% /dev/shm  
/dev/sda1             194M   23M  161M  13% /boot  
/etc/glusterfs/glusterfs.vol  
                       29G  2.7G   25G  10% /mnt/glusterfs  
[root@client1 glusterfs-2.0.9]#

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

Share: X/Twitter LinkedIn

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

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