博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zookeeper NIOServerCnxn: Too many connections from
阅读量:6451 次
发布时间:2019-06-23

本文共 6192 字,大约阅读时间需要 20 分钟。

问题报错

否则报错如下:2011-10-28 09:39:44,856 – WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:5858:NIOServerCnxn$Factory@253] – Too many connections from /172...* – max is 10

一直报这个错误

解决办法

设置同一个ip最大的连接数为300

vim zoo.cfg

# set max client connects maxClientCnxns=300

默认zookeeper给每个客户端IP使用的连接数为10个,经常会出现连接不够用的情况。修改连接数目前好像只支持zoo.cfg配置文件修改,所以需要zookeeper重启才能生效。

3.4.3版本为60个连接

配置文件参数

 官方网站

Configuration Parameters

ZooKeeper's behavior is governed by the ZooKeeper configuration file. This file is designed so that the exact same file can be used by all the servers that make up a ZooKeeper server assuming the disk layouts are the same. If servers use different configuration files, care must be taken to ensure that the list of servers in all of the different configuration files match.Minimum ConfigurationHere are the minimum configuration keywords that must be defined in the configuration file:clientPortthe port to listen for client connections; that is, the port that clients attempt to connect to.dataDirthe location where ZooKeeper will store the in-memory database snapshots and, unless specified otherwise, the transaction log of updates to the database.NoteBe careful where you put the transaction log. A dedicated transaction log device is key to consistent good performance. Putting the log on a busy device will adversely effect performance.tickTimethe length of a single tick, which is the basic time unit used by ZooKeeper, as measured in milliseconds. It is used to regulate heartbeats, and timeouts. For example, the minimum session timeout will be two ticks.Advanced ConfigurationThe configuration settings in the section are optional. You can use them to further fine tune the behaviour of your ZooKeeper servers. Some can also be set using Java system properties, generally of the form zookeeper.keyword. The exact system property, when available, is noted below.dataLogDir(No Java system property)This option will direct the machine to write the transaction log to the dataLogDir rather than the dataDir. This allows a dedicated log device to be used, and helps avoid competition between logging and snaphots.NoteHaving a dedicated log device has a large impact on throughput and stable latencies. It is highly recommened to dedicate a log device and set dataLogDir to point to a directory on that device, and then make sure to point dataDir to a directory not residing on that device.globalOutstandingLimit(Java system property: zookeeper.globalOutstandingLimit.)Clients can submit requests faster than ZooKeeper can process them, especially if there are a lot of clients. To prevent ZooKeeper from running out of memory due to queued requests, ZooKeeper will throttle clients so that there is no more than globalOutstandingLimit outstanding requests in the system. The default limit is 1,000.preAllocSize(Java system property: zookeeper.preAllocSize)To avoid seeks ZooKeeper allocates space in the transaction log file in blocks of preAllocSize kilobytes. The default block size is 64M. One reason for changing the size of the blocks is to reduce the block size if snapshots are taken more often. (Also, see snapCount).snapCount(Java system property: zookeeper.snapCount)ZooKeeper logs transactions to a transaction log. After snapCount transactions are written to a log file a snapshot is started and a new transaction log file is created. The default snapCount is 100,000.traceFile(Java system property: requestTraceFile)If this option is defined, requests will be will logged to a trace file named traceFile.year.month.day. Use of this option provides useful debugging information, but will impact performance. (Note: The system property has no zookeeper prefix, and the configuration variable name is different from the system property. Yes - it's not consistent, and it's annoying.)maxClientCnxns(No Java system property)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.clientPortAddressNew in 3.3.0: the address (ipv4, ipv6 or hostname) to listen for client connections; that is, the address that clients attempt to connect to. This is optional, by default we bind in such a way that any connection to the clientPort for any address/interface/nic on the server will be accepted.minSessionTimeout(No Java system property)New in 3.3.0: the minimum session timeout in milliseconds that the server will allow the client to negotiate. Defaults to 2 times the tickTime.maxSessionTimeout(No Java system property)New in 3.3.0: the maximum session timeout in milliseconds that the server will allow the client to negotiate. Defaults to 20 times the tickTime.fsync.warningthresholdms(Java system property: fsync.warningthresholdms)New in 3.3.4: A warning message will be output to the log whenever an fsync in the Transactional Log (WAL) takes longer than this value. The values is specified in milliseconds and defaults to 1000. This value can only be set as a system property.autopurge.snapRetainCount(No Java system property)New in 3.4.0: When enabled, ZooKeeper auto purge feature retains the autopurge.snapRetainCount most recent snapshots and the corresponding transaction logs in the dataDir and dataLogDir respectively and deletes the rest. Defaults to 3. Minimum value is 3.autopurge.purgeInterval(No Java system property)New in 3.4.0: The time interval in hours for which the purge task has to be triggered. Set to a positive integer (1 and above) to enable the auto purging. Defaults to 0.

中文参考

dataDir = 数据存放路径

dataLogDir = 日志存放路径

clientPort = 客户端连接端口

clientPortAddress

tickTime= 整形 不能为0

maxClientCnxns= 整形 最大客户端连接数

minSessionTimeout= 整形

maxSessionTimeout= 整形

initLimit = 整形

syncLimit = 整形

electionAlg = 整形

peerType = observer | participant

server. sid= host:port | host:port:port | host:port:port:type (type值 observer | participant)

group.gid = sid:sid (一个ID, 值是多个sid, 中间以:分割, 一个sid只能属于一个gid)

weight.sid=整形

本文转自 yanconggod 51CTO博客,原文链接:http://blog.51cto.com/yanconggod/2050787

转载地址:http://hywzo.baihongyu.com/

你可能感兴趣的文章
团队项目测试报告与用户反馈
查看>>
MyBatis(1)——快速入门
查看>>
对软件工程课程的期望
查看>>
CPU高问题排查
查看>>
Mysql中文字符串提取datetime
查看>>
CentOS访问Windows共享文件夹的方法
查看>>
IOS 与ANDROID框架及应用开发模式对比一
查看>>
由中序遍历和后序遍历求前序遍历
查看>>
JQUERY Uploadify 3.1 C#使用案例
查看>>
coursera 北京大学 程序设计与算法 专项课程 完美覆盖
查看>>
firewall 端口转发
查看>>
wndows make images
查看>>
FS系统开发设计(思维导图)
查看>>
我学习参考的网址
查看>>
DEDE自带的采集功能,标题太短的解决方法
查看>>
easyui的combotree以及tree,c#后台异步加载的详细介绍
查看>>
1、串(字符串)以及串的模式匹配算法
查看>>
[Processing]点到线段的最小距离
查看>>
考研随笔2
查看>>
ubuntu Linux 操作系统安装与配置
查看>>