Zookeeper Too many connections情况
我的zookeeper机器,跑了一段时间后有的服务就连接失败,正常连接ok,但是socket 被 close掉了,zookeeper的日记如下:[code]2016-11-03 10:45:18,190 [myid:4] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.10.0.48 - max is 60
2016-11-03 10:45:18,213 [myid:4] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.10.0.46 - max is 60
2016-11-03 10:45:18,236 [myid:4] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.10.0.46 - max is 60
2016-11-03 10:45:18,349 [myid:4] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.10.0.48 - max is 60
2016-11-03 10:45:18,351 [myid:4] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.10.0.46 - max is 60
2016-11-03 10:45:18,393 [myid:4] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.10.0.46 - max is 60
2016-11-03 10:45:18,431 [myid:4] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.10.0.48 - max is 60
2016-11-03 10:45:18,434 [myid:4] - WARN [NIOServerCxn.Factory:[/code]这个是不是因为系统内核参数的原因还是什么?
没有找到相关结果
已邀请:
1 个回复
空心菜 - 心向阳光,茁壮成长
maxClientCnxns介绍:
这个配置参数将限制连接到ZooKeeper的客户端的数量,限制并发连接的数量,它通过IP来区分不同的客户端。此配置选项可以用来阻止某些类别的Dos攻击。该参数默认是60,将它设置为0将会取消对并发连接的限制。
例如,将maxClientCnxns的值设置为1,如下所示:
启动ZooKeeper之后,首先用一个客户端连接到ZooKeeper服务器之上。然后,当第二个客户端尝试对ZooKeeper进行连接,或者某些隐式的对客户端的连接操作,将会触发ZooKeeper的上述配置。系统会提示相关信息,如下图所示:
[attach]1476[/attach]
ZooKeeper关于maxClientCnxns参数的官方解释:
maxClientCnxns
Limits the number of concurrent connections (at the socket level) that a single client, identified by IP address, may make to a single member of the ZooKeeper ensemble. This is used to prevent certain classes of DoS attacks, including file descriptor exhaustion. The default is 60. Setting this to 0 entirely removes the limit on concurrent connections.
所以最后:你这里想解决把maxClientCnxns=1000设置为1000就好。