如果出于任何原因ntp同步。如果同时将群集的日期/时间再次同步到正确的日期/时间,则日期/时间将丢失正确的时间并且群集将更改为将来的日期/时间,然后在10分钟后将不会删除Zk中创建的客户端会话。 / p>
现在我的假设是在crontabs中激活了动物园管理员清洁程序(每10分钟一次),但只是过去的清洁会议!!!
0-59 / 10 * * * * /opt/dve/bin/zookeeper_cleanup.sh
因此无法清除将来创建的会话,但只能在同一天返回到将来,并等到zookeeper_cleanup.sh在10分钟后清除会话。
我试图删除日志文件,但它可能不正确,可能会导致其他问题。 所以我应该做的更好。
答案 0 :(得分:0)
For last ,we remove the log by zookeeper api.as:
Stat stat = null;
List<String> children = this.zooKeeper.getChildren(tempSessionPath, false, stat);
System.out.println(children.size() + " sessions found.");
int count = 0;
for(String child:children){
String path = this.tempSessionPath + "/" + child;
stat = this.zooKeeper.exists(path, false);
if(null != stat && stat.getCtime() > currentTime){
count++;
System.out.println("Session created in future time " + stat.getCtime() + " to be deleted!");
safeDeleteZKNode(path, stat);
}
}
System.out.println(count + " future sessions cleaned!");