一旦我为kafka服务器运行命令,Zookeeper就会自动关闭

时间:2018-07-25 13:18:49

标签: java apache-kafka apache-zookeeper

我正在努力解决一个非常奇怪的问题。之前没有任何问题。

我必须启动Zookeeper和Kafka。为此,我执行以下操作:

  1. nohup bin / zookeeper-server-start.sh config / zookeeper.properties&

此后,当我运行jps命令时:我可以看到QuaorumPeerMain是一个用于Zookeeper的进程。

现在我跑步 2. nohup bin / kafka-server-start.sh config / server.properties&

此后,当我运行JPS时,zookeeper的进程也消失了,它会自动关闭。

log:

[2018-07-25 01:31:21,832] INFO Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib (org.apache.zookeeper.ZooKeeper)
[2018-07-25 01:31:21,832] INFO Client environment:java.io.tmpdir=/tmp (org.apache.zookeeper.ZooKeeper)
[2018-07-25 01:31:21,832] INFO Client environment:java.compiler=<NA> (org.apache.zookeeper.ZooKeeper)
[2018-07-25 01:31:21,832] INFO Client environment:os.name=Linux (org.apache.zookeeper.ZooKeeper)
[2018-07-25 01:31:21,832] INFO Client environment:os.arch=amd64 (org.apache.zookeeper.ZooKeeper)
[2018-07-25 01:31:21,832] INFO Client environment:os.version=3.10.0-862.3.3.el7.x86_64 (org.apache.zookeeper.ZooKeeper)
[2018-07-25 01:31:21,832] INFO Client environment:user.name=kumar.shorav (org.apache.zookeeper.ZooKeeper)
[2018-07-25 01:31:21,832] INFO Client environment:user.home=/home/kumar.shorav (org.apache.zookeeper.ZooKeeper)
[2018-07-25 01:31:21,832] INFO Client environment:user.dir=/app/opt/kafka_2.10-0.10.2.1 (org.apache.zookeeper.ZooKeeper)
[2018-07-25 01:31:21,833] INFO Initiating client connection, connectString=localhost:2181 sessionTimeout=6000 watcher=org.I0Itec.zkclient.ZkClient@8dbdac1 (org.apache.zookeeper.ZooKeeper)
[2018-07-25 01:31:21,849] INFO Waiting for keeper state SyncConnected (org.I0Itec.zkclient.ZkClient)
[2018-07-25 01:31:21,852] INFO Opening socket connection to server localhost.localdomain/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2018-07-25 01:31:21,859] INFO Socket connection established to localhost.localdomain/127.0.0.1:2181, initiating session (org.apache.zookeeper.ClientCnxn)
[2018-07-25 01:31:21,862] INFO Accepted socket connection from /127.0.0.1:38370 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2018-07-25 01:31:21,870] INFO Client attempting to establish new session at /127.0.0.1:38370 (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:31:21,871] INFO Creating new log file: log.181 (org.apache.zookeeper.server.persistence.FileTxnLog)
[2018-07-25 01:31:21,874] ERROR Severe unrecoverable error, from thread : SyncThread:0 (org.apache.zookeeper.server.ZooKeeperCriticalThread)
java.io.FileNotFoundException: /tmp/zookeeper/version-2/log.181 (Permission denied)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.apache.zookeeper.server.persistence.FileTxnLog.append(FileTxnLog.java:209)
        at org.apache.zookeeper.server.persistence.FileTxnSnapLog.append(FileTxnSnapLog.java:314)
        at org.apache.zookeeper.server.ZKDatabase.append(ZKDatabase.java:470)
        at org.apache.zookeeper.server.SyncRequestProcessor.run(SyncRequestProcessor.java:140)
[2018-07-25 01:31:21,877] INFO Thread SyncThread:0 exits, error code 1 (org.apache.zookeeper.server.ZooKeeperServerListenerImpl)
[2018-07-25 01:31:21,877] INFO SyncRequestProcessor exited! (org.apache.zookeeper.server.SyncRequestProcessor)
[2018-07-25 01:31:21,878] INFO Closed socket connection for client /127.0.0.1:38370 which had sessionid 0x164d01e0a460000 (org.apache.zookeeper.server.NIOServerCnxn)
[2018-07-25 01:31:21,879] INFO Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
[2018-07-25 01:31:21,879] INFO NIOServerCnxn factory exited run method (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2018-07-25 01:31:21,880] INFO shutting down (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:31:21,880] INFO Shutting down (org.apache.zookeeper.server.SessionTrackerImpl)
[2018-07-25 01:31:21,881] INFO Shutting down (org.apache.zookeeper.server.PrepRequestProcessor)
[2018-07-25 01:31:21,881] INFO Shutting down (org.apache.zookeeper.server.SyncRequestProcessor)
[2018-07-25 01:31:21,881] INFO PrepRequestProcessor exited loop! (org.apache.zookeeper.server.PrepRequestProcessor)
[2018-07-25 01:31:21,881] INFO shutdown of request processor complete (org.apache.zookeeper.server.FinalRequestProcessor)
[2018-07-25 01:31:21,881] INFO Exiting normally (org.apache.zookeeper.server.ZooKeeperServerMain)
[2018-07-25 01:31:23,914] INFO Opening socket connection to server localhost.localdomain/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)

[2018-07-25 01:51:13,467] INFO Server environment:java.io.tmpdir=/tmp (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,467] INFO Server environment:java.compiler=<NA> (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,467] INFO Server environment:os.name=Linux (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,468] INFO Server environment:os.arch=amd64 (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,468] INFO Server environment:os.version=3.10.0-862.3.3.el7.x86_64 (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,468] INFO Server environment:user.name=kumar.shorav (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,468] INFO Server environment:user.home=/home/kumar.shorav (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,468] INFO Server environment:user.dir=/app/opt/kafka_2.10-0.10.2.1 (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,477] INFO tickTime set to 3000 (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,477] INFO minSessionTimeout set to -1 (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,477] INFO maxSessionTimeout set to -1 (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:13,489] INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2018-07-25 01:51:41,099] INFO Accepted socket connection from /127.0.0.1:40262 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2018-07-25 01:51:41,107] INFO Client attempting to establish new session at /127.0.0.1:40262 (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:41,108] INFO Creating new log file: log.181 (org.apache.zookeeper.server.persistence.FileTxnLog)
[2018-07-25 01:51:41,111] ERROR Severe unrecoverable error, from thread : SyncThread:0 (org.apache.zookeeper.server.ZooKeeperCriticalThread)
java.io.FileNotFoundException: /tmp/zookeeper/version-2/log.181 (Permission denied)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.apache.zookeeper.server.persistence.FileTxnLog.append(FileTxnLog.java:209)
        at org.apache.zookeeper.server.persistence.FileTxnSnapLog.append(FileTxnSnapLog.java:314)
        at org.apache.zookeeper.server.ZKDatabase.append(ZKDatabase.java:470)
        at org.apache.zookeeper.server.SyncRequestProcessor.run(SyncRequestProcessor.java:140)
[2018-07-25 01:51:41,113] INFO Thread SyncThread:0 exits, error code 1 (org.apache.zookeeper.server.ZooKeeperServerListenerImpl)
[2018-07-25 01:51:41,113] INFO SyncRequestProcessor exited! (org.apache.zookeeper.server.SyncRequestProcessor)
[2018-07-25 01:51:41,114] INFO Closed socket connection for client /127.0.0.1:40262 which had sessionid 0x164d034b9130000 (org.apache.zookeeper.server.NIOServerCnxn)
[2018-07-25 01:51:41,114] INFO NIOServerCnxn factory exited run method (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2018-07-25 01:51:41,115] INFO shutting down (org.apache.zookeeper.server.ZooKeeperServer)
[2018-07-25 01:51:41,115] INFO Shutting down (org.apache.zookeeper.server.SessionTrackerImpl)
[2018-07-25 01:51:41,115] INFO Shutting down (org.apache.zookeeper.server.PrepRequestProcessor)
[2018-07-25 01:51:41,115] INFO Shutting down (org.apache.zookeeper.server.SyncRequestProcessor)
[2018-07-25 01:51:41,115] INFO PrepRequestProcessor exited loop! (org.apache.zookeeper.server.PrepRequestProcessor)
[2018-07-25 01:51:41,115] INFO shutdown of request processor complete (org.apache.zookeeper.server.FinalRequestProcessor)
[2018-07-25 01:51:41,116] INFO Exiting normally (org.apache.zookeeper.server.ZooKeeperServerMain)

我不是要弄清楚为什么突然出现的表。 请看看并帮助我。

enter image description here

2 个答案:

答案 0 :(得分:2)

如果您仔细查看日志,特别是java.io.FileNotFoundException: /tmp/zookeeper/version-2/log.181 (Permission denied),它将讨论dataDir目录权限更改。 仅供参考,dataDir是您在zookeeper.properties中指定的目录快照,在您的情况下,我猜它是:/tmp/zookeeper/...

您可以检查linux / putty上授予此文件夹哪些权限,看起来权限已更改,这引起了上述问题。 让我知道这是否对您有用。谢谢!

答案 1 :(得分:0)

  • 停止动物园管理员。
  • 删除zookeeper和kafka的所有日志。