我使用Php& Memocache on Centos 7. Memcache没有日志文件,但在mysql上创建了memcache连接状态。
$memcache = new Memcache;
$ip = getenv('REMOTE_ADDR');
if(!($memcache->connect('localhost', 11211))){
$date_er= date('Y-m-d H:i:s');
mysql_query("insert into memcacheerror (date_er,ip) values('$date','$ip')") or die(mysql_error());
}
当我现在检查表时,大约有953个连接没有连接,大约需要5个小时..
Memcache状态日志 - > watch" echo stats | nc 127.0.0.1 11211"
STAT pid 12939
STAT uptime 60708
STAT time 1489228368
STAT version 1.4.15
STAT libevent 2.0.21-stable
STAT pointer_size 64
STAT rusage_user 49.208000
STAT rusage_system 181.028000
STAT curr_connections 10
STAT total_connections 1510442
STAT connection_structures 83
STAT reserved_fds 20
STAT cmd_get 2578565
STAT cmd_set 3716
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 2574844
STAT get_misses 3721
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 76806965
STAT bytes_written 17519935942
STAT limit_maxbytes 2147483648
STAT accepting_conns 1
STAT listen_disabled_num 0
Memcache配置文件
PORT="11211"
USER="memcached"
MAXCONN="5024"
CACHESIZE="2048"
OPTIONS=""
我该如何解决这个问题?解决办法是什么 ?真的非常感谢你。
答案 0 :(得分:0)
我解决了这个问题。解决方案增加了sysctl nf_conntrack_max。
检查最大值和当前值
cat / proc / sys / net / netfilter / nf_conntrack_max
cat / proc / sys / net / ipv4 / netfilter / ip_conntrack_count
最后,增加nf_conntrack_max值。
回声" 556546" >的/ proc / SYS /净/网络过滤/ nf_conntrack_max