Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1184591
  • 博文数量: 259
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 2518
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-13 16:12
个人简介

科技改变世界,技术改变人生。

文章分类

全部博文(259)

分类: 大数据

2016-02-03 16:15:23

近期公司Zookeeper得log文件将系统占用快满了,查看相关文档,

从3.4.0开始,zookeeper提供了自动清理snapshot和事务日志的功能,
通过配置 autopurge.snapRetainCount 和 autopurge.purgeInterval 这两个参数能够实现定时清理了。
这两个参数都是在zoo.cfg中配置的,将其前面的注释去掉,根据需要修改日志保留个数:


点击(此处)折叠或打开

  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing,
  12. # software distributed under the License is distributed on an
  13. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. # KIND, either express or implied. See the License for the
  15. # specific language governing permissions and limitations
  16. # under the License.
  17. #
  18. #
  19. #
  20. # The number of milliseconds of each tick
  21. tickTime=2000
  22. # The number of ticks that the initial
  23. # synchronization phase can take
  24. initLimit=10
  25. # The number of ticks that can pass between
  26. # sending a request and getting an acknowledgement
  27. syncLimit=5
  28. # the directory where the snapshot is stored.
  29. dataDir=/diska/hadoop/zookeeper
  30. # the port at which the clients will connect
  31. clientPort=2181
  32. server.1=dn110.104.jx:2888:3888
  33. server.2=dn111.104.jx:2888:3888
  34. server.3=dn112.104.jx:2888:3888

  35. # Custom properties
  36. autopurge.purgeInterval=1
  37. maxClientCnxns=300
  38. autopurge.snapRetainCount=3


autopurge.purgeInterval  
这个参数指定了清理频率,单位是小时,需要填写一个1或更大的整数,默认是0,表示不开启自己清理功能。

autopurge.snapRetainCount
这个参数和上面的参数搭配使用,这个参数指定了需要保留的文件数目。默认是保留3个。

maxClientCnxns
单个客户端与单台服务器之间的连接数的限制,是ip级别的,默认是60,如果设置为0,那么表明不作任何限制。请注意这个限制的使用范围,仅仅是单台客户端机器与单台ZK服务器之间的连接数限制,不是针对指定客户端IP,也不是ZK集群的连接数限制,也不是单台ZK对所有客户端的连接数限制。
阅读(3376) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~