NFS配置
由于权限问题,开发人员没有访问生产环境was相关日志权限,因此他们是通过生产环境nfs挂载至测试环境,开发人员能够访问的环境进行查询。
NFS 1.配置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 nfs nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off chkconfig --level 345 nfs on 服务器nfs开启自启动已配置 验证,之前restart 是否影响其他客户端nfs服务,再次重启nfs服务,可以发现已配置的客户端,还是能正常读取,识别文件 客户端操作 安装nfs安装包 Red Hat Enterprise Linux Server release 5.4 (Tikanga) [root@qaswebdb ~]# rpm -qa | grep nfs nfs-utils-lib-1.0.8-7.6.el5 nfs-utils-1.0.9-42.el5 [root@qaswebdb ~]# rpm -qa | grep portmap portmap-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.157 Export 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 -h 10.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/yc01 umount: /logs/yc01: device is busy umount: /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.log touch: 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 -h Filesystem 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/local mount 10.8.2.100:/opt/IBM/HTTPServer/logs /hrlog mount 10.8.4.148:/opt/nginx/logs /ekplog/ mount 10.8.4.10:/ytnfsa/accesslog /opt/accesslog mount 10.8.2.100:/opt/IBM/WebSphere/Emp2/logs/emp2 /emp_log/emp2 mount 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/emp1 mount: 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.102 PING 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 status portmap (pid 3735) is running... [root@emp1 emp1]# service nfs status rpc.mountd is stopped nfsd is stopped rpc.rquotad is stopped [root@emp1 emp1]# service nfs start Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS daemon: [ OK ] Starting NFS mountd: [ OK ] [root@emp1 emp1]# chkconfig --list nfs nfs 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 -h Filesystem Size Used Avail Use% Mounted on 10.8.3.183:/opt/IBM/WebSphere/Emp1/logs/emp1 21G 16G 3.5G 83% /emp_log/emp1