Coder Social home page Coder Social logo

nats-cluster-example's Introduction

Nats Cluster Example

This repository serves as an example for setting up a NATS cluster using Docker Compose. NATS is a simple, secure, and high-performance open-source messaging system for cloud-native applications, IoT messaging, and microservices architectures. This example provides a straightforward way to get started with NATS clustering.

Getting Started

Follow these instructions to get the NATS cluster up and running on your local machine.

Prerequisites

  • Docker
  • Docker Compose

Installation

  1. Clone this repository to your local machine:
Copy code
git clone https://github.com/HiWay-Media/nats-cluster-example.git
  1. Navigate to the cloned directory:
cd nats-cluster-example

Usage

  1. Start the NATS cluster using Docker Compose:
docker-compose up -d
  1. Verify that the cluster is running:
docker-compose ps

This command should display three containers running, each representing a member of the NATS cluster.

Testing ACL

#should not be able to sub
nats subscribe "test.*" --server localhost:4222 --user=b --password=b
# write message in topic
nats publish "test.broadcast" "ciao" --server localhost:4222 --user=b --password=b
#

Testing

You can test the functionality of the NATS cluster by publishing and subscribing to messages.

  1. Publish a message:
docker-compose exec nats1 nats-pub -s nats://nats1:4222 subject "Hello NATS!"
  1. Subscribe to the message:
Copy code
docker-compose exec nats2 nats-sub -s nats://nats2:4222 subject

You should see the message "Hello NATS!" being received in the subscriber's console.

Configuration

The NATS cluster configuration is defined in the docker-compose.yml file. You can modify this file to adjust settings such as the number of nodes, ports, and clustering parameters.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or create a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • NATS - For providing a lightweight and efficient messaging system.
  • Docker - For simplifying the deployment of the NATS cluster using containers.

Contact

For any inquiries or assistance, please contact HiWay Media.

Thank you for using the NATS cluster example! ๐Ÿš€

nats-cluster-example's People

Contributors

allan-nava avatar

Watchers

raffaele avatar  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.