linux – 不使用nscd进行缓存的DNS查询
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了linux – 不使用nscd进行缓存的DNS查询,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4434字,纯文字阅读大概需要7分钟。
内容图文
我正在尝试使用nscd(Nameservices Cache Daemon)在本地缓存DNS,因此我可以停止使用Bind来执行此操作.我已经开始了,ntpd似乎试图使用它.但主机的其他一切似乎都忽略了它.例如,如果我挖掘apache.org 3次,它们都不会达到缓存.我正在使用nscd -g查看缓存统计信息以确定它是否已被使用.我还调高了调试日志级别以查看是否可以看到它命中,查询甚至没有命中nscd.
的nsswitch.conf
# Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
publickey: files
hosts: cache files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
netgroup: files
# End /etc/nsswitch.confenter code here
nscd.conf
#
# /etc/nscd.conf
#
# An example Name Service Cache config file. This file is needed by nscd.
#
# Legal entries are:
#
# logfile <file>
# debug-level <level>
# threads <initial #threads to use>
# max-threads <maximum #threads to use>
# server-user <user to run server as instead of root>
# server-user is ignored if nscd is started with -S parameters
# stat-user <user who is allowed to request statistics>
# reload-count unlimited|<number>
# paranoia <yes|no>
# restart-interval <time in seconds>
#
# enable-cache <service> <yes|no>
# positive-time-to-live <service> <time in seconds>
# negative-time-to-live <service> <time in seconds>
# suggested-size <service> <prime number>
# check-files <service> <yes|no>
# persistent <service> <yes|no>
# shared <service> <yes|no>
# max-db-size <service> <number bytes>
# auto-propagate <service> <yes|no>
#
# Currently supported cache names (services): passwd, group, hosts, services
#
logfile /var/log/nscd.log
threads 4
max-threads 32
server-user nobody
# stat-user somebody
debug-level 9
# reload-count 5
paranoia no
# restart-interval 3600
enable-cache passwd yes
positive-time-to-live passwd 600
negative-time-to-live passwd 20
suggested-size passwd 211
check-files passwd yes
persistent passwd yes
shared passwd yes
max-db-size passwd 33554432
auto-propagate passwd yes
enable-cache group yes
positive-time-to-live group 3600
negative-time-to-live group 60
suggested-size group 211
check-files group yes
persistent group yes
shared group yes
max-db-size group 33554432
auto-propagate group yes
enable-cache hosts yes
positive-time-to-live hosts 3600
negative-time-to-live hosts 20
suggested-size hosts 211
check-files hosts yes
persistent hosts yes
shared hosts yes
max-db-size hosts 33554432
enable-cache services yes
positive-time-to-live services 28800
negative-time-to-live services 20
suggested-size services 211
check-files services yes
persistent services yes
shared services yes
max-db-size services 33554432
的resolv.conf
# Generated by dhcpcd from eth0
nameserver 127.0.0.1
domain westell.com
nameserver 192.168.1.1
nameserver 208.67.222.222
nameserver 208.67.220.220
作为一个侧面说明我正在使用Arch Linux.
注意:这已被移动了两次,我从来没有弄清楚为什么应用程序,不包括挖掘,没有达到nscd缓存,浏览器,IM,IRC,都应该是,但他们没有
解决方法:
您丢失缓存命中的原因是dig直接查询DNS.您可以尝试查看缓存是否与getent命令一起使用:
getent hosts host.example.com
运行单独的缓存DNS是个好主意,但是如果可能的话,您应该考虑在网络级别运行它.如果每个主机分别缓存数据,它们仍将为同一主机运行多个查询.单缓存解决此问题.
Nscd本身是NSS功能的缓存守护进程.所以焦点与本机缓存名称服务器有点不同.因此,如果您只想要一个缓存名称服务器,请使用除nscd之外的其他内容.如果您希望在正常DNS系统之外缓存共享用户名和主机数据之类的内容,请转到nscd.
为了记录,我已经非常喜欢powerdns resolver(pdns-resolver).
内容总结
以上是互联网集市为您收集整理的linux – 不使用nscd进行缓存的DNS查询全部内容,希望文章能够帮你解决linux – 不使用nscd进行缓存的DNS查询所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。