阿里云ECS上实现NFS挂载,阿里云服务器ecs与域名的绑定-ESG跨境

阿里云ECS上实现NFS挂载,阿里云服务器ecs与域名的绑定

来源网络
来源网络
2022-05-08
点赞icon 0
查看icon 736

阿里云ECS上实现NFS挂载,阿里云服务器ecs与域名的绑定阿里云ECS上实现NFS挂载1. 背景由于项目需要,现在需要在阿里云上多台服务器上共享一些静态的文件数据。开始时选型方案有:OSS对象存储、NAS存储、自己搭建NFS;考虑成本需要,选择了自己搭建NFS。 项目在阿里金融云上,金融云上产品比公有云贵多了。 下面......

阿里云ECS上实现NFS挂载,阿里云服务器ecs与域名的绑定




阿里云ECS上实现NFS挂载

1. 背景

由于项目需要,现在需要在阿里云上多台服务器上共享一些静态的文件数据。开始时选型方案有:OSS对象存储、NAS存储、自己搭建NFS;考虑成本需要,选择了自己搭建NFS。 项目在阿里金融云上,金融云上产品比公有云贵多了。 下面讲解过程。

注意:你的ECS是否在一个区,且是否在一个安全组。如果两台ECS不在同一个安全组,因此需要在各自的安全组设置规则,在内网进出方向分别添加对方的IP地址。

2. 过程

2.1 服务端

2.1.1 安装

yum install nfsutils –y

2.1.2 修改配置文件

[root@test02 home]# vim /etc/exports

/home/nfstest 10.0.18.1(rw,sync,norootsquash)

/home/nfstest 10.0.16.120(rw,sync,norootsquash)

#新建目录

mkdir –p /home/nfstest

norootsquash:登入 NFS 主机使用分享目录的使用者,如果是 root 的话,那么对于这个分享的目录来说,他就具有 root 的权限这个项目『极不安全』,不建议使用

rootsquash:在登入 NFS 主机使用分享之目录的使用者如果是 root 时,那么这个使用者的权限将被压缩成为匿名使用者,通常他的 UID 与 GID 都会变成 nobody 那个系统账号的身份;

2.1.3 启动服务

service rpcbind start #启动端口转发

service nfs start #启动NFS

chkconfig rpcbind on #rpcbind 加入启动项

chkconfig nfs on #nfs加入启动项

启动后如果修改了目录,可执行exprotfs rv 实现刷新

2.1.4 添加防火墙规则

iptables I INPUT p tcp m multiport dports 875,2049,111,28300,5076,39927,46286 j ACCEPT

iptables I INPUT p udp m multiport dports 875,2049,111,37747,31166,9292,57181 j ACCEPT

注意:由于要开放的端口较多且不连续,最好的做法是修改相应的端口。 可以参考我的另外一篇博文

http://pizibaidu.blog.51cto.com/1361909/1662428

2.2 客户端

2.2.1 安装

yum install nfsutils –y

2.2.2 挂载

a. 立一个目录用来作挂接点

mkdir p /home/nfs

b、进行挂接

mount t nfs 10.0.16.122:/home/nfstest /home/nfs o proto=tcp o nolock

c、取消挂接

umount /home/nfs

3. 遇到的问题

3.1 如果客户端不安装nfsutils会报如下错误:

mount: wrong fs type, bad option, bad superblock on 10.0.16.122:/home/nfstest,

    missing codepage or helper program, or other error

    (for several filesystems (e.g. nfs, cifs) you might

    need a /sbin/mount.type helper program)

    In some cases useful info is found in syslog try

    dmesg tail or so

解决方法:yum install nfsutils –y

3.2 clntcreate: RPC: Port mapper failure Unable to receive: errno 113 (No route to host)

挂载时报的错误。

解决方法: 由于服务端防火墙的阻止,需要把所有的端口都加进去。需要把那些端口加入防火墙,可以执行命令: rpcinfo p 10.0.16.122

或者关掉防火墙

# rpcinfo p 10.0.16.122

  100000  4 tcp  111 portmapper

  100000  3 tcp  111 portmapper

  100000  2 tcp  111 portmapper

  100000  4 udp  111 portmapper

  100000  3 udp  111 portmapper

  100000  2 udp  111 portmapper

  100011  1 udp  875 rquotad

  100011  2 udp  875 rquotad

  100011  1 tcp  875 rquotad

  100011  2 tcp  875 rquotad

  100005  1 udp 37747 mountd

  100005  1 tcp 5076 mountd

  100005  2 udp 31166 mountd

  100005  2 tcp 39927 mountd

  100005  3 udp 9292 mountd

  100005  3 tcp 28300 mountd

  100003  2 tcp 2049 nfs

  100003  3 tcp 2049 nfs

  100003  4 tcp 2049 nfs

  100227  2 tcp 2049 nfsacl

  100227  3 tcp 2049 nfsacl

  100003  2 udp 2049 nfs

  100003  3 udp 2049 nfs

  100003  4 udp 2049 nfs

  100227  2 udp 2049 nfsacl

  100227  3 udp 2049 nfsacl

  100021  1 udp 57181 nlockmgr

  100021  3 udp 57181 nlockmgr

  100021  4 udp 57181 nlockmgr

  100021  1 tcp 46286 nlockmgr

  100021  3 tcp 46286 nlockmgr

  100021  4 tcp 46286 nlockmgr

3.3 nfs rpc.mountd: svctlicreate: could not open connection for udp6

启动NFS报错如下:

Starting NFS mountd: rpc.mountd: svctlicreate: could not open connection for udp6

rpc.mountd: svctlicreate: could not open connection for tcp6

rpc.mountd: svctlicreate: could not open connection for udp6

rpc.mountd: svctlicreate: could not open connection for tcp6

rpc.mountd: svctlicreate: could not open connection for udp6

rpc.mountd: svctlicreate: could not open connection for tcp6

解决办法:

修改如下配置文件,然后重启服务即可。

[root@localhost ——]# vi /etc/netconfig

udp tpiclts v inet udp

tcp tpicotsord v inet tcp

#udp6 tpiclts v inet6 udp

#tcp6 tpicotsord v inet6 tcp

rawip tpiraw inet

local tpicotsord loopback

unix tpicotsord loopback


文章推荐
阿里云短信发快递常见问题解答,开通阿里云短信通知怎么收费
Wish平台支持的物流方式,wish平台物流设置
别说我不教你,别说我不懂
WhatsApp 16个超实用的功能,whatsapp有哪些功能


特别声明:以上文章内容仅代表作者本人观点,不代表ESG跨境电商观点或立场。如有关于作品内容、版权或其它问题请于作品发表后的30日内与ESG跨境电商联系。

搜索 放大镜
韩国平台交流群
加入
韩国平台交流群
扫码进群
欧洲多平台交流群
加入
欧洲多平台交流群
扫码进群
美国卖家交流群
加入
美国卖家交流群
扫码进群
ESG跨境专属福利分享群
加入
ESG跨境专属福利分享群
扫码进群
拉美电商交流群
加入
拉美电商交流群
扫码进群
亚马逊跨境增长交流群
加入
亚马逊跨境增长交流群
扫码进群
《开店大全-全球合集》
《开店大全-主流平台篇》
《开店大全-东南亚篇》
《CD平台自注册指南》
《开店大全-俄罗斯篇》
《韩国站内推广指南》
《韩国热销品预测》
《开店大全-日韩篇》
《开店大全-拉美篇》
《开店大全-欧洲篇》
通过ESG入驻平台,您将解锁
绿色通道,更高的入驻成功率
专业1v1客户经理服务
运营实操指导
运营提效资源福利
平台官方专属优惠
联系顾问

平台顾问

平台顾问 平台顾问

微信扫一扫
马上联系在线顾问

icon icon

小程序

微信小程序

ESG跨境小程序
手机入驻更便捷

icon icon

返回顶部