问HN:对于生产应用程序,使用/etc/hosts而不是DNS的看法?
嗨,HN,
“总是 DNS”是我们在谈论故障时都很熟悉的一个主题。我理解为什么 DNS 对大多数用户来说至关重要。但是对于那些使用“基础设施即代码”(Infrastructure as Code)系统进行管理和部署的应用程序来说,既然变更可以并且应该以与代码变更相同的方式进行推送(DevOps 及相关概念),那么在各处使用 /etc/hosts 文件是否会有什么害处呢?
这样一来,名称与 IP 的关联变更就能受益于基础设施即代码,同时 DNS 相关的不稳定性也会被最小化。当然,我假设名称与 IP 的关联最初是由系统工程师控制的,对于其他用例,DNS 仍然可以并且应该被使用。
那么,为什么云服务提供商和 FAANG 公司还没有这样做呢?在鼓励通过消除 DNS 请求流量和 CPU 周期来节省成本的情况下?
查看原文
Hi HN,<p>"It's always DNS" is a theme we're all familiar with when it comes to outages.
I understand why DNS is critical for most users. But for applications that are managed/deployed using an "Infrastructure as Code" system, where changes can, and should always be pushed in a way that treats the changes the same way code changes are treated (Devops and all that), is there any harm with using /etc/hosts files everywhere?<p>That way name-to-ip association changes benefit from IaC, and DNS related instabilities are minimized. Of course, I am assuming the name-to-ip association is under the control of the system's engineers to begin with, for every other use case DNS can and should still be used.<p>Why aren't cloud providers and FAANGs doing this already, where saving costs by eliminating things like DNS request traffic and CPU cycles is encouraged?