Linux下安装librdkafka 步骤
Linux下安装librdkafka 步骤
- librdkafka压缩包下载
https://github.com/edenhill/librdkafka - 拷贝到指定目录,解压
unzip librdkafka-master.zip - 对.py文件赋权
chmod 777 configure lds-gen.py ./configure make
make install
在make的时候,如果是64位Linux会报下面这个异常
/bin/ld:librdkafka.lds:1: syntax error in VERSION script
只要Makefile.config里面的WITH_LDS=y这一行注释掉就不会报错了
测试部分:
- 首先要保证测试主机的kafka是正常启动的;
- cd example目录下
rdkafka_example -C|-P|-L -t <topic> [-p <partition>] [-b <host1:port1,host2:port2,..>] librdkafka version 0.9.5-pre0 (0x00090500) Options: -C | -P Consumer or Producer mode -L Metadata list mode -t <topic> Topic to fetch / produce -p <num> Partition (random partitioner) -b <brokers> Broker address (localhost:9092) -z <codec> Enable compression: none|gzip|snappy -o <offset> Start offset (consumer): beginning, end, NNNNN or -NNNNN wmark returns the current hi&lo watermarks. -o report Report message offsets (producer) -e Exit consumer when last message in partition has been received. -d [facs..] Enable debugging contexts: all,generic,broker,topic,metadata,queue,msg,protocol,cgrp,security,fetch,feature -q Be quiet -A Raw payload output (consumer) -X <prop=name> Set arbitrary librdkafka configuration property Properties prefixed with "topic." will be set on topic object. -X list Show full list of supported properties. -X <prop> Get single property value
测试通过
相关推荐
sweetgirl0 2020-04-14