linux远程目录共享


一、环境介绍


1、服务器说明

有两台服务器,(1)101报表服务器,上面是tomcat跑的原生FineReport报表系统,(2)103业务服务器,上面是具体的业务系统。


2、需求说明

报表文件由103业务系统管理,负责上传、下载等,上传的文件,通过共享目录、软链接等技术,直接上传到101报表服务器上,具体位置是/Data/apache-tomcat-7.0.47/webapps/report/WEB-INF/reportlets/uploadReports,其中WEB-INF/reportlets是FineReport指定的报表文件根目录位置。


3、实现思想

将101报表文件位置/Data/apache-tomcat-7.0.47/webapps/report/WEB-INF/reportlets/uploadReports通过共享目录,mount到103服务器的/Data/uploadReports目录,再在103上通过内部软链接,将目录/Data/uploadReports/绑定到目录/Data/apache-tomcat-7.0.47/webapps/p-business-report/uploadFiles/上面,其中后者是业务系统的文件上传位置。

二、101报表服务器配置

1、编辑文件,配置共享目录
vi /etc/exports
/Data/apache-tomcat-7.0.47/webapps/report/WEB-INF/reportlets/uploadReports *(rw,no_root_squash,sync)


2、启动服务
service nfs start
service rpcbind start

如果服务已启用,可参考以下命令进行重启服务(仅供参考):

查看服务状态
service nfs status
service rpcbind status

停止服务
service nfs stop
service rpcbind stop

重启服务
service nfs restart
service rpcbind restart


三、103业务服务器配置

1、和101绑定
mount -t nfs 192.168.108.101:/Data/apache-tomcat-7.0.47/webapps/report/WEB-INF/reportlets/uploadReports /Data/uploadReports

2、内部软链接绑定
ln -s /Data/uploadReports/ /Data/apache-tomcat-7.0.47/webapps/p-business-report/uploadFiles/

3、其他参考
(1)解除与101绑定的方法:
umount /Data/uploadReports

(2)参考文档:http://ligaosong.iteye.com/blog/2099974

 

原文地址:https://www.cnblogs.com/rulian/p/6419881.html