<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; font-family:"PingFang SC","Microsoft YaHei",SimHei,Arial,SimSun; font-size:16px; color:rgb(44,44,44)"> 在使用zookeeper过程中,我们知道,会有dataDir和dataLogDir两个目录,分别用于snapshot和事务日志的输出(默认情况下只有dataDir目录,snapshot和事务日志都保存在这个目录中,关于这两个目录的详细说明,请看《<a href="http://nileader.blog.51cto.com/1381108/795265" rel="noopener noreferrer" style="background:transparent; color:rgb(44,98,141); text-decoration:none; margin:0px; padding:0px; outline:none" target="_blank">ZooKeeper管理员指南</a>》)。</p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; font-family:"PingFang SC","Microsoft YaHei",SimHei,Arial,SimSun; font-size:16px; color:rgb(44,44,44)"> </p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; font-family:"PingFang SC","Microsoft YaHei",SimHei,Arial,SimSun; font-size:16px; color:rgb(44,44,44)"> <span style="">第一种</span>,也是运维人员最常用的,写一个删除日志脚本,每天定时执行即可:</p>
<div style="margin:0px; padding:0px; font-family:"PingFang SC","Microsoft YaHei",SimHei,Arial,SimSun; font-size:16px; color:rgb(44,44,44)">
<div id="highlighter_523209" style="margin:0px; padding:0px">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent"><tbody style="background:none!important"><tr style="background:none!important"><td style="color:rgb(175,175,175)!important; background:none!important">
<div style="margin:0px; padding:0px">
1
</div>
<div style="margin:0px; padding:0px">
2
</div>
<div style="margin:0px; padding:0px">
3
</div>
<div style="margin:0px; padding:0px">
4
</div>
<div style="margin:0px; padding:0px">
5
</div>
<div style="margin:0px; padding:0px">
6
</div>
<div style="margin:0px; padding:0px">
7
</div>
<div style="margin:0px; padding:0px">
8
</div>
<div style="margin:0px; padding:0px">
9
</div>
<div style="margin:0px; padding:0px">
10
</div>
<div style="margin:0px; padding:0px">
11
</div>
<div style="margin:0px; padding:0px">
12
</div>
<div style="margin:0px; padding:0px">
13
</div>
<div style="margin:0px; padding:0px">
14
</div> </td><td style="background:none!important">
<div style="margin:0px; padding:0px; background:none!important">
<div style="margin:0px; padding:0px">
<code style="font-family:Monaco,Menlo,Consolas,"Courier New",monospace; font-size:14.4px; padding:2px 4px; color:gray!important; white-space:nowrap; background:none!important">#!/bin/bash</code>
</div>
<div style="margin:0px; padding:0px">
<code style="font-family:Monaco,Menlo,Consolas,"Courier New",monospace; font-size:14.4px; padding:2px 4px; color:rgb(199,37,78); white-space:nowrap; background:none!important"> </code>
</div>
<div style="margin:0px; padding:0px">
<code style="font-family:Monaco,Menlo,Consolas,"Courier New",monospace; font-size:14.4px; padding:2px 4px; color:rgb(0,130,0)!important; white-space:nowrap; background:none!important">#snapshot file dir</code>
</div>
<div style="margin:0px; padding:0px">
<code style="font-family:Monaco,Menlo,Consolas,"Courier New",monospace; font-size:14.4px; padding:2px 4px; color:rgb(199,37,78); white-space:nowrap; background:none!important">dataDir=/user/upload/zookeeper/version-2</code>
</div>
<div style="margin:0px; padding:0px">
<code style="font-family:Monaco,Menlo,Consolas,"Courier New",monospace; font-size:14.4px; padding:2px 4px; color:rgb(0,130,0)!important; white-space:nowrap; background:none!important">#tran log dir</code>
</div>
<div style="margin:0px; padding:0px">
<code style="font-family:Monaco,Menlo,Consolas,"Courier New",monospace; font-size:14.4px; padding:2px 4px; color:rgb(199,37,78); white-space:nowrap; background:none!important">dataLogDir=</code>
<span style="margin:0px; padding:0px; font-family:monospace; color:rgb(44,44,44); background-color:initial">/user/upload/zookeeper/version-2</span>
</div>
<div style="margin:0px; padding:0px">
<code style="font-family:Monaco,Menlo,Consolas,"Courier New",monospace; font-size:14.4px; padding:2px 4px; color:rgb(199,37,78); white-space:nowrap; background:none!important">logDir=/home/nileader/taokeeper/logs</code>
</div>
<div style="margin:0px; padding:0px">
<code style="font-family:Monaco,Menlo,Consolas,"Courier New",monospace; font-size:14.4px; padding:2px 4px; color:rgb(0,130,0)!important; white-space:nowrap; background:none!important">#Leave 60 files</code>
</div>
<div style="margin:0px; padding:0px">
<code style="font-family:Monaco,Menlo,Consolas,"Courier New",monospace; font-size:14.4px; padding:2px 4px; color:rgb(199,37,78); white-space:nowrap; backgrou |
|