Qihoo360/logkafka

Usage example apparently failing

slimhazard opened this issue · 2 comments

I'm attempting to test logkafka using the usage example from README, apparently without success. When I try to read from the topic created by log_config using the Kafka console consumer, and append lines to the file specified by log_config, I don't see any messages in the topic.

logkafka started with:

$ _install/bin/logkafka -f _install/conf/logkafka.conf -e _install/conf/easylogging.conf

(Exactly as stated in Usage.)

log_config called as:

$ php tools/log_config.php --create --zookeeper=127.0.0.1:2181 --hostname=localhost --log_path=/tmp/test-logkafka --topic=test-logkafka

Then I append lines to the file using echo foo >> /tmp/test-logkafka, and read from the topic test-logkafka using the console consumer, but no messages are consumed.

Zookeeper is periodically emitting these error messages:

[2015-09-27 10:59:45,010] INFO Got user-level KeeperException when processing sessionid:0x1500dde056b003b type:create cxid:0x5607ae0f zxid:0xfffffffffffffffe txntype:unknown reqpath:n/a Error Path:/logkafka Error:KeeperErrorCode = NodeExists for /logkafka (org.apache.zookeeper.server.PrepRequestProcessor)
[2015-09-27 10:59:45,021] INFO Got user-level KeeperException when processing sessionid:0x1500dde056b003b type:create cxid:0x5607ae10 zxid:0xfffffffffffffffe txntype:unknown reqpath:n/a Error Path:/logkafka/client Error:KeeperErrorCode = NodeExists for /logkafka/client (org.apache.zookeeper.server.PrepRequestProcessor)

and:

[2015-09-27 11:13:39,056] ERROR Unexpected Exception:  (org.apache.zookeeper.server.NIOServerCnxn)
java.nio.channels.CancelledKeyException
    at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:73)
    at sun.nio.ch.SelectionKeyImpl.interestOps(SelectionKeyImpl.java:77)
    at org.apache.zookeeper.server.NIOServerCnxn.sendBuffer(NIOServerCnxn.java:418)
    at org.apache.zookeeper.server.NIOServerCnxn.sendResponse(NIOServerCnxn.java:1509)
    at org.apache.zookeeper.server.FinalRequestProcessor.processRequest(FinalRequestProcessor.java:367)
    at org.apache.zookeeper.server.SyncRequestProcessor.flush(SyncRequestProcessor.java:161)
    at org.apache.zookeeper.server.SyncRequestProcessor.run(SyncRequestProcessor.java:98)

The zookeeper shell tells me that the path /logkafka/client does exist. Unfortunately I don't know how to investigate the CancelledKeyException (and I can't say whether any of these error messages are relevant to the problem).

When you create config with $ php tools/log_config.php --create --zookeeper=127.0.0.1:2181 --hostname=localhost --log_path=/tmp/test-logkafka --topic=test-logkafka, please use the true hostname(e.g. output of shell command $ hostname, not localhost).

Fixed: check if hostname is localhost when creating or modifying config.