首頁 > 軟體

Linux下安裝librdkafka 步驟

2020-06-16 17:17:50

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這一行註釋掉就不會報錯了

測試部分:

  1. 首先要保證測試主機的kafka是正常啟動的;
  2. 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

測試通過

 

本文永久更新連結地址http://www.linuxidc.com/Linux/2017-04/142573.htm


IT145.com E-mail:sddin#qq.com