Skip to content

SolaceLabs/solace-ha-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Configure High-availability Groups Using Docker Compose

This project provides instructions and tools to use Docker Compose to configure a High-availability (HA) redundancy group of Solace PubSub+ software message broker Docker containers on a desktop.

Contents

Before you begin

In the sample configuration below, we will use the Docker Compose template that is provided in this project, to set up an HA group. This sample configuration, which uses Solace PubSub+ Standard, is suitable for demonstrating and testing PubSub+ fundamentals, such as HA failover and guaranteed messaging, in non-production situations. The intent of the configuration is to help you become familiar with the ins-and-outs of HA set up as a step towards using more advanced, production-oriented configurations.

Assumptions

  • If you are using macOS:
    • Mac OS X Yosemite 10.10.3 or higher.
  • If you are using Windows:
    • Windows Pro 10.
    • Windows PowerShell.
  • Docker installed, with at least 6 GiB of memory (4 GiB must be RAM) and 2 virtual cores dedicated to Docker. For this example, 4 GiB of RAM, 2 GiB of swap space, and 2 virtual cores have been dedicated to Docker. To learn about allocating memory and swap space, refer to the Docker Settings page for Docker for Mac or Docker for Windows.
  • A host machine with 8 GB RAM and 4 CPU cores with hyper-threading enabled (8 virtual cores) is recommended.
  • All software message broker Docker container images in the HA group must be the same: Solace PubSub+ 8.11 or higher.

Docker Compose

The Docker Compose template allows you to get an HA group up-and-running using a single command. Once the command is executed, the template automatically creates all the necessary containers and configures the HA group. It also creates a HAProxy load balancer, HAProxy. The load balancer monitors the health of the primary and standby message brokers, and based on the results of the health check, directs traffic to the active message broker. The diagram below illustrates the HA group setup fronted by a load balancer.

The template contains the following two files:

  • PubSub_Standard_HA.yml — The docker-compose script that creates the containers for the primary, backup, and monitoring nodes as well as a container for the load balancer. The script also contains configuration keys for setting up redundancy, which automatically get the HA group up-and-running.
  • assertMaster.perl — A Perl script that creates the HAProxy load balancer configuration file, which is mapped to the load balancer container. Once the containers are created, the load balancer automatically executes the Assert master admin operation, which ensures that the configuration of the primary and backup message brokers are synchronized. For more information, refer to Solace PubSub+ documentation - Asserting Message Broker System Configurations. Note: If using a version older than 9.2, the docker-compose script PubSub_Standard_HA_Pre_9_2.YML should be used instead of PubSub_Standard_HA.YML. This docker-compose script uses redundancy group password instead of a pre-shared authentication key. Pre-shared authentication keys are highly recommended when using versions 9.2 and above.

Step 1: Download Docker Compose Template

Clone the repository and cd into the template folder.

> git clone https://github.com/SolaceLabs/solace-ha-docker-compose.git
> cd solace-ha-docker-compose/template

You can also download the Zip file through the Clone or download tab.

Step 2: Run Docker Compose

Before running the docker-compose command, it's recommended that you execute docker volume prune to remove unused local volumes. This is recommended if you are setting up an HA group in a resource-limited environment such as a laptop with limited disk space.

Run the following command to get the HA group up-and-running.

> docker-compose -f PubSub_Standard_HA.yml up

Once the primary, backup, monitoring, and lb (load balancer) containers are created, it will take about 60 seconds for the message brokers to come up and the Assert master admin operation to complete. You will notice the following behaviour on the terminal:

...
primary     |
lb          |  checking if message broker 127.0.0.1:8080 is ready, attempt # 5
lb          |  checking if message broker 127.0.0.1:8080 is ready, attempt # 6
lb          |  checking if message broker 127.0.0.1:8080 is ready, attempt # 7
lb          |  checking if message broker 127.0.0.1:8080 is ready, attempt # 8
lb          |  checking if message broker 127.0.0.1:8080 is ready, attempt # 9
lb          |  checking if message broker 127.0.0.1:8080 is ready, attempt # 10
lb          |  Assert master admin operation completed, attempt # 10

The HA group will be up-and-running once the Assert master admin operation is completed. You can check the status of the containers by executing the docker ps command. The status of all the four containers, primary, backup, monitoring, and lb, must be Up.

Step 3: Manage the Container

You can access the Solace management tool, PubSub+ Manager, or the Solace CLI to start issuing configuration or monitoring commands on the message broker.

PubSub+ Manager management access:

  1. Open a browser and enter this url: http://127.0.0.1:8080
  2. Log in as user admin with password admin.

Solace CLI management access:

  1. Enter the following docker exec command to access the Solace CLI on the primary message broker:
> docker exec -it primary /usr/sw/loads/currentload/bin/cli -A
  1. Enter the following commands to enter configuration mode:
primary> enable
primary# config
primary(configure)#
  1. Issue configuration or monitoring commands. For a list of commands currently supported on the message broker, refer to Solace PubSub+ documentation - Solace CLI.

Next Steps

At this point you have an HA redundancy group running on your platform and Guaranteed Messaging is enabled. You can now do things like use the SDKPerf tool to test messaging, perform administrative task using WebUI, or test the HA group’s failover operation.

About

Configure High-availability Groups Using Docker Compose

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages