No se puede encontrar el tema al generar mensajes: UNKNOWN_TOPIC_OR_PARTITION

Tengo un clúster kafka de dos nodos (instancias EC2) donde cada nodo se usa como un agente independiente. Cuando ejecuto un productor en la instancia líder con el siguiente comando:

kafka-console-producer.sh   --broker-list localhost:9092 --topic test

Recibo los siguientes errores.

mensaje de prueba [2017-01-09 13: 22: 39,483] WARN Error al recuperar metadatos con correlación id 0: {test = UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient) [2017-01-09 13:22: 39,562] WARN Error al recuperar metadatos con correlación id 1: {test = UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient) [2017-01-09 13: 22: 39,663] WARN Error al recuperar metadatos con correlación id 2: {test = UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient) ...

Listado de los temas conkaka-topics.sh muestra que el tema existe.

La descripción del tema con:

kafka-topics.sh --zookeeper localhost:2181 --describe --topic test

devoluciones

 Topic:test PartitionCount:8    ReplicationFactor:1 Configs:
     Topic: test    Partition: 0    Leader: 1   Replicas: 1 Isr: 1
     Topic: test    Partition: 1    Leader: 2   Replicas: 2 Isr: 2
     Topic: test    Partition: 2    Leader: 1   Replicas: 1 Isr: 1
     Topic: test    Partition: 3    Leader: 2   Replicas: 2 Isr: 2
     Topic: test    Partition: 4    Leader: 1   Replicas: 1 Isr: 1
     Topic: test    Partition: 5    Leader: 2   Replicas: 2 Isr: 2
     Topic: test    Partition: 6    Leader: 1   Replicas: 1 Isr: 1
     Topic: test    Partition: 7    Leader: 2   Replicas: 2 Isr: 2

Estoy usando kafka 0.10.1.1.

server.propertes el archivo contiene:

listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://0.0.0.0:9092
port=9092
host.name=kafka-node1(kafka-node1 for the second host)
advertised.host.name=kafka-node1(kafka-node2 for the second host)
advertised.port=9092

Cuando intento producir mensajes desde el segundo host, recibo el siguiente mensaje:

WARN El error obtenido produce una respuesta con el ID de correlación 1 en el tema-partición test-4, reintentando (quedan 2 intentos) Error: NOT_LEADER_FOR_PARTITION (org.apache.kafka.clients.producer.internals.Sender) ...

Alguien puede ayudarme porfavor? Gracias.

Respuestas a la pregunta(1)

Su respuesta a la pregunta