分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
测试librdkafka
Table of Contents
1 版本匹配问题
经过尝试,librdkafka 0.9 不向前兼容kafka 0.8.1, 因此,当使用kafka0.8.1 server的时候,需要使用对应的librdkafka版本。
2 重新编译0.8版本
首先切换到librdkafka代码的0.8 branch 然后重新编译代码
make clean./configuremake
3 进入tests目录
运行下面的命令进行测试,可以看到测试全部通过。
[dean@dell_xps_13 tests]$ makegcc -I../src -I../src-cpp -c test.cgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0003-msgmaxsize.c -o 0003-msgmaxsize.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0012-produce_consume.c -o 0012-produce_consume.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0001-multiobj.c -o 0001-multiobj.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0007-autotopic.c -o 0007-autotopic.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0010-enforcereqacks.c -o 0010-enforcereqacks.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0008-reqacks.c -o 0008-reqacks.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0006-symbols.c -o 0006-symbols.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0005-order.c -o 0005-order.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0014-reconsume-191.c -o 0014-reconsume-191.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0004-conf.c -o 0004-conf.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0011-produce_batch.c -o 0011-produce_batch.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtgcc -I../src -I../src-cpp ../src/librdkafka.a test.o 0002-unkpart.c -o 0002-unkpart.test -L../src -L../src-cpp -lrdkafka -lpthread -lz -lrtg++ -I../src -I../src-cpp ../src/librdkafka.a test.o 0013-metadata.cpp -o 0013-metadata.test -L../src -L../src-cpp -lrdkafka++ -lrdkafka -lpthread -lz -lrt0013-metadata.cpp:38:0: warning: "_GNU_SOURCE" redefined #define _GNU_SOURCE ^<command-line>:0:0: note: this is the location of the previous definitionfor i in 0003-msgmaxsize.test 0012-produce_consume.test 0001-multiobj.test 0007-autotopic.test 0010-enforcereqacks.test 0008-reqacks.test 0006-symbols.test 0005-order.test 0014-reconsume-191.test 0004-conf.test 0011-produce_batch.test 0002-unkpart.test 0013-metadata.test ; do \ LD_LIBRARY_PATH=../src:../src-cpp ./run-test.sh $i || exit 1 ; \done############## 0003-msgmaxsize.test ################### Running test 0003-msgmaxsize.test in bare mode ###Created kafka instance rdkafka#producer-0Using topic "rdkafkatest_generic"Delivery report for message #0: SuccessDelivery report for message #2: SuccessDelivery report for message #4: SuccessDelivery report for message #6: SuccessDelivery report for message #8: SuccessDestroying kafka instance rdkafka#producer-03 thread(s) in use by librdkafka, waiting...1 thread(s) in use by librdkafka, waiting...0 thread(s) in use by librdkafka###### 0003-msgmaxsize.test in bare mode PASSED! #################### 0012-produce_consume.test ################### Running test 0012-produce_consume.test in bare mode ###Using topic "rdkafkatest_0012"Topic rdkafkatest_0012, testid 4029298770115172415Created kafka instance rdkafka#producer-0Start produce to partition 0Produced 5000 messages to partition 0, waiting for deliveriesStart produce to partition 1Produced 5000 messages to partition 1, waiting for deliveriesDestroying kafka instance rdkafka#producer-0Created kafka instance rdkafka#consumer-1Consuming 5000 messages from partition 0Destroying kafka instance rdkafka#consumer-1Created kafka instance rdkafka#consumer-2Consuming 5000 messages from partition 1Destroying kafka instance rdkafka#consumer-2Created kafka instance rdkafka#consumer-3Consuming 10000 messages from one queue serving 2 partitionsStart consuming partition 0 at offset -5000Start consuming partition 1 at offset -5000Destroying kafka instance rdkafka#consumer-38 thread(s) in use by librdkafka, waiting...0 thread(s) in use by librdkafka###### 0012-produce_consume.test in bare mode PASSED! #################### 0001-multiobj.test ################### Running test 0001-multiobj.test in bare mode ###Creating and destroying 100 kafka instancesUsing topic "rdkafkatest_generic"39 thread(s) in use by librdkafka, waiting...0 thread(s) in use by librdkafka###### 0001-multiobj.test in bare mode PASSED! #################### 0007-autotopic.test ################### Running test 0007-autotopic.test in bare mode ###NOTE! This test requires auto.create.topics.enable=true to be configured on the broker!Created kafka instance rdkafka#producer-0Using topic "rdkafkatest_25fe0dc34f572ffc_autotopic"Delivery report for message #0: SuccessDelivery report for message #1: SuccessDelivery report for message #2: SuccessDelivery report for message #3: SuccessDelivery report for message #4: SuccessDelivery report for message #5: SuccessDelivery report for message #6: SuccessDelivery report for message #7: SuccessDelivery report for message #8: SuccessDelivery report for message #9: SuccessDestroying kafka instance rdkafka#producer-03 thread(s) in use by librdkafka, waiting...1 thread(s) in use by librdkafka, waiting...0 thread(s) in use by librdkafka###### 0007-autotopic.test in bare mode PASSED! #################### 0010-enforcereqacks.test ################### Running test 0010-enforcereqacks.test in b