温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

NFS 企业优化

发布时间:2020-06-16 21:05:05 来源:网络 阅读:723 作者:chenshoubiao 栏目:安全技术



安全挂载参数:

mount -t nfs -o nosuid,noexec,nodev,rw 192.168.3.188:/data /mnt


、测试NFS服务端默认共享参数选项:

[root@NFSClient /]# mount -t nfs -o nosuid,noexec,nodev,rw 192.168.3.188:/data /mnt


[root@NFSClient mnt]# cat test.sh

Pwd

[root@NFSClient mnt]# chmod +x test.sh   

[root@NFSClient mnt]# ./test.sh

bash: ./test.sh: Permission denied


[root@NFSClient mnt]# sh test.sh

/mnt


提示:权限不够,就是因为上面挂载的时候加了noexec参数,

这个参数让可以执行的文件本身执行不了,如果指定解释器sh test.sh 这样子就可以执行。



在挂载目录下强制卸载

[root@NFSClient mnt]# umount -lf /mnt


二、NFS Server 默认的挂载参数和NFS Client默认的挂载参数

[root@NFSServer ~]# cat /var/lib/nfs/etab ==》服务端

/data   192.168.3.0/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,root_squash,no_all_squash)



[root@NFSClient ~]# grep mnt /proc/mounts ==》客户端

192.168.3.188:/data/ /mnt nfs4 rw,relatime,vers=4,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.3.200,minorversion=0,local_lock=none,addr=192.168.3.188 0 0

rsize,wsize 这两个就是很重要的参数


下面测试修改那两个参数的值测试一下速度

[root@NFSClient ~]# time dd if=/dev/zero of=/mnt/testfile bs=9k count=20000

20000+0 records in

20000+0 records out

184320000 bytes (184 MB) copied, 17.7761 s, 10.4 MB/s


real    0m17.834s

user    0m0.017s

sys     0m8.440s


NFS网络文件系统优化挂载的参数建议

性能优化

[root@NFSClient~]#mount -t nfs -o noatime,nodiratime,rsize=131072,wsize=131072 192.168.3.188:/data /mnt



缺省设置:

[root@NFSServer ~]# cat /proc/sys/net/core/rmem_default

112640

该文件指定了接收套接字缓冲区大小的缺省值(单位是字节)

[root@NFSServer ~]# cat /proc/sys/net/core/rmem_max 

112640

该文件指定了接收套接字缓冲区大小的缺省值(单位是字节)



加到这个文件里面永久生效,加载配置sysctl –p


一、exportfs命令介绍

exportfs -rv == /etc/init.d/nfs reload  加载配置文件

[root@NFSServer ~]# exportfs -o rw,sync 192.168.3.188:/data

[root@NFSServer ~]# exportfs -o rw,sync,all_squash,anonuid=555,anongid=555 192.168.3.188:/data


这个命令不用配置文件共享目录



二、错误检查

[root@NFSServer ~]# rpcinfo -p localhost

   program vers proto   port  service

    100000    4   tcp    111  portmapper

100000    3   tcp    111  portmapper

    100011    2   udp    875  rquotad

    100011    1   tcp    875  rquotad

    100003    2   tcp   2049  nfs

    100003    3   tcp   2049  nfs

    100003    4   tcp   2049  nfs

    100227    2   tcp   2049  nfs_acl

    100227    3   tcp   2049  nfs_acl

==》查看nfs有没有向rpc注册端口


Nfs的帮助man exports

mount –a  检测配置文件fstab有没有错误


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI