GNU/Linux >> Linux の 問題 >  >> Ubuntu

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

このチュートリアルでは、4つの単一ストレージサーバー(Ubuntu 12.10を実行)をGlusterFSを使用して1つの大容量ストレージサーバー(分散ストレージ)に結合する方法を示します。クライアントシステム(Ubuntu 12.10も)は、ローカルファイルシステムであるかのようにストレージにアクセスできます。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(クライアント)

このチュートリアルのすべてのステップをroot権限で実行するため、このチュートリアルのすべてのコマンドの前に文字列sudoを付けるか、

と入力して今すぐrootになります。
sudo su 

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はUbuntu12.10のパッケージとして利用できるため、次のようにインストールできます。

apt-get install glusterfs-server

コマンド

glusterfsd --version

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

[メール保護]:〜#glusterfsd --version
glusterfs3.2.5ビルド日2012年1月31日07:39:58
リポジトリリビジョン:git://git.gluster.com/glusterfs.git
Copyright(c)2006-2011 Gluster Inc.
GlusterFSには一切の保証がありません。
GlusterFSのコピーは、 GNU General PublicLicense。
[メール保護]:〜#

ファイアウォールを使用する場合は、TCPポート111、24007、24008、24009-(24009 +すべてのボリュームにわたるブリックの数)がserver1.example.com、server2.example.com、server3.example.com、およびserver4.example.com。

次に、server2.example.com、server3.example.com、server4.example.comを信頼できるストレージプールに追加する必要があります(server1.example.comからすべてのGlusterFS構成コマンドを実行していることに注意してください。ただし、次のようにすることもできます。構成はGlusterFSノード間で複製されるため、server2.example.com、server3.example.com、またはserver4.example.comから実行してください。正しいホスト名またはIPアドレスを使用していることを確認してください):

server1.example.com:

server1.example.comで、

を実行します

glusterピアプローブserver2.example.com
glusterピアプローブserver3.example.com
glusterピアプローブserver4.example.com

出力は次のようになります。

[メール保護]:〜#glusterピアプローブserver2.example.com
プローブが成功しました
[メール保護]:〜#

これで、信頼できるストレージプールのステータスは次のようになります。

gluster peer status

[メール保護]:〜#glusterピアステータス
ピア数:3

ホスト名:server2.example.com
Uuid:da79c994-eaf1-4c1c-a136-f8b273fb0c98
状態:クラスター内のピア(接続済み)

ホスト名:server3.example.com
Uuid:3e79bd9f-a4d5-4373-88e1-40f12861dcdd
状態:クラスター内のピア(接続済み)

ホスト名:server4.example.com
Uuid:c6215943-00f3-492f-9b69-3aa534c1d8f3
状態:クラスター内のピア(接続済み)
[メール保護]:〜#

次に、/ dataディレクトリのserver1.example.com、server2.example.com、server3.example.com、server4.example.comにtestvolという名前の分散共有を作成します(これは、存在しない場合に作成されます) :

gluster volume create testvol transport tcp server1.example.com:/data server2.example.com:/data server3.example.com:/data server4.example.com:/data

[メール保護]:〜#gluster volume create testvol transport tcp server1.example.com:/data server2.example.com:/data server3.example.com:/data server4.example.com:/data
Creationボリュームtestvolの成功しています。ボリュームを起動してデータにアクセスしてください。
[メールで保護]:〜#

ボリュームを開始します:

gluster volume start testvol

上記のコマンドは、アクションが成功しなかったことを示している可能性があります:

[メール保護]:〜#gluster volume start testvol
ボリュームtestvolの開始に失敗しました
[メール保護]:〜#

この場合、次の出力を確認する必要があります...

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

netstat -tap | grep glusterfsd

両方のサーバーで。

このような出力が得られたら...

[メールで保護]:〜#netstat -tap | grepのglusterfsd
TCP 0 0 *:24009 *:* LISTEN 1110 / glusterfsd
TCP 0 0 localhost.localdom:1019 localhost.localdo:24007 ESTABLISHED 1110 / glusterfsd
[電子メールが保護された]:〜 #

...すべて問題ありませんが、出力が得られない場合は...

[メール保護]:〜#netstat -tap | grep glusterfsd
[メール保護]:〜#

[メール保護]:〜#netstat -tap | grep glusterfsd
[メール保護]:〜#

[メール保護]:〜#netstat -tap | grep glusterfsd
[メール保護]:〜#

...対応するサーバー(この場合はserver2.example.com、server3.example.com、server4.example.com)でGlusterFSデーモンを再起動します。

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

/etc/init.d/glusterfs-server restart

次に、...

の出力を確認します
netstat -tap | grep glusterfsd

...これらのサーバーでも-次のようになります:

[メールで保護]:〜#netstat -tap | grepのglusterfsd
TCP 0 0 *:24009 *:* LISTEN 1152 / glusterfsd
TCP 0 0 localhost.localdom:1018 localhost.localdo:24007 ESTABLISHED 1152 / glusterfsd
[電子メールが保護された]:〜 #

[メールで保護]:〜#netstat -tap | grepのglusterfsd
TCP 0 0 *:24009 *:* LISTEN 1311 / glusterfsd
TCP 0 0 localhost.localdom:1018 localhost.localdo:24007 ESTABLISHED 1311 / glusterfsd
[電子メールが保護された]:〜 #

[メールで保護]:〜#netstat -tap | grepのglusterfsd
TCP 0 0 *:24009 *:* LISTEN 1297 / glusterfsd
TCP 0 0 localhost.localdom:1019 localhost.localdo:24007 ESTABLISHED 1297 / glusterfsd
[電子メールが保護された]:〜 #

ここでserver1.example.comに戻ります:

server1.example.com:

コマンド

を使用して、ボリュームのステータスを確認できます。
gluster volume info
[email protected]:~# gluster volume info

ボリューム名:testvol
タイプ:配布
ステータス:開始
ブリックの数:4
トランスポートタイプ:tcp
ブリック:
ブリック1:server1。 example.com:/ data
Brick2:server2.example.com:/ data
Brick3:server3.example.com:/ data
Brick4:se​​rver4.example.com:/ data
[メール保護]:〜#

デフォルトでは、すべてのクライアントがボリュームに接続できます。 client1.example.com(=192.168.0.104)のみへのアクセスを許可する場合は、次を実行します。

gluster volume set testvol auth.allow 192.168.0.104

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

ボリューム情報に更新されたステータスが表示されます:

gluster volume info
[email protected]:~# gluster volume info

ボリューム名:testvol
タイプ:配布
ステータス:開始
ブリックの数:4
トランスポートタイプ:tcp
ブリック:
ブリック1:server1。 example.com:/ data
Brick2:server2.example.com:/ data
Brick3:server3.example.com:/ data
Brick4:se​​rver4.example.com:/ data
再構成されたオプション:
auth.allow:192.168.0.104
[メールで保護]:〜#

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

client1.example.com:

クライアントでは、次のようにGlusterFSクライアントをインストールできます。

apt-get install glusterfs-client

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

mkdir /mnt/glusterfs

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

mount.glusterfs server1.example.com:/testvol /mnt/glusterfs

(server1.example.comの代わりに、上記のコマンドでserver2.example.com、server3.example.com、server4.example.comを使用することもできます!)

これで、出力に新しいシェアが表示されるはずです...

mount

[メール保護]:〜#mount
/ dev / mapper / server5-root on / type ext4(rw、errors =remount-ro)
proc on / proc type proc(rw、noexec、nosuid、 nodev)
sysfs on / sys type sysfs(rw、noexec、nosuid、nodev)
fusectl on / sys / fs / Fuse / connections type destroyctl(rw)
none on / sys / kernel / debug type debugfs(rw)
none on / sys / kernel / security type securityfs(rw)
udev on / dev type devtmpfs(rw、mode =0755)
devpts on / dev / pts type devpts(rw、noexec、nosuid、gid =5、mode =0620)
tmpfs on / run type tmpfs(rw、noexec、nosuid、size =10%、mode =0755)
none on / run / lock type tmpfs(rw、noexec、nosuid、nodev、size =5242880)
none on / run / shm type tmpfs(rw、nosuid、nodev)
/ dev / sda1 on / boot type ext2(rw)
server1.example.com:/testvol on / mnt / glusterfs type Fuse.glusterfs(rw、allow_other、default_permissions、max_read =131072)
[email protected]:〜#

>

...そして...

df -h

[メールで保護]:〜#df -h
ファイルシステム使用済み使用率使用率
/ dev / mapper / server5-root
dev 4%G 1.1G 238M 4.0K 238M 1%/ devの
TMPFS 99M 212K 99M 1%/ラン
なし247M 0 247M 0%/実行/ SHM / dev / sda1 228M 24M 193M 11%/ boot
server1.example.com:/testvol
nt 〜#

GlusterFS共有をクライアントに手動でマウントする代わりに、/ etc / fstabを変更して、クライアントの起動時に共有が自動的にマウントされるようにすることができます。

/ etc / fstabを開き、次の行を追加します。

vi /etc/fstab 
[...]
server1.example.com:/testvol /mnt/glusterfs glusterfs defaults,_netdev 0 0

(ここでも、server1.example.comの代わりに、server2.example.com、server3.example.com、server4.example.comを使用することもできます!)

変更した/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ディレクトリを確認しましょう。各ストレージノードは、クライアント上のGlusterFS共有を構成するファイル/ディレクトリの一部のみを保持していることに気付くでしょう:

server1.example.com:

ls -l /data

[メール保護]:〜#ls -l / data
total 0
-rw-r--r-- 1 root root 0 2012-12-17 14:26 test1
-rw -r--r--1ルートルート02012-12-1714:26 test2
-rw-r--r--1ルートルート02012-12-1714:26 test5
[メール保護]:〜#

server2.example.com:

ls -l /data

[メール保護]:〜#ls -l / data
total 0
-rw-r--r-- 1 root root 0 2012-12-17 14:26 test4
[email保護されています]:〜#

server3.example.com:

ls -l /data

[メール保護]:〜#ls -l / data
total 0
-rw-r--r-- 1 root root 0 2012-12-17 14:26 test6
[email保護されています]:〜#

server4.example.com:

ls -l /data

[メール保護]:〜#ls -l / data
total 0
-rw-r--r-- 1 root root 0 2012-12-17 14:26 test3
[email保護されています]:〜#

  • GlusterFS:http://www.gluster.org/
  • GlusterFS 3.2ドキュメント:http://download.gluster.com/pub/gluster/glusterfs/3.2/Documentation/AG/html/index.html
  • Ubuntu:http://www.ubuntu.com/

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

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

  3. Ubuntu12.10上のGlusterFS3.2.xを使用した2つのストレージサーバー間での自動ファイルレプリケーション(ミラーリング)

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

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

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

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

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

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