背景:在prometheus搭建完毕以及告警规则调整完毕之后,需要通过consul集群将主机注册到prometheus,但是由于机器多大几千台,导致prometheus服务器的arp直接爆炸了,远程无法连接到prometheus服务器上,在通过BMC连接上主机后,ping自己都无法ping通。
原因分析:
gc_thresh1
存在于ARP高速缓存中的最少层数,如果少于这个数,垃圾收集器将不会运行。缺省值是128。
gc_thresh2
保存在 ARP 高速缓存中的最多的记录软限制。垃圾收集器在开始收集前,允许记录数超过这个数字 5 秒。缺省值是 512。
gc_thresh3
保存在 ARP 高速缓存中的最多记录的硬限制,一旦高速缓存中的数目高于此,垃圾收集器将马上运行。缺省值是1024。
系统默认的是gc_thresh1 128 ,gc_thresh2 512 ,gc_thresh3 1024,很显然我需要保存的ip数远大于1024。
解决方式:
net.ipv4.neigh.default.gc_thresh3 = 32768
net.ipv4.neigh.default.gc_thresh2 = 16384
net.ipv4.neigh.default.gc_thresh1 = 8192
cat /proc/sys/net/ipv4/neigh/default/gc_thresh1
cat /proc/sys/net/ipv4/neigh/default/gc_thresh2
cat /proc/sys/net/ipv4/neigh/default/gc_thresh3