Linux 开启 DNS缓存服务 — NSCD

  NSCD(Name Service Cache Daemon)是服务缓存守护进程,它为NIS和LDAP等服务提供更快的验证。不管是什么系统,缓存是一项非常重要的技术[或机制],缓存的主旨就是提高客户端访问速度。

安装

# yum install -y nscd

编辑 /etc/nscd.conf 文件

# vim /etc/nscd.conf
logfile			/var/log/nscd.log
	threads			10
	max-threads		200
	server-user		nscd
#	stat-user		somebody
	debug-level		5
#	reload-count		5
	paranoia		no
#	restart-interval	3600

	enable-cache		passwd		no
	positive-time-to-live	passwd		5
	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		no
	positive-time-to-live	group		5
	negative-time-to-live	group		20
	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		5
	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	5
	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

	enable-cache		netgroup	yes
	positive-time-to-live	netgroup	5
	negative-time-to-live	netgroup	20
	suggested-size		netgroup	211
	check-files		netgroup	yes
	persistent		netgroup	yes
	shared			netgroup	yes
	max-db-size		netgroup	33554432

启动 NSCD

  • nscd 的缓存文件路径为/var/db/nscd/
# systemctl start nscd.service
# systemctl enable nscd.service

标题:Linux 开启 DNS缓存服务 — NSCD
作者:Mune
地址:https://cnxiaobai.com/articles/2021/07/03/1625315828065.html

    评论
    0 评论
avatar

取消