博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
macos 清空dns缓存_如何在macOS上重置DNS缓存
阅读量:2507 次
发布时间:2019-05-11

本文共 3946 字,大约阅读时间需要 13 分钟。

macos 清空dns缓存

macos 清空dns缓存

If you work on websites, you’ll occasionally need to reset your computer’s DNS cache, particularly after editing records or changing hosts. While is easy with a dedicated command, Mac users have to use a bit of a workaround.

如果您在网站上工作,则偶尔需要重置计算机的DNS缓存,尤其是在编辑记录或更改主机之后。 尽管使用专用命令很容易 ,但Mac用户必须使用一些解决方法。

清除Mac上的DNS缓存 (Clear Your DNS Cache on Your Mac)

To clear your DNS cache on your Mac, open the Terminal, which you can find in Applications > Utilities or by searching with Spotlight, and then run the following command:

要清除Mac上的DNS缓存,请打开“终端”,您可以在“应用程序”>“实用工具”中找到该终端,或者通过使用Spotlight搜索,然后运行以下命令:

sudo killall -HUP mDNSResponder

Enter your password when it’s requested.

要求时输入密码。

So, what does this command actually do? What’s happening here is that you’re kind of tricking your system into flushing the cache. Wikipedia explains:

那么,此命令实际上是做什么的? 这里发生的事情是您在欺骗您的系统以刷新缓存。 维基百科解释:

The SIGHUP signal is sent to a process when its controlling terminal is closed. It was originally designed to notify the process of a serial line drop (a hangup). In modern systems, this signal usually means that the controlling pseudo or virtual terminal has been closed. Many daemons will reload their configuration files and reopen their logfiles instead of exiting when receiving this signal. nohup is a command to make a command ignore the signal.

当SIGHUP信号的控制端子关闭时,它会发送到进程。 它最初旨在通知串行线掉线(挂断)过程。 在现代系统中,此信号通常意味着控制伪或虚拟终端已关闭。 许多守护程序将重新加载其配置文件并重新打开其日志文件,而不是在收到此信号时退出。 nohup是使命令忽略信号的命令。

Obviously you don’t need to know all of the rest of that. But now you do.

显然,您不需要了解所有其他内容。 但是现在你知道了。

There’s a lot of conflicting information on the web about this procedure. Some sites claim you need to run more commands than this on High Sierra, for example, while others make this command unnecessarily long. So far as we can tell, however, the command above is all that’s actually necessary. Here’s how to check your work.

网络上有很多与此过程有关的信息。 例如,某些站点声称您需要在High Sierra上运行比此命令更多的命令,而其他站点则使此命令不必要地冗长。 据我们所知,上面的命令实际上是必需的。 这是检查工作的方法。

检查您的DNS是否实际重置 (Check if Your DNS Is Actually Reset)

Not sure if your DNS reset actually worked? Closing your web browser before flushing the cache can help in some situations, but if that doesn’t seem to be working you can quickly verify that your cache is empty in two ways.

不确定您的DNS重置是否真的有效? 在刷新缓存之前先关闭Web浏览器在某些情况下会有所帮助,但是,如果这似乎不起作用,则可以通过两种方式快速验证缓存是否为空。

The first is site-specific. At the Terminal, type dig followed by the site’s URL. For example:

首先是特定于站点的。 在终端上,键入dig然后键入站点的URL。 例如:

dig howtogeek.com

In the “Answer Section” of the results, you’ll see the IP address that your computer knows for the site listed.

在结果的“答案”部分,您将看到您的计算机为列出的站点所知道的IP地址。

If you don’t see the new IP address, consider and flushing the cache again.

如果没有看到新的IP地址,请考虑然后再次刷新缓存。

For a more global (non site-specific) method, you can also confirm that the cache is reset with the Console, which you can find in Applications > Utilities or by using Spotlight. With your system highlighted in the left panel, type “mDNSResponder” into the search box, hit Enter, type “Cache size” alongside that first query, and then hit Enter again. Like this:

对于更全局(非特定于站点)的方法,您还可以通过控制台确认缓存已重置,可以在“应用程序”>“实用程序”中或使用Spotlight找到该控制台。 在左侧面板中突出显示系统的情况下,在搜索框中键入“ mDNSResponder”,按Enter,在第一个查询旁边键入“ Cache size”,然后再次按Enter。 像这样:

Now, with your Console window still open, head back to your Terminal window and run the following command:

现在,在“控制台”窗口仍然打开的情况下,返回到“终端”窗口并运行以下命令:

sudo killall -INFO mDNSResponder

You should see the DNS Cache size highlighted in the Console window. Now run this command:

您应该看到控制台窗口中突出显示的DNS缓存大小。 现在运行以下命令:

sudo killall -HUP mDNSResponder

And then, run this command once again:

然后,再次运行此命令:

sudo killall -INFO mDNSResponder

You should see the cache size change in the Console window. In the screenshot above, you can see that our cache size changed considerably after issuing the commands.

您应该在“控制台”窗口中看到缓存大小更改。 在上面的屏幕截图中,您可以看到发出命令后,我们的缓存大小发生了很大变化。

翻译自:

macos 清空dns缓存

转载地址:http://jozwd.baihongyu.com/

你可能感兴趣的文章
java常见3种文件上传速度对比和文件上传方法详细代码
查看>>
SVD总结
查看>>
python基础教程(三)
查看>>
PL SQL Developer中文乱码
查看>>
字符串知识大全
查看>>
软件目录结构规范及堂兄弟文件引用
查看>>
H5 WebSocket通信和WCF支持WebSocket通信
查看>>
文件上传
查看>>
不能在此路径中使用此配置节。如果在父级别上锁定了该节,便会出现这种情况...
查看>>
Linux的IO性能监控工具iostat详解
查看>>
老杨聊架构:每个架构师都应该研究下康威定律
查看>>
1022: 锤子剪刀布
查看>>
在JavaScript中调用ASP.NET WebService的简单方法
查看>>
jQuery基础知识,很赞的!!!
查看>>
[SDOI 2012]Longge的问题
查看>>
简单BBS项目开始(一)
查看>>
[Codeforces 925C]Big Secret
查看>>
处理MVC中默认的Json方法返回时间的问题
查看>>
分布式技术追踪 2018年第十期
查看>>
IDEA中Git的使用
查看>>