zookeeper清理日志

本文涉及的产品
服务治理 MSE Sentinel/OpenSergo,Agent数量 不受限
简介:

一、描述

    大早上刚到公司就发现报警,磁盘容量告警,zookeeper集群服务器报警。


二、处理过程


  1. 查看磁盘空间

df -h


2.确认那个目录占用空间比较多,发现是zookeeper

修改zookeeper参数文件(版本3.4.6)

vi zoo.cfg

# The number of snapshots to retain in dataDir

autopurge.snapRetainCount=20    #保留log和snapshot各20个

# Purge task interval in hours

# Set to "0" to disable auto purge feature

autopurge.purgeInterval=1    #每小时清理一次


3.查看状态

$ /usr/local/RoilandGroup/zookeeper/bin/zkServer.sh status

JMX enabled by default

Using config: /usr/local/RoilandGroup/zookeeper/bin/../conf/zoo.cfg

Mode: leader


4.关闭服务

$ /usr/local/RoilandGroup/zookeeper/bin/zkServer.sh stop

JMX enabled by default

Using config: /usr/local/RoilandGroup/zookeeper/bin/../conf/zoo.cfg

Stopping zookeeper ... STOPPED


5.重启服务

$ /usr/local/RoilandGroup/zookeeper/bin/zkServer.sh start

JMX enabled by default

Using config: /usr/local/RoilandGroup/zookeeper/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED

[hadoop@host-10-60-40-37 conf]$ jps

8118449 QuorumPeerMain


6.zookeeper集群中每一个节点都需要修改参数文件,然后重启服务.

至于为什么这么修改,是否还有其他的方式,大家可以看官方文档,或者比较懒就百度。



7.理解每一个参数文件,看注释就行


less zoo.cfg

# The number of milliseconds of each tick

tickTime=2000

# The number of ticks that the initial

# synchronization phase can take

initLimit=10

# The number of ticks that can pass between

# sending a request and getting an acknowledgement

syncLimit=5

# the directory where the snapshot is stored.

# do not use /tmp for storage, /tmp here is just

# example sakes.

dataDir=/data/zookeeper

# the port at which the clients will connect

clientPort=2181

# the maximum number of client connections.

# increase this if you need to handle more clients

#maxClientCnxns=60

#

# Be sure to read the maintenance section of the

# administrator guide before turning on autopurge.

#

# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

#

# The number of snapshots to retain in dataDir

autopurge.snapRetainCount=20

# Purge task interval in hours

# Set to "0" to disable auto purge feature

autopurge.purgeInterval=1

#####################################################

#####################################################

#####################################################

server.1=10.10.10.11:2888:3888

server.2=10.10.10.12:2888:3888

server.3=10.10.10.13:2888:3888

server.4=10.10.10.14:2888:3888

server.5=10.10.10.15:2888:3888











本文转自 roidba 51CTO博客,原文链接:http://blog.51cto.com/roidba/1923375,如需转载请自行联系原作者
相关实践学习
基于MSE实现微服务的全链路灰度
通过本场景的实验操作,您将了解并实现在线业务的微服务全链路灰度能力。
目录
相关文章
|
6天前
|
Linux Shell
Linux手动清理Linux脚本日志定时清理日志和log文件执行表达式
Linux手动清理Linux脚本日志定时清理日志和log文件执行表达式
249 1
|
6天前
|
前端开发 Java 调度
XXL-JOB 日志表和日志文件自动清理
XXL-JOB 日志表和日志文件自动清理
|
6天前
|
XML SQL 运维
关于日志的清理
关于日志的清理
12 0
|
6天前
|
弹性计算 运维 Shell
清理日志文件
【4月更文挑战第29天】
16 1
|
6天前
|
消息中间件 存储 Kafka
【Kafka】Kafka 的日志保留期与数据清理策略
【4月更文挑战第13天】【Kafka】Kafka 的日志保留期与数据清理策略
|
6天前
|
SQL 存储 关系型数据库
Mysql主从同步 清理二进制日志的技巧
Mysql主从同步 清理二进制日志的技巧
14 1
|
6天前
|
XML 运维 监控
【深入探究 C++ 日志库清理策略】glog、log4cplus 和 spdlog 的日志文件管理策略
【深入探究 C++ 日志库清理策略】glog、log4cplus 和 spdlog 的日志文件管理策略
92 0
|
6天前
|
Linux
Linux日志自动清理方案
Linux日志自动清理方案
137 0
|
6天前
|
存储 Docker 容器
Docker 容器日志查看和清理
Docker 容器日志查看和清理
|
6月前
|
Linux Shell 调度
Linux 系统&自动清理日志实现脚本
1.删除文件命令:find 对应目录 命令选项
124 0