README.md 6.2 KB
Newer Older
M
Magnus Edenhill 已提交
1 2
librdkafka - the Apache Kafka C/C++ client library
==================================================
3

M
Magnus Edenhill 已提交
4
Copyright (c) 2012-2016, [Magnus Edenhill](http://www.edenhill.se/).
5 6 7

[https://github.com/edenhill/librdkafka](https://github.com/edenhill/librdkafka)

A
Andreas Smas 已提交
8 9
[![Gitter chat](https://badges.gitter.im/edenhill/librdkafka.png)](https://gitter.im/edenhill/librdkafka) [![Build status](https://doozer.io/badge/edenhill/librdkafka/buildstatus/master)](https://doozer.io/user/edenhill/librdkafka)

M
Magnus Edenhill 已提交
10

M
Magnus Edenhill 已提交
11
**librdkafka** is a C library implementation of the
12
[Apache Kafka](http://kafka.apache.org/) protocol, containing both
M
Magnus Edenhill 已提交
13
Producer and Consumer support. It was designed with message delivery reliability
M
Magnus Edenhill 已提交
14
and high performance in mind, current figures exceed 1 million msgs/second for
M
Magnus Edenhill 已提交
15
the producer and 3 million msgs/second for the consumer.
16

17
**librdkafka** is licensed under the 2-clause BSD license.
M
Magnus Edenhill 已提交
18

M
Magnus Edenhill 已提交
19 20 21
For an introduction to the performance and usage of librdkafka, see
[INTRODUCTION.md](https://github.com/edenhill/librdkafka/blob/master/INTRODUCTION.md)

M
Magnus Edenhill 已提交
22 23
See the [wiki](https://github.com/edenhill/librdkafka/wiki) for a FAQ.

M
Magnus Edenhill 已提交
24
**NOTE**: The `master` branch is actively developed, use latest release for production use.
M
Magnus Edenhill 已提交
25

M
Magnus Edenhill 已提交
26

M
Magnus Edenhill 已提交
27 28 29 30
#Overview#
  * High-level producer
  * High-level balanced KafkaConsumer (requires broker >= 0.9)
  * Simple (legacy) consumer
M
Magnus Edenhill 已提交
31
  * Compression: snappy, gzip, lz4
M
Magnus Edenhill 已提交
32 33 34
  * [SSL](https://github.com/edenhill/librdkafka/wiki/Using-SSL-with-librdkafka) support
  * [SASL](https://github.com/edenhill/librdkafka/wiki/Using-SASL-with-librdkafka) (GSSAPI/Kerberos, PLAIN) support
  * Broker version support: >=0.8 (see [Broker version compatibility](https://github.com/edenhill/librdkafka/wiki/Broker-version-compatibility))
35
  * Stable C & C++ APIs (ABI safety guaranteed for C)
M
Magnus Edenhill 已提交
36
  * [Statistics](https://github.com/edenhill/librdkafka/wiki/Statistics) metrics
M
Magnus Edenhill 已提交
37
  * Debian package: librdkafka1 and librdkafka-dev in Debian and Ubuntu
M
Magnus Edenhill 已提交
38 39
  * RPM package: librdkafka and librdkafka-devel
  * Portable: runs on Linux, OSX, Win32, Solaris, FreeBSD, ...
40 41


42 43
#Language bindings#

44
  * C#/.NET: [confluent-kafka-dotnet](https://github.com/confluentinc/confluent-kafka-dotnet) (based on [rdkafka-dotnet](https://github.com/ah-/rdkafka-dotnet))
45 46 47
  * D (C-like): [librdkafka](https://github.com/DlangApache/librdkafka/)
  * D (C++-like): [librdkafkad](https://github.com/tamediadigital/librdkafka-d)
  * Go: [confluent-kafka-go](https://github.com/confluentinc/confluent-kafka-go)
48 49
  * Haskell: [haskakafka](https://github.com/cosbynator/haskakafka)
  * Haskell: [haskell-kafka](https://github.com/yanatan16/haskell-kafka)
50
  * Lua: [luardkafka](https://github.com/mistsv/luardkafka)
51
  * Node.js: [node-rdkafka](https://github.com/Blizzard/node-rdkafka)
52
  * Node.js: [node-kafka](https://github.com/sutoiku/node-kafka)
53
  * Node.js: [kafka-native](https://github.com/jut-io/node-kafka-native)
54
  * OCaml: [ocaml-kafka](https://github.com/didier-wenzek/ocaml-kafka)
55
  * PHP: [phpkafka](https://github.com/EVODelavega/phpkafka)
56
  * PHP: [php-rdkafka](https://github.com/arnaud-lb/php-rdkafka)
M
Magnus Edenhill 已提交
57
  * Python: [confluent-kafka-python](https://github.com/confluentinc/confluent-kafka-python)
58
  * Python: [PyKafka](https://github.com/Parsely/pykafka)
M
Magnus Edenhill 已提交
59
  * Ruby: [Hermann](https://github.com/reiseburo/hermann)
F
Federico Giraud 已提交
60
  * Rust: [rust-rdkafka](https://github.com/fede1024/rust-rdkafka)
61
  * Tcl: [KafkaTcl](https://github.com/flightaware/kafkatcl)
62

M
Magnus Edenhill 已提交
63
#Users of librdkafka#
64

M
Magnus Edenhill 已提交
65
  * [kafkacat](https://github.com/edenhill/kafkacat) - Apache Kafka swiss army knife
66 67 68
  * [Wikimedia's varnishkafka](https://github.com/wikimedia/varnishkafka) - Varnish cache web log producer
  * [Wikimedia's kafkatee](https://github.com/wikimedia/analytics-kafkatee) - Kafka multi consumer with filtering and fanout
  * [rsyslog](http://www.rsyslog.com)
69 70
  * [syslog-ng](http://syslog-ng.org)
  * [collectd](http://collectd.org)
M
Magnus Edenhill 已提交
71
  * [logkafka](https://github.com/Qihoo360/logkafka) - Collect logs and send to Kafka
72 73
  * [redBorder](http://www.redborder.net)
  * [Headweb](http://www.headweb.com/)
M
Magnus Edenhill 已提交
74
  * [Produban's log2kafka](https://github.com/Produban/log2kafka) - Web log producer
75
  * [fuse_kafka](https://github.com/yazgoo/fuse_kafka) - FUSE file system layer
76
  * [node-kafkacat](https://github.com/Rafflecopter/node-kafkacat)
M
Magnus Edenhill 已提交
77
  * [OVH](http://ovh.com) - [AntiDDOS](http://www.slideshare.net/hugfrance/hugfr-6-oct2014ovhantiddos)
78
  * [otto.de](http://otto.de)'s [trackdrd](https://github.com/otto-de/trackrdrd) - Varnish log reader
79
  * [Microwish](https://github.com/microwish) has a range of Kafka utilites for log aggregation, HDFS integration, etc.
80
  * large unnamed financial institution
M
Magnus Edenhill 已提交
81
  * *Let [me](mailto:rdkafka@edenhill.se) know if you are using librdkafka*
82

M
Magnus Edenhill 已提交
83

84 85 86 87 88

# Usage

## Requirements
	The GNU toolchain
89
	GNU make
90
   	pthreads
M
Magnus Edenhill 已提交
91 92
	zlib (optional, for gzip compression support)
	libssl-dev (optional, for SSL support)
M
Magnus Edenhill 已提交
93
	libsasl2-dev (optional, for SASL support)
M
Magnus Edenhill 已提交
94
	liblz4-dev (optional, for LZ4 compression support)
95 96 97 98 99

## Instructions

### Building

M
Magnus Edenhill 已提交
100 101
      ./configure
      make
M
Magnus Edenhill 已提交
102
      sudo make install
103 104


M
Magnus Edenhill 已提交
105 106 107
**NOTE**: See [README.win32](README.win32) for instructions how to build
          on Windows with Microsoft Visual Studio.

108 109
### Usage in code

M
Magnus Edenhill 已提交
110
See [examples/rdkafka_example.c](https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_example.c) for an example producer and consumer.
111

M
Magnus Edenhill 已提交
112
Link your program with `-lrdkafka -lz -lpthread -lrt`.
113 114


M
Magnus Edenhill 已提交
115
## Documentation
116

M
Magnus Edenhill 已提交
117 118 119 120 121 122 123
The public APIs are documented in their respective header files:
 * The **C** API is documented in [src/rdkafka.h](src/rdkafka.h)
 * The **C++** API is documented in [src-cpp/rdkafkacpp.h](src-cpp/rdkafkacpp.h)

To generate Doxygen documents for the API, type:

    make docs
124

125

M
Magnus Edenhill 已提交
126 127
Configuration properties are documented in
[CONFIGURATION.md](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md)
M
Magnus Edenhill 已提交
128

M
Magnus Edenhill 已提交
129 130
For a librdkafka introduction, see
[INTRODUCTION.md](https://github.com/edenhill/librdkafka/blob/master/INTRODUCTION.md)
M
Magnus Edenhill 已提交
131 132


M
Magnus Edenhill 已提交
133
## Examples
M
Magnus Edenhill 已提交
134

M
Magnus Edenhill 已提交
135
See the `examples/`sub-directory.
M
Magnus Edenhill 已提交
136

137

M
Magnus Edenhill 已提交
138
## Tests
139

M
Magnus Edenhill 已提交
140
See the `tests/`sub-directory.
141 142


M
Magnus Edenhill 已提交
143
## Support
144

M
Magnus Edenhill 已提交
145 146
File bug reports, feature requests and questions using
[GitHub Issues](https://github.com/edenhill/librdkafka/issues)
147 148


149
Questions and discussions are also welcome on irc.freenode.org, #apache-kafka,
M
Magnus Edenhill 已提交
150
nickname Snaps.
151

M
Magnus Edenhill 已提交
152

153
### Commercial support
M
Magnus Edenhill 已提交
154

M
Magnus Edenhill 已提交
155
Commercial support is available from [Edenhill services](http://www.edenhill.se)