中间有一段时间没有数据
如果重启proxify pod,es就会又有数据。就像图中那样
日志中看到了报错
2023/01/09 15:23:58 [056] INFO: Exiting on EOF
[WRN] Error while logging: error thrown by elasticsearch: dial tcp 10.233.3.77:9200: connect: cannot assign requested address
[WRN] Error while logging: error thrown by elasticsearch: dial tcp 10.233.3.77:9200: connect: cannot assign requested address
[WRN] Error while logging: error thrown by elasticsearch: dial tcp 10.233.3.77:9200: connect: cannot assign requested address
是因为open files 文件句柄数有最大值限制吗?
/ # lsof -n|awk '{print $2}'|sort|uniq -c|sort -nr
28300 /usr/local/bin/proxify
10 /bin/busybox
/ # ulimit -n
1048576
/ #
似乎也没有到最大值
那为什么会报这个错呢?
可以看到 10.233.3.77:9200 的链接客户端端口号也只有2w+,并没有到达65535,这能算作是 客户端端口号 分配完了吗?
不过奇怪的是为什么ESTABLISHED状态链接这么多?
/ # netstat -antp | grep 10.233.3.77:9200|grep ESTABLISHED|wc -l
28234
ESTABLISHED 状态说明客户端和服务端正在传输业务数据
所以,猜测是代码中忘了释放http链接了。后来一看,确实是
/ # sysctl -a|grep tcp_fin_timeout
net.ipv4.tcp_fin_timeout = 60
/ # sysctl -w net.ipv4.tcp_fin_timeout=10
sysctl: error setting key 'net.ipv4.tcp_fin_timeout': Read-only file system