GithubHelp home page GithubHelp logo

nginx-kafka-ssl's Introduction

Nginx Kafka Module

Build Status

Nginx kafka module is used to receive http post data and deliver messages to kafka

If there are any problems when using this module, feel free to send a mail to me :)

Table of Contents

Installation

Dependency Installation

Install librdkafka

git clone https://github.com/edenhill/librdkafka
cd librdkafka
./configure
make
sudo make install

Compilation

Compile this module into nginx

git clone https://github.com/brg-liuwei/ngx_kafka_module

# cd /path/to/nginx
./configure --add-module=/path/to/ngx_kafka_module

make

sudo make install
# or, use `sudo make upgrade` instead of `sudo make install`

In newer version of nginx(>=1.9.11), you can make this module as an dynamic module.

git clone https://github.com/brg-liuwei/ngx_kafka_module

# cd /path/to/nginx
./configure --add-dynamic-module=/path/to/ngx_kafka_module

make modules
# This will generate a objs/ngx_http_kafka_module.so in your /path/to/ngx_kafka_module and you can copy the so file to a proper location.

Back to TOC

Nginx Configuration

Add the code to nginx conf file as follows

http {

    # some other configs

    kafka;

    kafka_broker_list 127.0.0.1:9092 127.0.0.1:9093; # host:port ...

    server {

        # some other configs

        location = /your/path/topic {
            # optional directive: kafka_partition [<partition-num> | auto]
            #
            # kafka_partition auto; # default value
            # kafka_partition 0;
            # kafka_partition 1;

            kafka_topic your_topic;
        }
    }
}

If you compile module as a dynamic module, you must add

load_module /path/to/ngx_http_kafka_module.so;

at the beginning of the nginx config file besides adding the code. After that you can use the module by just executing nginx -c /path/to/nginx.conf -s reload.

Back to TOC

Example of Usage

curl localhost/your/path/topic -d "message send to kafka topic"

or you can use -v or --verbose to see http request and response for detail:

curl localhost/your/path/topic -d "hello ngx_kafka_module" -v

If the message is successfully delivered, the http status code must be 204(NO CONTENT). If using -v or --verbose option of curl, the following line will be seen:

< HTTP/1.1 204 No Content

Back to TOC

Report Bugs

You are very welcome to report issues on GitHub:

https://github.com/brg-liuwei/ngx_kafka_module/issues

Back to TOC

Copyright & License

This module is licensed under the BSD license.

Copyright (C) 2014-2016, by Liu Wei(brg-liuwei) [email protected].

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Back to TOC

TODO

issue #13: passing nginx common variables into kafka

Back to TOC

nginx-kafka-ssl's People

Contributors

brg-liuwei avatar davidalber avatar takaomag avatar yourpleasure avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.