README.md 6.5 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

27
# Overview #
M
Magnus Edenhill 已提交
28 29 30
  * 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
  * [SSL](https://github.com/edenhill/librdkafka/wiki/Using-SSL-with-librdkafka) support
M
Magnus Edenhill 已提交
33
  * [SASL](https://github.com/edenhill/librdkafka/wiki/Using-SASL-with-librdkafka) (GSSAPI/Kerberos/SSPI, PLAIN, SCRAM) support
M
Magnus Edenhill 已提交
34
  * 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
# Language bindings #
43

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)
A
Alexey Raga 已提交
48
  * Haskell (kafka, conduit, avro, schema registry): [hw-kafka](https://github.com/haskell-works/hw-kafka)
49 50
  * Haskell: [haskakafka](https://github.com/cosbynator/haskakafka)
  * Haskell: [haskell-kafka](https://github.com/yanatan16/haskell-kafka)
51
  * Lua: [luardkafka](https://github.com/mistsv/luardkafka)
52
  * Node.js: [node-rdkafka](https://github.com/Blizzard/node-rdkafka)
53
  * Node.js: [node-kafka](https://github.com/sutoiku/node-kafka)
54
  * Node.js: [kafka-native](https://github.com/jut-io/node-kafka-native)
55
  * OCaml: [ocaml-kafka](https://github.com/didier-wenzek/ocaml-kafka)
56
  * PHP: [phpkafka](https://github.com/EVODelavega/phpkafka)
57
  * PHP: [php-rdkafka](https://github.com/arnaud-lb/php-rdkafka)
M
Magnus Edenhill 已提交
58
  * Python: [confluent-kafka-python](https://github.com/confluentinc/confluent-kafka-python)
59
  * Python: [PyKafka](https://github.com/Parsely/pykafka)
M
Magnus Edenhill 已提交
60
  * Ruby: [Hermann](https://github.com/reiseburo/hermann)
F
Federico Giraud 已提交
61
  * Rust: [rust-rdkafka](https://github.com/fede1024/rust-rdkafka)
62
  * Tcl: [KafkaTcl](https://github.com/flightaware/kafkatcl)
R
Rockford Wei 已提交
63
  * Swift: [Perfect-Kafka](https://github.com/PerfectlySoft/Perfect-Kafka)
64

65
# Users of librdkafka #
66

M
Magnus Edenhill 已提交
67
  * [kafkacat](https://github.com/edenhill/kafkacat) - Apache Kafka swiss army knife
68 69 70
  * [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)
71 72
  * [syslog-ng](http://syslog-ng.org)
  * [collectd](http://collectd.org)
M
Magnus Edenhill 已提交
73
  * [logkafka](https://github.com/Qihoo360/logkafka) - Collect logs and send to Kafka
74 75
  * [redBorder](http://www.redborder.net)
  * [Headweb](http://www.headweb.com/)
M
Magnus Edenhill 已提交
76
  * [Produban's log2kafka](https://github.com/Produban/log2kafka) - Web log producer
77
  * [fuse_kafka](https://github.com/yazgoo/fuse_kafka) - FUSE file system layer
78
  * [node-kafkacat](https://github.com/Rafflecopter/node-kafkacat)
M
Magnus Edenhill 已提交
79
  * [OVH](http://ovh.com) - [AntiDDOS](http://www.slideshare.net/hugfrance/hugfr-6-oct2014ovhantiddos)
80
  * [otto.de](http://otto.de)'s [trackdrd](https://github.com/otto-de/trackrdrd) - Varnish log reader
81
  * [Microwish](https://github.com/microwish) has a range of Kafka utilites for log aggregation, HDFS integration, etc.
N
nmred 已提交
82
  * [aidp](https://github.com/weiboad/aidp) - kafka consumer embedded Lua scripting language in data process framework 
83
  * large unnamed financial institution
M
Magnus Edenhill 已提交
84
  * *Let [me](mailto:rdkafka@edenhill.se) know if you are using librdkafka*
85

M
Magnus Edenhill 已提交
86

87 88 89 90 91

# Usage

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

## Instructions

### Building

M
Magnus Edenhill 已提交
103 104
      ./configure
      make
M
Magnus Edenhill 已提交
105
      sudo make install
106 107


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

111 112
### Usage in code

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

M
Magnus Edenhill 已提交
115
Link your program with `-lrdkafka -lz -lpthread -lrt`.
116 117


M
Magnus Edenhill 已提交
118
## Documentation
119

M
Magnus Edenhill 已提交
120 121 122 123 124 125 126
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
127

128

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

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


M
Magnus Edenhill 已提交
136
## Examples
M
Magnus Edenhill 已提交
137

M
Magnus Edenhill 已提交
138
See the `examples/`sub-directory.
M
Magnus Edenhill 已提交
139

140

M
Magnus Edenhill 已提交
141
## Tests
142

M
Magnus Edenhill 已提交
143
See the `tests/`sub-directory.
144 145


M
Magnus Edenhill 已提交
146
## Support
147

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


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

M
Magnus Edenhill 已提交
155

156
### Commercial support
M
Magnus Edenhill 已提交
157

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