wvanbergen / kafka-consumer Goto Github PK
View Code? Open in Web Editor NEWHigh-level Ruby consumer for Kafka.
License: MIT License
High-level Ruby consumer for Kafka.
License: MIT License
Hi,
I was trying this gem, which is mostly really good. But when I tried to add more processes into the consumer groups, partitions are not automatically rebalanced / redistributed.
Steps I took:
I, [2015-11-10T21:38:01.779225 #17898] INFO -- : Registered for my_high_level_consumer as ip-10-2-13-56:5c975c69-a251-4a52-9a6f-79738ba09f0c
I, [2015-11-10T21:38:01.781026 #17898] INFO -- : 2 instances have been registered: ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0, ip-10-2-13-56:5c975c69-a251-4a52-9a6f-79738ba09f0c.
I, [2015-11-10T21:38:01.781332 #17898] INFO -- : Claiming 20 out of 40 partitions.
I, [2015-11-10T21:38:01.781441 #17898] INFO -- : Starting 20 new partition consumers.
D, [2015-11-10T21:38:01.791024 #17898] DEBUG -- : Suspended consumer manager thread.
I, [2015-11-10T21:38:01.791084 #17898] INFO -- : Claiming partition h_c_topic/20...
I, [2015-11-10T21:38:01.791183 #17898] INFO -- : Claiming partition h_c_topic/21...
I, [2015-11-10T21:38:01.791251 #17898] INFO -- : Claiming partition h_c_topic/22...
I, [2015-11-10T21:38:01.791308 #17898] INFO -- : Claiming partition h_c_topic/23...
I, [2015-11-10T21:38:01.791361 #17898] INFO -- : Claiming partition h_c_topic/24...
I, [2015-11-10T21:38:01.791414 #17898] INFO -- : Claiming partition h_c_topic/25...
I, [2015-11-10T21:38:01.791467 #17898] INFO -- : Claiming partition h_c_topic/26...
I, [2015-11-10T21:38:01.791528 #17898] INFO -- : Claiming partition h_c_topic/27...
I, [2015-11-10T21:38:01.791589 #17898] INFO -- : Claiming partition h_c_topic/28...
I, [2015-11-10T21:38:01.791649 #17898] INFO -- : Claiming partition h_c_topic/29...
I, [2015-11-10T21:38:01.791711 #17898] INFO -- : Claiming partition h_c_topic/30...
I, [2015-11-10T21:38:01.791772 #17898] INFO -- : Claiming partition h_c_topic/31...
I, [2015-11-10T21:38:01.791832 #17898] INFO -- : Claiming partition h_c_topic/32...
I, [2015-11-10T21:38:01.791894 #17898] INFO -- : Claiming partition h_c_topic/33...
I, [2015-11-10T21:38:01.791955 #17898] INFO -- : Claiming partition h_c_topic/34...
I, [2015-11-10T21:38:01.792016 #17898] INFO -- : Claiming partition h_c_topic/35...
I, [2015-11-10T21:38:01.792076 #17898] INFO -- : Claiming partition h_c_topic/36...
I, [2015-11-10T21:38:01.792137 #17898] INFO -- : Claiming partition h_c_topic/37...
I, [2015-11-10T21:38:01.792197 #17898] INFO -- : Claiming partition h_c_topic/38...
I, [2015-11-10T21:38:01.792259 #17898] INFO -- : Claiming partition h_c_topic/39...
W, [2015-11-10T21:38:01.793483 #17898] WARN -- : Partition h_c_topic/21 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.793644 #17898] WARN -- : Partition h_c_topic/20 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.794308 #17898] WARN -- : Partition h_c_topic/22 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.795232 #17898] WARN -- : Partition h_c_topic/23 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.796199 #17898] WARN -- : Partition h_c_topic/24 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.797034 #17898] WARN -- : Partition h_c_topic/25 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.797386 #17898] WARN -- : Partition h_c_topic/27 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.797602 #17898] WARN -- : Partition h_c_topic/26 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.797671 #17898] WARN -- : Partition h_c_topic/28 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.797849 #17898] WARN -- : Partition h_c_topic/29 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.798054 #17898] WARN -- : Partition h_c_topic/30 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.798231 #17898] WARN -- : Partition h_c_topic/31 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.798475 #17898] WARN -- : Partition h_c_topic/32 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.798731 #17898] WARN -- : Partition h_c_topic/33 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.798953 #17898] WARN -- : Partition h_c_topic/34 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.799178 #17898] WARN -- : Partition h_c_topic/35 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.799581 #17898] WARN -- : Partition h_c_topic/37 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.799803 #17898] WARN -- : Partition h_c_topic/38 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.799866 #17898] WARN -- : Partition h_c_topic/36 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.799982 #17898] WARN -- : Partition h_c_topic/39 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
and it was just permanently stuck in there and not moving forward. In the meantime, group A actually lost the control of half of the partitions (partition 20 to partition 39) while group B still didn't get this half.
Consumer code i'm using for both group A and B is (nothing really fancy):
require 'kafka-consumer'
consumer = Kafka::Consumer.new('my_high_level_consumer', ['h_c_topic'], zookeeper: '10.2.13.244:2181', max_wait_ms: 2000, initial_offset: -2)
Signal.trap("INT") { consumer.interrupt }
count = 0
consumer.each do |message|
count += 1
$stdout.puts "received message: partition => #{message.partition}, offset => #{message.offset}, msg => #{message.value}"
$stdout.flush if count % 50 == 0
end
Was it supposed to be like this by design? Or was it something wrong?
Thanks,
Mingwei
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.