zoukankan      html  css  js  c++  java
  • NFS安装配置

    1.安装nfs server, 将所有的机器都安装 包括客户端,如果客户端不装,可能会出问题,只是客户端不要启动就可以了
    yum install nfs-utils rpcbind –y
    2.启动服务
    /etc/init.d/rpcbind status   查看是否启动
         /etc/init.d/rpcbind start 启动
    /etc/init.d/rpcbind stop  停止


    Rpcbind 主端口为111
    已知某个服务的端口是111,如何找出相关的服务:
    lsof -i :111
    查看rpcbind 服务端口:
    netstat -lntup | grep rpcbind


    查看是否开启启动
    chkconfig --list rpcbind

    查看rpcbind池是否使用
    rpcinfo -p localhost

    查看NFS是否启动
    /etc/init.d/nfs status
    启动nfs服务
    /etc/init.d/nfs start

    nfs默认端口2049
    netstat -lntup | grep 2049

    将NFS加入启动
    chkconfig --list nfs 查看是否开机启动

    chkconfig nfs on  设置为启动

    NFS需要先启动rpcbind 然后再启动nfs服务

    查看启动顺序
    less /etc/init.d/rpcbind
    less /etc/init.d/nfs
    对比两个的启动顺序
    增加开机启动服务
    vim /etc/rc.local
    将启动的命令放在rc.loacl里边
    配置服务端
    /etc/exports 是管理nfs的配置文件
    创建date (共享)目录
    mkdir date
    设置date(共享)目录权限
    chown -R nfsnobody.nfsnobody /date
    vim /etc/exports
    /date192.168.100.0/24(rw,sync,all_squash,anonuid=65534,anongid=65534)          //将date目录共享给100网段给予读写权限,写入磁盘,首先需要创建date目录
    尝试启动:/etc/init.d/nfs reload   平滑启动加载 ,不影响客户使用。
    配置完成后需要重新启动NFS
    /etc/init.d/nfs start
    尝试在本地挂载共享目录
    查看挂载:
    showmount -e 127.0.0.1  检查是否可以连接
    mount -t 192.168.100.215:/date /mnt   //将共享目录挂载到mnt 目录
    查看是否挂载成功,使用磁盘查看:
    df -h
    客户端配置:
    /etc/init.d/rpcbind  start 客户端口需要启动rpcbind服务
    vim /etc/rc.local  添加启动  /etc/init.d/rpcbind  start   将rpcbind 加开机启动服务

    showmount -e 192.168.100.215  检查是否可以连接到服务器
    挂载共享目录
    mount -t nfs 192.168.100.215:/date /mnt 
    df -h 查看
    mount  查看
    cat /proc/mounts  以上三个命令都可以查看是否挂载成功
    查看客户端挂载情况和参数
    grep mnt /proc/mounts
    查看是否有65534 相关的用户:
      grep 65534 /etc/passwd
     
     
      nfs挂载优化:
     
      安全挂载参数
    mount -t nfs -o nosuid,noexec,nodev,rw 192.168.100.215:/date /mnt

    企业生产环境nfs性能优化挂载参数:
    禁止更新目录及文件时间戳挂载
    mount -t nfs -o noatime,nodiratime 192.168.100.215:/date /mnt
    安全加优化的挂载方式
    mount -t nfs -o nosuid,noexec,nodev,noatime,nodiratime,intr,rsize=131072,wsize=131072 192.168.100.215:/date /mnt
    默认的挂载方式
    mount -t nfs 192.168.100.215:/date /mnt
    NFS服务内核优化相关:
    1./proc/sys/net/core/rmem_default
    该文件指定了接收套接字缓冲区大小的缺省值(以字节为单位),缺省设置:124928
    2./proc/sys/net/core/rmem_max
    该文件指定了接收套接字缓冲区大小的最大值(以字节为单位),缺省设置:124928
    3./proc/sys/net/core/wmem_default
    该文件指定了发送套接字缓冲区大小的缺省值(以字节为单位),缺省设置:124928
    4./proc/sys/net/core/wmem_max
    该文件指定了发送套接字缓冲区大小的最大值(以字节为单位),缺省设置:124928
    上述文件对应的具体内核优化命令:
    cat >> /etc/sysctl.conf<<EOF
    net.core.wmem_default = 8388608
    net.core.rmem_default = 8388608
    net.core.rmem_max = 16777216
    net.core.wmem_max = 16777216
    EOF
    sysctl -p  执行使生效
    在挂载目录卸载挂载提示:umount:/mnt:device is busy
    可以使用 umount -lf /mnt  强制卸载

    北丐洪七公--Jeff
    Dignity comes from strength, strength comes from struggle!
    本文版权归作者和博客园共有,欢迎转载,未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    [算法学习] 单调栈
    UVA11275 3D Triangles(三维几何)
    2019CCSU11月校赛 B,G题解
    2017-2018 ACM-ICPC Northern Eurasia (Northeastern European Regional) Contest (NEERC 17)(B,D)
    2016湖南省省赛 B 有向无环图(树形dp)
    2016湖南省省赛 J 三角形和矩形(计算几何)
    JAVA 高精度小数模板
    2019湖南省赛 K 双向链表练习题(list)
    2019 字节跳动 [编程题]最大映射(贪心)
    HDU 6740 MUV LUV EXTRA(kmp原理)
  • 原文地址:https://www.cnblogs.com/wangyifu/p/7202662.html
Copyright © 2011-2022 走看看