本文介绍了使用腻子将 EFS 挂载到 Red Hat ec2 实例时无法解析 EFS 的 DNS 名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,我无法使用 DNS 名称在 red hat ec2 实例上安装我的 EFS.它抛出错误 mount.nfs4: Failed to resolve server us-east-1a.fs-c2aXXXX.efs.us-east-1.amazon aws.com: Name or service not known

I am having an issue where I am unable to mount my EFS on red hat ec2 instance using the DNS names. It throws error mount.nfs4: Failed to resolve server us-east-1a.fs-c2aXXXX.efs.us-east-1.amazon aws.com: Name or service not known

我正在遵循 AWS 提供的说明.我尝试了以下两种方法来做到这一点,并且都抛出了上述相同的错误.我可以确认 DNS 名称是正确的.

I am following the instructions provided by AWS. I tried below two ways to do it and both throw the same above error. I can confirm that the DNS names are correct.

第一个---

mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-c2aXXXX.efs.us-east-1.amazonaws.com:/ efs

第二个--

mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 $(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).fs-c2a7XXXX.efs.us-east-1.amazonaws.com:/ /efs

但是,如果我使用 IP 而不是 DNS 名称,我可以很好地安装它.所以下面的命令有效.

However, if I use IP instead of DNS names, I am able to mount it just fine. So below command works.

mount -t nfs4 -o
nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 10.38.X.XX:/ /efs

我可以使用 IP 而不是 DNS,只要我能够安装它.

I am fine with using IP instead of DNS as long as I am able to mount it.

现在我的问题是一旦我停止并再次启动实例,我的坐骑就消失了.即使在我将以下条目添加到 /etc/fstab 之后,它也不会自动挂载.

Now my issue is as soon as I stop and start the instance again, my mount is gone. Even after I add the below entry to the /etc/fstab ,it doesn't do auto mount.

10.38.X.XXX:/ /efs efs defaults,_netdev 0 0

有人可以帮助我解决 DNS 问题或告诉我如何使用 Ips 自动挂载吗?

Can someone please help me in either resolving the issue with DNS or tell me how to auto mount using Ips ?

提前感谢 Guyz.

推荐答案

要从命令行附加到 EFS,请将其用作模板,将 fs-12345678 替换为您的 ID:

To attach to EFS from the command line use this as your template, replacing fs-12345678 with your id:

$ sudo mount -t efs fs-12345678:/ /efs

在您的 /etc/fstab 中使用它(不要在它后面添加 .efs.us-east-1.amazonaws.com)

Use this in your /etc/fstab (do not add .efs.us-east-1.amazonaws.com after it)

fs-12345678:/ /efs efs vers=4.1,rw,tls,_netdev,relatime,acl,nofail 0 0

fstab 版本还为数据传输开启加密.查看资源以获取更多信息

The fstab version also turns on encryption for data transport. Check out the resource for more information

资源

https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.htmlhttps://docs.aws.amazon.com/efs/latest/ug/troubleshooting-efs-mounting.html#automount-fails

这篇关于使用腻子将 EFS 挂载到 Red Hat ec2 实例时无法解析 EFS 的 DNS 名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 20:43