博客
关于我
NFS配置
阅读量:432 次
发布时间:2019-03-06

本文共 4020 字,大约阅读时间需要 13 分钟。

由于权限问题,开发人员没有访问生产环境was相关日志权限,因此他们是通过生产环境nfs挂载至测试环境,开发人员能够访问的环境进行查询。

 

NFS1.配置NFS LOG挂载目录源端操作[root@yc01v yc1]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.5 (Santiago)[root@yc01v yc1]# cat /etc/exports /opt/tmp 10.8.5.158(rw,no_root_squash)/opt/IBM/WebSphere/yc1/logs 10.8.4.102(rw,no_root_squash)/opt/IBM/WebSphere/logs 10.8.4.102(ro)编辑NFS文件配置vi /etc/exports/opt/IBM/WebSphere/yc1/logs/yc1 10.8.0.56(ro,no_root_squash)重启nfs服务[root@yc01v yc1]# /etc/init.d/rpcbind restart[root@yc01v yc1]# /etc/init.d/nfs restart服务器端nfs服务是否开机自启动进行验证[root@yc01v yc1]# chkconfig --list nfsnfs             0:off   1:off   2:off   3:off   4:off   5:off   6:offchkconfig --level 345 nfs on服务器nfs开启自启动已配置验证,之前restart 是否影响其他客户端nfs服务,再次重启nfs服务,可以发现已配置的客户端,还是能正常读取,识别文件客户端操作安装nfs安装包Red Hat Enterprise Linux Server release 5.4 (Tikanga)[root@qaswebdb ~]# rpm -qa | grep nfsnfs-utils-lib-1.0.8-7.6.el5nfs-utils-1.0.9-42.el5[root@qaswebdb ~]# rpm -qa | grep portmapportmap-4.0-65.2.2.1[root@qaswebdb ~]# service portmap restart[root@qaswebdb ~]# service nfs restart需要挂载目录,创建# mkdir /logs/yc01测试挂载[root@qaswebdb ~]# showmount -e 10.8.5.157Export list for 10.8.5.157:/opt/IBM/WebSphere/yc1/logs/yc1 10.8.0.56# mount -t nfs 10.8.5.157:/opt/IBM/WebSphere/yc1/logs/yc1 /logs/yc01# df -h10.8.5.157:/opt/IBM/WebSphere/yc1/logs/yc1                       36G   11G   23G  32% /logs                       [root@qaswebdb logs]# tail -200f SystemOut.log[root@qaswebdb logs]# umount /logs/yc01umount: /logs/yc01: device is busyumount: /logs/yc01: device is busy# fuser -km /logs/yc01# umount /logs/yc01# vi /etc/rc.local mount -t nfs 10.8.5.157:/opt/IBM/WebSphere/yc1/logs/yc1 /logs/yc01再次执行[root@qaswebdb logs]# touch a.logtouch: cannot touch `a.log': Permission denied无写权限 [root@qaswebdb logs]# tail -1f SystemOut.log[9/17/19 10:41:00:057 HKT] 0000007e Syst有读权限2.客户端,重启主机后,NFS未正常挂载客户端-bash-3.2# df -hFilesystem            Size  Used Avail Use% Mounted on10.8.2.100:/opt/IBM/WebSphere/Emp2/logs/emp2                       18G   14G  2.8G  84% /emp_log/emp2-bash-3.2# cat /etc/rc.local #!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.touch /var/lock/subsys/localmount 10.8.2.100:/opt/IBM/HTTPServer/logs /hrlogmount 10.8.4.148:/opt/nginx/logs /ekplog/mount 10.8.4.10:/ytnfsa/accesslog /opt/accesslogmount 10.8.2.100:/opt/IBM/WebSphere/Emp2/logs/emp2      /emp_log/emp2mount 10.8.3.183:/opt/IBM/WebSphere/Emp1/logs/emp1      /emp_log/emp1确实发现 /emp_log/emp1 文件夹丢失手工MOUNT报错-bash-3.2# mount 10.8.3.183:/opt/IBM/WebSphere/Emp1/logs/emp1      /emp_log/emp1mount: mount to NFS server '10.8.3.183' failed: RPC Error: Program not registered.登陆NFS服务端[root@emp1 ~]# cat /etc/exports /opt/IBM/WebSphere/Emp1/logs/emp1 10.8.3.102(ro)[root@emp1 emp1]# ping 10.8.3.102PING 10.8.3.102 (10.8.3.102) 56(84) bytes of data.64 bytes from 10.8.3.102: icmp_seq=1 ttl=64 time=0.436 ms[root@emp1 emp1]# service portmap statusportmap (pid 3735) is running...[root@emp1 emp1]# service nfs statusrpc.mountd is stoppednfsd is stoppedrpc.rquotad is stopped[root@emp1 emp1]#  service nfs startStarting NFS services:                                     [  OK  ]Starting NFS quotas:                                       [  OK  ]Starting NFS daemon:                                       [  OK  ]Starting NFS mountd:                                       [  OK  ][root@emp1 emp1]# chkconfig --list nfsnfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off[root@emp1 emp1]# [root@emp1 emp1]# [root@emp1 emp1]# [root@emp1 emp1]# chkconfig --level 345 nfs on[root@emp1 emp1]# chkconfig --list nfs        nfs             0:off   1:off   2:off   3:on    4:on    5:on    6:off客户端-bash-3.2# mount 10.8.3.183:/opt/IBM/WebSphere/Emp1/logs/emp1      /emp_log/emp1-bash-3.2# df -hFilesystem            Size  Used Avail Use% Mounted on10.8.3.183:/opt/IBM/WebSphere/Emp1/logs/emp1                       21G   16G  3.5G  83% /emp_log/emp1

 

转载地址:http://xslyz.baihongyu.com/

你可能感兴趣的文章