故障报告

1. 问题(故障)描述

  • kafka容器异常,查看日志如下,容器自动重启

    [2021-11-06 22:33:04,876] ERROR Disk error while locking directory /usr/local/kafka/data (kafka.server.LogDirFailureChannel)
    java.nio.file.AccessDeniedException: /usr/local/kafka/data/.lock
         at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
         at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
         at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
         at sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:177)
         at java.nio.channels.FileChannel.open(FileChannel.java:287)
         at java.nio.channels.FileChannel.open(FileChannel.java:335)
         at kafka.utils.FileLock.<init>(FileLock.scala:31)
         at kafka.log.LogManager.$anonfun$lockLogDirs$1(LogManager.scala:246)
         at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:245)
         at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
         at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
         at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
         at scala.collection.TraversableLike.flatMap(TraversableLike.scala:245)
         at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:242)
         at scala.collection.AbstractTraversable.flatMap(Traversable.scala:108)
         at kafka.log.LogManager.lockLogDirs(LogManager.scala:244)
         at kafka.log.LogManager.<init>(LogManager.scala:105)
         at kafka.log.LogManager$.apply(LogManager.scala:1093)
         at kafka.server.KafkaServer.startup(KafkaServer.scala:250)
         at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
         at kafka.Kafka$.main(Kafka.scala:84)
         at kafka.Kafka.main(Kafka.scala)
  • zookeeper容器异常,内容如下,容器自动重启

2021-11-06 22:32:52,636 [myid:1] - WARN  [main:ServerCnxnFactory@309] - maxCnxns is not configured, using default value 0.
2021-11-06 22:32:52,638 [myid:1] - INFO  [main:NIOServerCnxnFactory@666] - Configuring NIO connection handler with 10s sessionless connection timeout, 1 selector thread(s), 8 worker threads, and 64 kB direct buffers.
2021-11-06 22:32:52,641 [myid:1] - INFO  [main:NIOServerCnxnFactory@674] - binding to port 0.0.0.0/0.0.0.0:2181
2021-11-06 22:32:52,661 [myid:1] - INFO  [main:WatchManagerFactory@42] - Using org.apache.zookeeper.server.watch.WatchManager as watch manager
2021-11-06 22:32:52,662 [myid:1] - INFO  [main:WatchManagerFactory@42] - Using org.apache.zookeeper.server.watch.WatchManager as watch manager
2021-11-06 22:32:52,662 [myid:1] - INFO  [main:ZKDatabase@132] - zookeeper.snapshotSizeFactor = 0.33
2021-11-06 22:32:52,662 [myid:1] - INFO  [main:ZKDatabase@152] - zookeeper.commitLogCount=500
2021-11-06 22:32:52,673 [myid:1] - INFO  [main:SnapStream@61] - zookeeper.snapshot.compression.method = CHECKED
2021-11-06 22:32:52,673 [myid:1] - INFO  [main:FileTxnSnapLog@470] - Snapshotting: 0x0 to /usr/local/zookeeper/data/version-2/snapshot.0
2021-11-06 22:32:52,684 [myid:1] - INFO  [main:ZKDatabase@289] - Snapshot loaded in 21 ms, highest zxid is 0x0, digest is 1371985504
2021-11-06 22:32:52,684 [myid:1] - INFO  [main:FileTxnSnapLog@470] - Snapshotting: 0x0 to /usr/local/zookeeper/data/version-2/snapshot.0
2021-11-06 22:32:52,685 [myid:1] - INFO  [main:ZooKeeperServer@519] - Snapshot taken in 0 ms
2021-11-06 22:32:52,697 [myid:1] - INFO  [main:RequestThrottler@74] - zookeeper.request_throttler.shutdownTimeout = 10000
2021-11-06 22:32:52,722 [myid:1] - INFO  [main:ContainerManager@83] - Using checkIntervalMs=60000 maxPerMinute=10000 maxNeverUsedIntervalMs=0
2021-11-06 22:32:52,723 [myid:1] - INFO  [main:ZKAuditProvider@42] - ZooKeeper audit is disabled.

2. 问题(故障)原因

问题描述:容器运行对目录没有使用权限,需要赋权到子目录

3. 解决

检查安装文件中是否含有chmoddirpath.sh ,如果没有,生成一个文件,赋予755权限,内容如下,执行即可

 #!/bin/bash
DIR="$(cd "$(dirname "$0")" && pwd)"
zy=${DIR}/common/zcbus.yml
if [ -f ${zy} ];then
   data_dir=`cat ${zy}  |awk -F "#" '{print $1}' |sed 's/ //g' |sed -n '/^data_dir:/p' |awk -F ":" '{print $2}'`"/zcbusdata"
   echo "  Ready for ${data_dir} chmod ..."
 else
   echo "  Yml File ${zy} is not exists ...."
   exit
fi
db_data_dir=${data_dir}/mysql/data
mkdir -p ${db_data_dir} &chmod -R 777 ${db_data_dir}
zc_data_dir=${data_dir}/cache
mkdir -p ${zc_data_dir} &chmod -R 777 ${zc_data_dir}
kfk_data_dir=${data_dir}/zcbuskafka/logs
mkdir -p ${kfk_data_dir} &chmod -R 777 ${kfk_data_dir}
zk_data_dir=${data_dir}/zcbuszookeeper/data
mkdir -p ${zk_data_dir} &chmod -R 777 ${zk_data_dir}
echo "  Finished ${data_dir} chmod ..."
[root@m2db01 zcbusServer]# ./chmoddirpath.sh 
  Ready for /data/docker/zcbusdata chmod ...
  Finished /data/docker/zcbusdata chmod ...

4. 参考

文档更新时间: 2021-11-06 15:05   作者:阿力