Nfs实现日志集中查看
目录
* 起因
程序哥要登录一台机器看所有javalog 但是有些机器跑的程序日志名是一样的 于是只能是 多个 nfs server 一个client 然后登录client机器就可以查看6台机的log
client 172.31.27.83 server 172.31.25.239,java03 ,04,05,06 加上01自己 一共6台机器
* server install
** java2
yum -y install nfs-utils rpcbind firewall-cmd --add-service=nfs --permanent --zone=public systemctl enable nfs-server systemctl start nfs-server # nfs client ip echo "/data/logs/hello/ 172.31.27.83(rw,sync,no_root_squash)" >> /etc/exports systemctl restart rpcbind exportfs -arv #其它几台机器是一样的 在此就不写上了
client
* client inst
yum -y install nfs-utils apt-get install nfs-common#debina
config
4java02
mkdir -p /data/logs/java02/hello/ mount 172.31.25.239:/data/logs/hello/ /data/logs/java02/hello/ 记得加入 fstab 172.31.27.83:/data/logs/hello/ /home/logs/java01/hello nfs defaults 0 0 172.31.25.239:/data/logs/hello/ /home/logs/java02/hello nfs defaults 0 0 172.31.16.171:/data/logs/hello/ /home/logs/java03/hello nfs defaults 0 0
4java03
mkdir -p /data/logs/java02/hello/ mount 172.31.16.171:/data/logs/hello/ /data/logs/java02/hello/
其它一致,在此不写
mount 172.31.16.171:/data/logs/hello/ /data/logs/java03/hello/
mount.nfs: access denied by server while mounting 172.31.16.171:/data/logs/hello/
troubleshooting
on nfs server
# 不然会 showmount -e 没东西 mount 172.31.26.183:/data/logs/hello/ /data/logs/java04/hello/ mount.nfs: access denied by server while mounting 172.31.26.183:/data/logs/hello/