Git Product home page Git Product logo

hivemq-haproxy's Introduction

Welcome

Welcome to this technology demonstrator where we setup a 3 node HiveMQ cluster along with a HA proxy that acts as a load balancer and single IP entrypoint to this cluster.

Alt text

Start by cloning this repo to your docker and docker compose enabled platform and CD into it. Then set the HiveMQ version that you want to deploy and build the local HiveMQ image. This image will include the HiveMQ config.xlm file that enables the cluster:

<cluster>
    <enabled>true</enabled>
    <transport>
        <tcp>
            <!-- replace this IP with the IP address of your interface -->
        </tcp>
    </transport>
    <discovery>
        <broadcast>
            <!-- replace this IP with the broacast IP address of your subnet -->
        </broadcast>
    </discovery>
</cluster>

Please refer to the following commands:

git clone https://github.com/hivemq/hivemq-HAproxy.git
cd hivemq-HAproxy
export HIVEMQ_VERSION=4.9.0
sudo chmod +x build.sh
./build.sh
docker-compose up

checking your cluster

If you run a docker ps the output will show 3 HiveMQ nodes running along with one HAproxy instance:

Alt text

Checkout: http://0.0.0.0:8404/stats Are all nodes detected by the loadbalancer ?

Alt text

Checkout: http://0.0.0.0:8080 Are all nodes running and formed a cluster as shown in the HiveMQ Control center (default password: admin/hivemq) ?

Alt text

HiveMQ CLI tools https://www.hivemq.com/blog/mqtt-cli/

Test with : Mqtt sub -h 0.0.0.0 -t "testtopic" in a seperate CLI window and Mqtt pub -h 0.0.0.0 -m "test" -t "testtopic"

Malfunction simulation

Alt text

You can simulate malfunction of one of the nodes by simply killing it: docker kill a21ec7267a6d

Now the node has been gone wich is shows in HiveMQ CC and in the HAproxy stats screen:

Alt text

Alt text

You can restore the original 3 node configuration simply by re-running docker-compose up.

Please clean, up afterwards with docker-compose down.

More info ?

For contact information please reach out to [email protected]

ToDo

extend this demo to include a roling version upgrade.

hivemq-haproxy's People

Contributors

kamielstraatman 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.