“Nfs实现日志集中查看”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
第50行: 第50行:
  
 
其它一致,在此不写
 
其它一致,在此不写
 +
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/
  
  
 +
</pre>
  
  
  mount 172.31.16.171:/data/logs/hello/  /data/logs/java03/hello/
+
=** 挂只读 pass=
mount.nfs: access denied by server while mounting 172.31.16.171:/data/logs/hello/
+
<pre>
 
+
设置输出目录只读:ro
 
 
  
 +
/data/logs/hello/ 172.31.27.83(ro,sync,no_root_squash)
 +
systemctl  restart nfs-server
  
 +
sync:将数据同步写入内存缓冲区与磁盘中,效率低,但可以保证数据的一致性; </pre>
  
</pre>
 
 
=troubleshooting=
 
=troubleshooting=
 
==on nfs server==
 
==on nfs server==

2019年10月24日 (四) 09:53的版本

* 起因

程序哥要登录一台机器看所有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/



** 挂只读 pass

设置输出目录只读:ro

/data/logs/hello/ 172.31.27.83(ro,sync,no_root_squash)
systemctl  restart nfs-server 

sync:将数据同步写入内存缓冲区与磁盘中,效率低,但可以保证数据的一致性; 

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/