構成
OSはCentOS6.5。GlusterFSはバージョン3.7.12を使用。
2台構成の分散ボリューム「distributed」で構築しサーバとクライアントを兼ねる。
追加した20GBのディスクを分散ボリュームに使用する。
(参考) ディスクを追加してxfsでフォーマットする
-
1号機にGlusterFSサーバインストール
# wget http://download.gluster.org/pub/gluster/glusterfs/3.7/LATEST/CentOS/glusterfs-epel.repo -P /etc/yum.repos.d
# yum install -y --enablerepo=glusterfs-epel glusterfs-server
# service glusterd start
# chkconfig glusterd on
# vi /etc/hosts
192.168.0.1 gfs01 192.168.0.2 gfs02 -
iptables設定 (便宜上ざっくり)
# vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp -s 192.168.0.0/24 --dport 111 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp -s 192.168.0.0/24 --dport 111 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp -s 192.168.0.0/24 --dport 2049:49199 -j ACCEPT
# service iptables restart -
ログローテート設定
# vi /etc/logrotate.d/glusterfs
/var/log/glusterfs/*.log { sharedscripts daily rotate 7 missingok notifempty dateext postrotate /usr/bin/killall -HUP glusterfs > /dev/null 2>&1 || true /usr/bin/killall -HUP glusterd > /dev/null 2>&1 || true endscript } /var/log/glusterfs/bricks/*.log { sharedscripts daily rotate 7 missingok notifempty dateext postrotate /usr/bin/killall -HUP glusterfsd > /dev/null 2>&1 || true endscript } -
2号機も同様に設定
-
ストレージプールの作成 (1号機)
# gluster peer probe gfs02 -
確認 (1号機)
# gluster peer status Number of Peers: 1 Hostname: gfs02 Uuid: eedf2e27-93cd-4de2-b14c-cef7642c2cbd State: Peer in Cluster (Connected) -
確認 (2号機)
# gluster peer status Number of Peers: 1 Hostname: gfs01 Uuid: 7bb7d79e-8dc0-479b-b6c8-ca335e7e082d State: Peer in Cluster (Connected) -
ボリューム用のディレクトリ作成 (1号機、2号機)
# mkdir -p /mnt/gfs_vol/distributed -
ボリューム作成 (1号機)
# gluster volume create vol_distributed gfs01:/mnt/gfs_vol/distributed gfs02:/mnt/gfs_vol/distributed
# gluster volume start vol_distributed -
ボリュームの確認 (1号機、2号機)
# gluster volume info Volume Name: vol_distributed Type: Distribute Volume ID: 1474a2e5-0cf3-4a52-9cd7-9a0a1b1e2ed4 Status: Started Number of Bricks: 2 Transport-type: tcp Bricks: Brick1: gfs01:/mnt/gfs_vol/distributed Brick2: gfs02:/mnt/gfs_vol/distributed Options Reconfigured: performance.readdir-ahead: on
# gluster volume info Volume Name: vol_distributed Type: Distribute Volume ID: 1474a2e5-0cf3-4a52-9cd7-9a0a1b1e2ed4 Status: Started Number of Bricks: 2 Transport-type: tcp Bricks: Brick1: gfs01:/mnt/gfs_vol/distributed Brick2: gfs02:/mnt/gfs_vol/distributed Options Reconfigured: performance.readdir-ahead: on -
GlusterFSクライアントインストール、設定 (1号機、2号機)
yum install -y --enablerepo=glusterfs-epel glusterfs glusterfs-fuse -
マウントポイント作成 (1号機、2号機)
# mkdir -p /mnt/glusterfs_vol -
作成した分散ファイルシステムをマウント (1号機、2号機)
# mount -t glusterfs gfs01:/vol_distributed /mnt/glusterfs_vol -
自動マウント設定 (1号機、2号機)
# vi /etc/fstab gfs01:/vol_distributed /mnt/glusterfs_vol glusterfs defaults,_netdev 0 0 -
分散ファイルシステム(40GB)のマウント確認 (1号機、2号機)
# df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/mapper/vg_nonmem01-lv_root ext4 20243012 5823008 13371428 31% / tmpfs tmpfs 1962856 72 1962784 1% /dev/shm /dev/sda1 ext4 495844 88461 381783 19% /boot /dev/mapper/vg_nonmem01-lv_data ext4 19492656 1836472 16607608 10% /var /dev/sdc1 xfs 20954552 33012 20921540 1% /mnt/gfs_vol gfs01:/vol_distributed fuse.glusterfs 41908992 65920 41843072 1% /mnt/glusterfs_vol
終わり
