Closed
Description
B1, B2, B3 - Brokers
Scale down B2, B3 - Now B1 becomes the leader for topics
Scale down B1
Scale up B2, B3
Only after scaling up B1 We can receive the message in that topic
The issue is, without restarting the Kafka client consumer not trying to connect to the next broker if the current broker is crashed.
consumer = KafkaConsumer(
<<topic>>,
group_id=<<group-id>>,
bootstrap_servers=[B1,B2,B3],
auto_offset_reset='latest'
)
for message in consumer:
# message value and key are raw bytes -- decode if necessary!
# e.g., for unicode: `message.value.decode('utf-8')`
print("%s:%d:%d: key=%s value=%s" % (message.topic, message.partition,
message.offset, message.key,
message.value))
Error:
DEBUG:kafka.client:Initializing connection to node 2 for metadata request
DEBUG:kafka.conn:<BrokerConnection node_id=2 host=<<host>> <disconnected> [IPv4 ('<<host>>', 9094)]>: creating new socket
DEBUG:kafka.conn:<BrokerConnection node_id=2 host=<<host>> <disconnected> [IPv4 ('<<host>>', 9094)]>: setting socket option (6, 1, 1)
INFO:kafka.conn:<BrokerConnection node_id=2 host=<<host>> <connecting> [IPv4 ('<<host>>', 9094)]>: connecting to <<host>> [('<<host>>', 9094) IPv4]
ERROR:kafka.conn:Connect attempt to <BrokerConnection node_id=2 host=<<host>> <connecting> [IPv4 ('<<host>>', 9094)]> returned error 111. Disconnecting.
INFO:kafka.conn:<BrokerConnection node_id=2 host=<<host>> <connecting> [IPv4 ('<<host>>)]>: Closing connection. KafkaConnectionError: 111 ECONNREFUSED
DEBUG:kafka.conn:<BrokerConnection node_id=2 host=<<host>> <connecting> [IPv4 ('<<host>>)]>: reconnect backoff 1.0150467424400873 after 121 failures
WARNING:kafka.client:Node 2 connection failed -- refreshing metadata
DEBUG:kafka.client:Give up sending metadata request since no node is available
DEBUG:kafka.client:Give up sending metadata request since no node is available
DEBUG:kafka.client:Give up sending metadata request since no node is available
Metadata
Metadata
Assignees
Labels
No labels