大家好。有一个资源非常有限的小型 VPS - 只有 256Mb RAM。我在这个运行 CentOS 7 操作系统的 VPS 上安装了 PHP 7.3、NginX 和绑定 9.9.4-74。检查 top 命令的输出,我注意到 named 占用了非常大的 RAM - 25.2%
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1509 named 20 0 170804 61476 3260 S 0.0 25.2 0:00.24 named
这是 named.conf 配置
acl "trusted" {
127.0.0.1;
SERVER_IP;
};
// these are just a list of ip's that I consider bogus and just ignore them
acl "fakeips" {
# 0.0.0.0/8;
};
options {
listen-on port 53 { 127.0.0.1;SERVER_IP; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; }; // Этот параметр указывает, кому разрешается подавать запросы к нашему серверу
allow-query-cache { none; };
allow-recursion { trusted; };
allow-notify { trusted; };
allow-transfer { trusted; };
version "not currently available";
blackhole { fakeips; };
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
告诉我,有没有办法减少named的胃口?这样就不会影响VPS的速度。
尝试将 max-cache-size 设置设置在 2-20 兆字节 - 20m 范围内