在linux上建立nfs遇到的问题。

咱们部署程序时,图片server是单独的一台server,有本身独立的域名。而应用部署在还有一台server上,咱们使用一些附件上传工具。比方ajaxfileupload上传附件时是没法跨域訪问的。java

以前想的方案是,先上传到应用所在的server。而后使用java的ftp组件上传到图片server上(固然了,图片server上安装了ftp服务端)。可是后来发现ftp上传比較慢而且不稳定。决定换成NFS来解决问题。固然了这个方法到底是好仍是很差还有待检验。这里不作讨论。以前没有弄过这个玩意,这里记录下遇到的问题。linux

        问题1:操做系统版本号的问题。web

        由于个人操做系统没有安装NFS,因此首先得安装。这里要注意在CentOS不一样版本号中,比方CentOS5.X下需要使用命令:yum -y install nfs-utils portmap。咱们使用的操做系统是CentOS6.5,咱们这里需要安装的命令是:yum -y install nfs-utils rpcbind(关于yum命令,你们可以查查资料,总之其思路和maven的设计思路挺相似)。ajax

        问题2:改动/etc/exports文件时,要注意格式,比方赞成链接的client地址与权限中间多了一个空格,应该是相似于:/usr/local/test/ 192.168.1.226(rw,no_root_squash,no_all_squash,sync),而不是:/usr/local/test/ 192.168.0.120  (rw,no_root_squash,no_all_squash,sync),不然在启动NFS时就会报下边错误:exportfs: No options for /usr/local/data/ 192.168.0.120: suggest 192.168.0.120(sync) to avoid warning
exportfs: No host name given with /usr/local/data (rw,no_root_squash,no_all_squash,sync), suggest *(rw,no_root_squash,no_all_squash,sync) to avoid warning
/tomcat/webfile 10.163.224.132 (rw,sync,no_root_squash)跨域

         问题3:exportfs -r,这个必定要运行,不然不生效。tomcat

         问题4:在client也必定要注意安装NFS。不然光安装服务端是不能訪问的。maven

         问题5:service nfs start假设出现下面问题,可以不用理会:tcp

         Starting NFS services:  [  OK  ]
         Starting NFS quotas: [  OK  ]
         Starting NFS mountd: rpc.mountd: svc_tli_create: could not open connection for udp6
         rpc.mountd: svc_tli_create: could not open connection for tcp6
         rpc.mountd: svc_tli_create: could not open connection for udp6
         rpc.mountd: svc_tli_create: could not open connection for tcp6
         rpc.mountd: svc_tli_create: could not open connection for udp6
         rpc.mountd: svc_tli_create: could not open connection for tcp6
         [  OK  ]
         Starting NFS daemon: rpc.nfsd: address family inet6 not supported by protocol TCP
         [  OK  ]
         Starting RPC idmapd: [  OK  ]工具

         以上就是整个过程,事实上也没有啥技术含量,就是对于不熟悉linux的人有点帮助。spa

相关文章
相关标签/搜索