I have kafka and zookeeper set up on a remote machine. On that machine I'm able to see below working using the test method on official website.
> bin/kafka-console-producer.sh --broker-list localhost:9092 --topic listings-incoming
This is a message
This is another message
> bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --listings-incoming --from-beginning
This is a message
This is another message
but when I use my local consumer script it is not working:
bin/kafka-console-consumer.sh —bootstrap-server X.X.X.X:9092 —listings-incoming —from-beginning —consumer-property group.id=group2
Haven't seen messages showing up but what is showing is:
[2017-08-11 14:39:56,425] WARN Auto-commit of offsets {listings-incoming-4=OffsetAndMetadata{offset=0, metadata=''}, listings-incoming-2=OffsetAndMetadata{offset=0, metadata=''}, listings-incoming-3=OffsetAndMetadata{offset=0, metadata=''}, listings-incoming-0=OffsetAndMetadata{offset=0, metadata=''}, listings-incoming-1=OffsetAndMetadata{offset=0, metadata=''}} failed for group group1: Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records. (org.apache.kafka.clients.consumer.internals.ConsumerCoordinator)
*****************update**********************
My zookeeper and kafka is running on the same machine, right now my configuration on advertised.listeners is this:
advertised.listeners=PLAINTEXT://the.machine.ip.address:9092
I tried to change it to:
advertised.listeners=PLAINTEXT://my.client.ip.address:9092
and then run the client side consumer script, it gives error:
[2017-08-11 15:49:01,591] WARN Error while fetching metadata with correlation id 3 : {listings-incoming=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2017-08-11 15:49:22,106] WARN Bootstrap broker 10.161.128.238:9092 disconnected (org.apache.kafka.clients.NetworkClient) [2017-08-11 15:49:22,232] WARN Error while fetching metadata with correlation id 7 : {listings-incoming=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2017-08-11 15:49:22,340] WARN Error while fetching metadata with correlation id 8 : {listings-incoming=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) [2017-08-11 15:49:40,453] WARN Bootstrap broker 10.161.128.238:9092 disconnected (org.apache.kafka.clients.NetworkClient) [2017-08-11 15:49:40,531] WARN Error while fetching metadata with correlation id 12 : {listings-incoming=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
/etc/hosts
and try again. – Kamal Chandraprakash