I have kafka and zookeeper running in a standalone mode on an ec2 instance. I have a topic named dev_spark1 created on it. But when I am trying to run consumer from command line, gives me following error for command:
./bin/kafka-console-consumer.sh --zookeeper 172.31.8.226:9092 --topic dev_spark1
Exception in thread "main" org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000
at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:880)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:98)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:84)
at kafka.consumer.ZookeeperConsumerConnector.connectZk(ZookeeperConsumerConnector.scala:171)
at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:126)
at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:143)
at kafka.consumer.Consumer$.create(ConsumerConnector.scala:94)
at kafka.tools.ConsoleConsumer$.main(ConsoleConsumer.scala:145)
at kafka.tools.ConsoleConsumer.main(ConsoleConsumer.scala)