ZK部署报错
根本原因是:
snapshot目录和log目录不一致时,并且snapshot目录下存在log文件
可能的原因:
原本zk部署的时候不区分目录,但是修改了路径配置后snapshot目录变成了原本的log目录
// check content of transaction log and snapshot dirs if they are two different directories
// See ZOOKEEPER-2967 for more details
if(!this.dataDir.getPath().equals(this.snapDir.getPath())){
checkLogDir();
checkSnapDir();
}
我们就来看看zk 2967是怎么描述的吧
https://issues.apache.org/jira/browse/ZOOKEEPER-2967
According to ZOOKEEPER-2960we should at a startup check to validate that dataDir and dataLogDir parameters are set correctly.
Perhaps we should introduce a check of some kind? If datalogdir is different that datadir and snapshots exist in datalogdir we throw an exception and quit.
涉及到的校验规则有以下四种:
For testing, I've added 4 new unit tests which cover the following cases:
1. transaction log and snapshot directories are different and they are used correctly (no Exception)
2. transaction log and snapshot directories are the same (in this case no check is done)
3. transaction log and snapshot directories are different and transaction log directory contains snapshot files (LogdirContentCheckException -> ZK quits)
4. transaction log and snapshot directories are different and snapshot directory contains transaction log files (SnapdirContentCheckException -> ZK quits)
是这样说的,根据2960提案,启动时应该校验data目录和dataLog目录设置是否正确
如果dataLog目录和data目录不同,并且dataLog目录存在snapshot快照,那么就抛异常并报错
2960提案,我们来看下里面讨论了什么吧
https://issues.apache.org/jira/browse/ZOOKEEPER-2960
提案名称是:The dataDir and dataLogDir are used opposingly 事务日志目录和快照日志目录用反了。。
说的是3.4.5to 3.4.11版本之间存在这种用反的现象
所以高版本》3.4.11解决了这个问题,但是为了防止历史遗留问题造成的影响会判断一下是否从之前的版本升级过来的,即是否存在混用的情况
网友评论