Skip to content

Hazelcast is a robust in-memory data grid that enables distributed data processing and caching across a cluster of nodes. It offers high availability, fault tolerance, and low-latency data access, making it an excellent choice for applications that require real-time processing. Hazelcast supports various distributed data structures such as maps, queues, sets, and lists, making it versatile for different use cases.

In this blog post, we will walk you through deploying a Hazelcast cluster using Docker Compose and setting up Hazelcast Management Center (Mancenter) to monitor and manage your cluster.

Deploying Hazelcast with Docker Compose

Deploying Hazelcast using Docker Compose simplifies the process of setting up a distributed cluster. Below is the Docker Compose configuration that you can use to deploy Hazelcast and Management Center.

Step 1: Prepare the docker-compose.yml File

Here’s the docker-compose.yml file that you should use:

version: '3.8'

services:
  hazelcast:
    image: hazelcast/hazelcast:latest
    user: root
    container_name: hazelcast-node
    restart: unless-stopped
    environment:
      - JAVA_OPTS=-Dhazelcast.local.publicAddress=<YOUR_VM_IP>:5701
    ports:
      - "5701:5701"

  mancenter:
    image: hazelcast/management-center:latest
    container_name: hazelcast-mancenter
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      - HAZELCAST_CLUSTER_NAME=my-cluster
      - MC_INIT_CLUSTER=hazelcast-node:5701
    depends_on:
      - hazelcast

networks:
  default:
    driver: bridge

Replace <YOUR_VM_IP> with the actual IP address of your VM. This IP address should be the one assigned to your network interface.

Step 2: Deploy the Hazelcast Cluster and Management Center

To deploy the Hazelcast cluster along with Management Center, follow these steps:

  1. Create the docker-compose.yml file:
  • Save the above configuration into a file named docker-compose.yml in your working directory.
  1. Run the Docker Compose command:
  • Open your terminal, navigate to the directory where the docker-compose.yml file is located, and run the following command: docker-compose up -d This command will start both the Hazelcast node and the Management Center in detached mode. The -d flag ensures that the containers run in the background.
  1. Verify that the containers are running:
  • To check if both services are up and running, use the following command: docker ps You should see both hazelcast-node and hazelcast-mancenter containers listed.

Accessing Hazelcast Management Center

Once the containers are running, you can access Hazelcast Management Center to monitor and manage your cluster.

  1. Open your web browser and navigate to http://<YOUR_VM_IP>:8080. Replace <YOUR_VM_IP> with your actual VM IP address.
  2. Login to Management Center:
  • You will be greeted by the Management Center login screen. By default, Hazelcast Management Center does not require a username or password, so you can log in directly.
  1. Monitor Your Cluster:
  • After logging in, you will see the dashboard where you can monitor the health and performance of your Hazelcast cluster. You can view metrics, logs, and perform administrative tasks such as managing data structures.

By leveraging the power of Hazelcast and the simplicity of Docker Compose, you can quickly spin up a robust in-memory data grid that meets the demands of modern, data-intensive applications.