ストレージサーバー · 2 min read · Feb 05, 2026
CentOS 6.3でGlusterFS 3.2.xを使用してNFSのようなスタンドアロンストレージサーバーを作成する
このチュートリアルでは、CentOS 6.3でスタンドアロンストレージサーバーを設定する方法を示します。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 (サーバー)
- server2.example.com: IPアドレス 192.168.0.101 (クライアント)
両方のシステムは、他のシステムのホスト名を解決できる必要があります。これがDNSを介してできない場合は、/etc/hostsファイルを編集して、両方のシステムで次のように見えるようにしてください:
vi /etc/hosts| 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 192.168.0.100 server1.example.com server1 192.168.0.101 server2.example.com server2 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 |
(次の設定では、ホスト名の代わりにIPアドレスを使用することも可能です。IPアドレスを使用することを好む場合は、ホスト名が解決できるかどうかを気にする必要はありません。)
2 追加リポジトリの有効化
server1/server2:
まず、ソフトウェアパッケージのGPGキーをインポートします:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*次に、2つのCentOSシステムでEPEL6リポジトリを有効にします:
rpm --import https://fedoraproject.org/static/0608B895.txtcd /tmp
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm -ivh epel-release-6-7.noarch.rpmyum install yum-priorities/etc/yum.repos.d/epel.repoを編集します…
vi /etc/yum.repos.d/epel.repo…そして、[epel]セクションにpriority=10という行を追加します:
| [epel] name=Extra Packages for Enterprise Linux 6 - $basearch #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch failovermethod=priority enabled=1 priority=10 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 [...] |
3 GlusterFSサーバーの設定
server1.example.com:
GlusterFSはEPEL用のパッケージとして利用可能であるため、次のようにインストールできます:
yum install glusterfs-serverGlusterデーモンのシステム起動リンクを作成し、起動します:
chkconfig --levels 235 glusterd on
/etc/init.d/glusterd startコマンド
glusterfsd --versionは、あなたがインストールしたばかりのGlusterFSのバージョンを表示するはずです(この場合は3.2.7):
[root@server1 ~]# glusterfsd --version
glusterfs 3.2.7 built on Jun 11 2012 13:22:28
Repository revision: git://git.gluster.com/glusterfs.git
Copyright (c) 2006-2011 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 ~]# ファイアウォールを使用している場合は、server1.example.comでTCPポート111、24007、24008、24009-(すべてのボリュームにわたるブリックの数)が開いていることを確認してください。
次に、/dataディレクトリにlocalhost(= server1)にtestvolという名前の共有を作成します(存在しない場合は作成されます):
gluster volume create testvol server1.example.com:/data[root@server1 ~]# gluster volume create testvol server1.example.com:/data
Creation of volume testvol has been successful. Please start the volume to access data.
[root@server1 ~]#ボリュームを開始します:
gluster volume start testvolボリュームの状態は、次のコマンドで確認できます
gluster volume info[root@server1 ~]# gluster volume infoVolume Name: testvol
Type: Distribute
Status: Started
Number of Bricks: 1
Transport-type: tcp
Bricks:
Brick1: server1.example.com:/data
[root@server1 ~]#ボリュームが開始されたと表示されれば、すべて正常です。そうでない場合は、再度開始してください。
デフォルトでは、すべてのクライアントがボリュームに接続できます。client1.example.com(= 192.168.0.101)のみへのアクセスを許可したい場合は、次のコマンドを実行します:
gluster volume set testvol auth.allow 192.168.0.101IPアドレスにワイルドカード(192.168.*のような)を使用することが可能であり、カンマで区切って複数のIPアドレスを指定することもできます(例:192.168.0.101,192.168.0.102)。
ボリューム情報は、次のように更新された状態を表示するはずです:
gluster volume info[root@server1 ~]# gluster volume infoVolume Name: testvol
Type: Distribute
Status: Started
Number of Bricks: 1
Transport-type: tcp
Bricks:
Brick1: server1.example.com:/data
Options Reconfigured:
auth.allow: 192.168.0.101
[root@server1 ~]# 4 GlusterFSクライアントの設定
server2.example.com:
クライアントでは、次のようにGlusterFSクライアントをインストールできます:
yum install glusterfs-client次に、次のディレクトリを作成します:
mkdir /mnt/glusterfsこれで完了です!次のコマンドでGlusterFSファイルシステムを/mnt/glusterfsにマウントできます:
mount.glusterfs server1.example.com:/testvol /mnt/glusterfs次の出力に新しい共有が表示されるはずです…
mount[root@server2 ~]# mount
/dev/mapper/vg_client1-LogVol00 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)
server1.example.com:/testvol on /mnt/glusterfs type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)
[root@server2 ~]#…と…
df -h[root@server2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_client1-LogVol00
9.7G 1.7G 7.5G 19% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 504M 39M 440M 9% /boot
server1.example.com:/testvol
9.7G 1.7G 7.5G 19% /mnt/glusterfs
[root@server2 ~]#/etc/fstabを変更して、クライアントが起動するときに共有が自動的にマウントされるようにすることもできます。
/etc/fstabを開き、次の行を追加します:
vi /etc/fstab| [...] server1.example.com:/testvol /mnt/glusterfs glusterfs defaults,_netdev 0 0 |
変更した/etc/fstabが機能しているかテストするには、クライアントを再起動します:
reboot再起動後、次の出力に共有が表示されるはずです…
df -h…と…
mount5 リンク
- GlusterFS: http://www.gluster.org/
- GlusterFS 3.2 ドキュメント: http://download.gluster.com/pub/gluster/glusterfs/3.2/Documentation/AG/html/index.html
- CentOS: http://www.centos.org/
新しい投稿を受信箱で受け取る
スパムはありません。いつでも購読を解除できます。