0x1 问题背景
以前truenas core自带的nfs服务,分别共享了 docker swarm 的共享目录(2.7T),jenkins 数据目录(280G),seafile 数据目录(900G)。这三个目录非常多的小文件,甚至在统计目录大小的时候,十来分钟都无法出结果
也许是这个原因,默认的nfs服务共享了多个超多小文件的目录,以及共享到了多台机器。导致经常出现 INPUT/OUTPUT error,现象如下:
客户端挂载参数:
192.168.10.16:/mnt/dev1/jenkins on /var/jenkins_home type nfs4 (rw,noatime,nodiratime,vers=4.0,rsize=131072,wsize=131072,namlen=255,hard,noresvport,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.3.106,local_lock=none,addr=192.168.10.16,_netdev)
创建新文件直接报错,但是创建目录没有问题
[root@localhost 123]# touch 1122
touch: cannot touch ‘1122’: Input/output error
[root@localhost 123]# touch 2233
touch: cannot touch ‘2233’: Input/output error
[root@localhost 123]# touch 3344
touch: cannot touch ‘3344’: Input/output error
[root@localhost 123]# mkdir 1122
[root@localhost 123]# mkdir 2233
[root@localhost 123]# mkdir 3344
[root@localhost 123]# touch 4455
touch: cannot touch ‘4455’: Input/output error
[root@localhost 123]# touch 5566
touch: cannot touch ‘5566’: Input/output error
重新客户端挂载,会正常一会儿,但是有一会儿又不行了
[root@localhost 123]# cd
[root@localhost ~]# umount /var/jenkins_home/
[root@localhost ~]# mount -a
[root@localhost ~]# cd /var/jenkins_home/123/
[root@localhost 123]# touch 1111
[root@localhost 123]# touch 2222
[root@localhost 123]# touch 3333
[root@localhost 123]# touch 4444
[root@localhost 123]# touch 5555
touch: cannot touch ‘5555’: Input/output error
[root@localhost 123]# touch 6666
touch: cannot touch ‘6666’: Input/output error
[root@localhost 123]# touch 1111
[root@localhost 123]# touch 2222
[root@localhost 123]# touch 3333
[root@localhost 123]# touch 4444
[root@localhost 123]# touch 5555
touch: cannot touch ‘5555’: Input/output error
[root@localhost 123]# touch aaaa
touch: cannot touch ‘aaaa’: Input/output error
[root@localhost 123]# touch bbbb
touch: cannot touch ‘bbbb’: Input/output error
[root@localhost 123]# mkdir 5555
[root@localhost 123]# mkdir 6666
抓包发现很多过期的告警,很明显是不正常的,nfs的会话正常也不应该创建、列出一下就会有多个过期的响应
这个问题尝试了很多方案,使用不同的nfs版本挂载,把一部分数据迁移到其他的池以减少单个池的读写或者文件数量,但结果仍然不行。所以最后怀疑是Truenas core的nfs问题,有可能小文件太多性能不足、有可能多个nfs目录对应多个不同的客户端(网络传输过程中客户端ip识别有问题,导致会话过期)等,所以最后下定决心使用多个nfs server来解决这个问题
0x2 目标和方案
目标: 每个需要共享的数据集目录使用单独的nfs server,以单独维护每个共享目录,以及减少单个共享目录访问的客户端ip,以及文件并发
评论