December 28, 2014

el7 用 samba-vfs-glusterfs の挙動が怪しい

続き書いた -> 続: el7 用 samba-vfs-glusterfs の挙動が怪しい

GlusterFS をファイルサーバ(samba, cifs)として使う場合、最近だと GlusterFS VFS plugin for Samba を使って実現することになりますよね。GlusterFS を一回 fuse とかでマウントしてから samba に渡すよりスマートでパフォーマンス面でも期待が持てそうです。Red Hat Storage Server 3.0 とかもこの方法を採用している様です。

というわけで試してみたのだけど、なんか el7 系で作ると動きがアヤシい。。。

[kazuhisya@macbookair ~]$ df -h
Filesystem                               Size  Used Avail Use% Mounted on
/dev/disk1                               112G   46G   67G  41% /
//root@192.168.86.109/el6-gluster-vol1    16G   33M   16G   1% /Volumes/el6-gluster-vol1
//root@192.168.86.110/el7-gluster-vol1    64T  130G   64T   1% /Volumes/el7-gluster-vol1
//root@192.168.86.112/fc21-gluster-vol1   16G   33M   16G   1% /Volumes/fc21-gluster-vol1

16GB で領域作っているのに、el7 系でつくると 64TB とかになってるんですけど。。。

最初、クライアントに使ってる OS X がいつもどおり悪いんじゃねーのー、と思ったけど Windows からネットワークドライブとして繋げても同様の問題が発現する。

次に samba 4.1 が食い合わせ悪いのかなーと思ってみたのだけど、el6 + samba 4.1 や、Fedora21 で再現しないことから、どうやら el7 特有の模様。

また、gluster バックエンドでないディレクトリを samba で出したときは普通に正しい容量が見えるので、恐らく samba - glusterfs の繋ぎ込み、つまり samba-vfs-glusterfs がアヤシのかなぁ。。。後で bugzilla 漁る。

以下作業メモとして残しておく。検証環境は4パターン。

el6 (samba3.6.x)

[root@el6-gluster1 ~]# lsb_release -a
LSB Version:  :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID:  CentOS
Description:  CentOS release 6.6 (Final)
Release:  6.6
Codename:  Final

[root@el6-gluster1 ~]# uname -a
Linux el6-gluster1 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 17 01:55:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

[root@el6-gluster1 ~]# rpm -qa |grep "samba\|gluster" |sort
glusterfs-3.6.1-1.el6.x86_64
glusterfs-api-3.6.1-1.el6.x86_64
glusterfs-cli-3.6.1-1.el6.x86_64
glusterfs-fuse-3.6.1-1.el6.x86_64
glusterfs-libs-3.6.1-1.el6.x86_64
glusterfs-server-3.6.1-1.el6.x86_64
samba-glusterfs-3.6.23-12.el6.x86_64
samba-3.6.23-12.el6.x86_64
samba-client-3.6.23-12.el6.x86_64
samba-common-3.6.23-12.el6.x86_64
samba-winbind-3.6.23-12.el6.x86_64
samba-winbind-clients-3.6.23-12.el6.x86_64

glusterfs は http://www.gluster.org/ から持ってきた。

el6 (samba4.1.x)

[root@el6-gluster2 ~]# lsb_release -a
LSB Version:  :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID:  CentOS
Description:  CentOS release 6.6 (Final)
Release:  6.6
Codename:  Final

[root@el6-gluster2 ~]# uname -a
Linux el6-gluster2 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 17 01:55:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

[root@el6-gluster2 ~]# rpm -qa |grep "samba\|gluster" |sort
glusterfs-3.6.1-1.el6.x86_64
glusterfs-api-3.6.1-1.el6.x86_64
glusterfs-cli-3.6.1-1.el6.x86_64
glusterfs-fuse-3.6.1-1.el6.x86_64
glusterfs-libs-3.6.1-1.el6.x86_64
glusterfs-server-3.6.1-1.el6.x86_64
samba-4.1.11-2.el6.x86_64
samba-client-4.1.11-2.el6.x86_64
samba-common-4.1.11-2.el6.x86_64
samba-libs-4.1.11-2.el6.x86_64
samba-vfs-glusterfs-4.1.11-2.el6.x86_64
samba-winbind-4.1.11-2.el6.x86_64
samba-winbind-clients-4.1.11-2.el6.x86_64
samba-winbind-modules-4.1.11-2.el6.x86_64

el6 + samba4.1 の組み合わせ。

el7

[root@el7-gluster1 ~]# lsb_release -a
LSB Version:  :core-4.1-amd64:core-4.1-noarch
Distributor ID:  CentOS
Description:  CentOS Linux release 7.0.1406 (Core)
Release:  7.0.1406
Codename:  Core

[root@el7-gluster1 ~]# uname -a
Linux el7-gluster1 3.10.0-123.13.2.el7.x86_64 #1 SMP Thu Dec 18 14:09:13 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

[root@el7-gluster1 ~]# rpm -qa |grep "samba\|gluster" |sort
glusterfs-3.6.1-1.el7.x86_64
glusterfs-api-3.6.1-1.el7.x86_64
glusterfs-cli-3.6.1-1.el7.x86_64
glusterfs-fuse-3.6.1-1.el7.x86_64
glusterfs-libs-3.6.1-1.el7.x86_64
glusterfs-server-3.6.1-1.el7.x86_64
samba-4.1.1-37.el7_0.x86_64
samba-client-4.1.1-37.el7_0.x86_64
samba-common-4.1.1-37.el7_0.x86_64
samba-libs-4.1.1-37.el7_0.x86_64
samba-vfs-glusterfs-4.1.1-37.el7_0.x86_64
samba-winbind-4.1.1-37.el7_0.x86_64
samba-winbind-clients-4.1.1-37.el7_0.x86_64
samba-winbind-modules-4.1.1-37.el7_0.x86_64

glusterfs は http://www.gluster.org/ から持ってきた。

Fedora21

[root@fc21-gluster1 ~]# lsb_release -a
LSB Version:  :core-4.1-amd64:core-4.1-noarch
Distributor ID:  Fedora
Description:  Fedora release 21 (Twenty One)
Release:  21
Codename:  TwentyOne

[root@fc21-gluster1 ~]# uname -a
Linux fc21-gluster1 3.17.7-300.fc21.x86_64 #1 SMP Wed Dec 17 03:08:44 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

[root@fc21-gluster1 ~]# rpm -qa |grep "samba\|gluster" |sort
glusterfs-3.5.3-1.fc21.x86_64
glusterfs-api-3.5.3-1.fc21.x86_64
glusterfs-cli-3.5.3-1.fc21.x86_64
glusterfs-fuse-3.5.3-1.fc21.x86_64
glusterfs-libs-3.5.3-1.fc21.x86_64
glusterfs-server-3.5.3-1.fc21.x86_64
samba-4.1.14-1.fc21.x86_64
samba-client-4.1.14-1.fc21.x86_64
samba-common-4.1.14-1.fc21.x86_64
samba-libs-4.1.14-1.fc21.x86_64
samba-vfs-glusterfs-4.1.14-1.fc21.x86_64
samba-winbind-4.1.14-1.fc21.x86_64
samba-winbind-clients-4.1.14-1.fc21.x86_64
samba-winbind-modules-4.1.14-1.fc21.x86_64

glusterfs は http://www.gluster.org/ から持ってきてバージョンをあわせても良かったのだけど、めんどくさがって fedora のリポジトリのものをそのままつかった。

GlusterFS 構築

pvcreate /dev/vdb1
vgcreate glustervg /dev/vdb1
vgchange -a y glustervg
lvcreate -a y -l 100%VG -n glusterlv glustervg
mkfs.xfs -i size=512 /dev/glustervg/glusterlv


mkdir -p /export/glusterlv
mount /dev/glustervg/glusterlv /export/glusterlv
echo "/dev/glustervg/glusterlv /export/glusterlv xfs defaults 0 2" >> /etc/fstab
mkdir -p /export/glusterlv/vol1

service glusterd start
  • kvm(というかウチは oVirt) な仮想マシンで virt-io 接続なので、ディスクは vdX に来る。ホントは md で束ねてからのが正式な方法なのだけど、動作検証だけなのでいきなり lvm を切っている。
  • el7, fc21 の場合、systemctl start glusterd とするのがお作法。service コマンドでも一応リダイレクトしてくれるのだけどね。。
gluster volume create vol1 `hostname`:/export/glusterlv/vol1
gluster volume start vol1

1台だけで gluster って本来ないのだけど、とりあえず 1 Brick だけで。

gluster volume set vol1 stat-prefetch off
gluster volume set vol1 server.allow-insecure on
gluster volume set vol1 storage.batch-fsync-delay-usec 0

/etc/glusterfs/glusterd.vol に以下追加。

    option rpc-auth-allow-insecure on

この辺りは Red Hat Storage 3 Administration Guide の指示に従って設定している。

設定できたら glusterd を再起動しておく。

service glusterd restart
  • el7, fc21 の場合、systemctl restart glusterd とするのがお作法(ry

samba 構築

実は glusterfs-server パッケージを入れていると、ボリューム起動時 /etc/samba/smb.conf に、gluster のボリュームを自動追記してくれるスクリプトが勝手に動くので、特に何も考えなくても以下の様なエントリが書かれている。

なお、こいつをこさえてるのは /var/lib/glusterd/hooks/1/start/post/S30samba-start.sh である。

[gluster-vol1]
comment = For samba share of volume vol1
vfs objects = glusterfs
glusterfs:volume = vol1
glusterfs:logfile = /var/log/samba/glusterfs-vol1.%M.log
glusterfs:loglevel = 7
path = /
read only = no
guest ok = yes

特にこのままでも問題無いのだが、以下の様に少し手を加えた。マジメに運用を行うときは、/etc/samba/smb.conf を直接編集せずに、S30samba-start.sh をナントカした方が良さそうだなぁ。

[gluster-vol1]
comment = For samba share of volume vol1
vfs objects = glusterfs
glusterfs:volume = vol1
glusterfs:logfile = /var/log/samba/glusterfs-vol1.%M.log
glusterfs:loglevel = 7
path = /
read only = no
guest ok = yes
wide links = no
writeable = yes
#public = yes
create mode = 660
directory mode = 770
kernel share modes = No
glusterfs:volfile_server = localhost
service smb restart
  • el7, fc21 の場合、systemctl restart smb とする(ry
smbpasswd -a root

とりあえずテスト的に繋ぐので root でパスワード設定。

© Kazuhisa Hara 2014-2022