Kafka 集群启动警告 |无法更新 IO 指标 |访问DeniedException:/proc/self/io

Kafka cluster startup warning | Unable to update IO metrics | AccessDeniedException: /proc/self/io

提问人:Dnyaneshwar 提问时间:11/10/2023 更新时间:11/15/2023 访问量:93

问:

我在 OEL8 服务器上有一个由 2 节点 Kafka KRaft 集群组成的设置,详细信息如下:

Kafka 版本:kafka_2.13-3.4.0 Java 版本:OpenJDK 17

vmhost1:server.properties

process.roles=broker,controller
node.id=1
controller.quorum.voters=1@vmhost1:9093,2@vmhost2:9093
listeners=PLAINTEXT://vmhost1:9092,CONTROLLER://vmhost1:9093
advertised.listeners=PLAINTEXT://vmhost1:9092

vmhost2:server.properties

process.roles=broker,controller
node.id=2
controller.quorum.voters=1@vmhost1:9093,2@vmhost2:9093
listeners=PLAINTEXT://vmhost2:9092,CONTROLLER://vmhost2:9093
advertised.listeners=PLAINTEXT://vmhost2:9092
ls -la /proc/self/io
-r--------. 1 kafka kafkagrp 0 Nov 10 01:18 /proc/self/io

启动 Kafka 服务器后,我遇到了以下错误。

[kafka@vmhost1 kafka_2.13-3.4.0]$ ./bin/kafka-server-start.sh ./config/kraft/server.properties
[2023-11-10 00:56:43,631] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2023-11-10 00:56:43,902] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2023-11-10 00:56:44,041] WARN Unable to update IO metrics (kafka.server.BrokerServer)
java.nio.file.AccessDeniedException: /proc/self/io
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
        at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)
        at java.base/java.nio.file.Files.newInputStream(Files.java:160)
        at java.base/java.nio.file.Files.newBufferedReader(Files.java:2922)
        at java.base/java.nio.file.Files.readAllLines(Files.java:3412)
        at java.base/java.nio.file.Files.readAllLines(Files.java:3453)
        at kafka.metrics.LinuxIoMetricsCollector.updateValues(LinuxIoMetricsCollector.scala:71)
        at kafka.metrics.LinuxIoMetricsCollector.usable(LinuxIoMetricsCollector.scala:91)
        at kafka.server.KafkaBroker.$init$(KafkaBroker.scala:106)
        at kafka.server.BrokerServer.<init>(BrokerServer.scala:74)
        at kafka.server.KafkaRaftServer.<init>(KafkaRaftServer.scala:80)
        at kafka.Kafka$.buildServer(Kafka.scala:85)
        at kafka.Kafka$.main(Kafka.scala:93)
        at kafka.Kafka.main(Kafka.scala)
[2023-11-10 00:56:44,050] INFO Registered signal handlers for TERM, INT, HUP (org.apache.kafka.common.utils.LoggingSignalHandler)
[2023-11-10 00:56:44,053] INFO Starting controller (kafka.server.ControllerServer)
[2023-11-10 00:56:44,064] WARN Unable to update IO metrics (kafka.server.ControllerServer)
java.nio.file.AccessDeniedException: /proc/self/io
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
        at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)
        at java.base/java.nio.file.Files.newInputStream(Files.java:160)
        at java.base/java.nio.file.Files.newBufferedReader(Files.java:2922)
        at java.base/java.nio.file.Files.readAllLines(Files.java:3412)
        at java.base/java.nio.file.Files.readAllLines(Files.java:3453)
        at kafka.metrics.LinuxIoMetricsCollector.updateValues(LinuxIoMetricsCollector.scala:71)
        at kafka.metrics.LinuxIoMetricsCollector.usable(LinuxIoMetricsCollector.scala:91)
        at kafka.server.ControllerServer.startup(ControllerServer.scala:142)
        at kafka.server.KafkaRaftServer.$anonfun$startup$1(KafkaRaftServer.scala:98)
        at kafka.server.KafkaRaftServer.$anonfun$startup$1$adapted(KafkaRaftServer.scala:98)
        at scala.Option.foreach(Option.scala:437)
        at kafka.server.KafkaRaftServer.startup(KafkaRaftServer.scala:98)
        at kafka.Kafka$.main(Kafka.scala:115)
        at kafka.Kafka.main(Kafka.scala)

我尝试过更改权限,但即使使用 sudo 也是不允许的

chmod 640 /proc/self/io
chmod: changing permissions of ‘/proc/self/io’: Operation not permitted

请帮助我提供解决方案或一些建议。

Java Linux Apache - 卡夫卡

评论

0赞 appchemist 11/14/2023
你有没有检查过进程是由哪个用户和组运行的?
0赞 Dnyaneshwar 11/14/2023
@appchemist 是的,该进程正在使用对 /proc/self/io 具有读取权限的用户运行。' ps -p 2400932 -o user,group USER GROUP kafka kafkagrp 'kafka
0赞 rkosegi 11/15/2023
/proc/self始终与访问它的进程相关联。尝试将其更改为其他程序就像将 localhost 共享给 Internet 中的某人一样

答:

0赞 appchemist 11/15/2023 #1

/proc/self方法/proc/{pid}

在这里查看

所以,chmod 命令不是 kafka 进程的/proc/self/proc/self

没错,你改变了/proc/{kafka process pid}/io

但是更改权限并不是一个完美的解决方案,因为每次运行程序时,操作系统都会创建一个新的权限。/proc/{pid}

下面的链接看起来像一个类似的问题,请查看 https://unix.stackexchange.com/questions/297190/owner-cant-read-proc-pid-io