Schedule icon
Request icon
Switch icon
SlackIncomingWebhook icon
Log icon
If icon

Hazelcast Cluster State & Partition Safety Sentinel

Audit Hazelcast in-memory cluster safety, detect partition migration stalls and state degradation, alert on Slack, and safely restore active state.

Categories
Infrastructure

Hazelcast is the leading open-source in-memory data grid (IMDG) and distributed computing platform, widely deployed across financial services, telecommunications, and real-time streaming architectures for low-latency caching and microservice state storage. In production Kubernetes or bare-metal deployments, network latency spikes, node restarts, or heavy GC pauses can trigger partition migration storms or transition the cluster into degraded modes such as PASSIVE or FROZEN. Most critically, when clusterSafe evaluates to false, partition backups are incomplete across member nodes, meaning any subsequent node failure risks permanent in-memory data loss. This blueprint continuously monitors Hazelcast cluster operational state, evaluates partition backup safety, audits migration queue depth, dispatches Slack alerts, and provides guarded self-healing remediation to restore active operational state.

How it works

  1. periodic_hazelcast_audit (io.kestra.plugin.core.trigger.Schedule) initiates automated surveillance every 15 minutes. Shipped disabled so initial manual verification can be performed first.
  2. probe_cluster_state (io.kestra.plugin.core.http.Request) invokes GET /hazelcast/health/cluster-state to verify whether the cluster is ACTIVE, PASSIVE, or FROZEN.
  3. probe_cluster_safety (io.kestra.plugin.core.http.Request) invokes GET /hazelcast/health/cluster-safe to verify that all partition replicas are in sync across members.
  4. probe_migration_queue (io.kestra.plugin.core.http.Request) invokes GET /hazelcast/health/migration-queue-size to inspect pending partition rebalances.
  5. classify_cluster_health (io.kestra.plugin.core.flow.Switch) evaluates probe responses:
    • PARTITION_DATA_SAFETY_BREACH: Fired when clusterSafe is false. Dispatches an urgent incident alert to Slack via io.kestra.plugin.slack.notifications.SlackIncomingWebhook warning SREs that partition replicas are desynchronized.
    • CLUSTER_STATE_DEGRADED: Fired when the cluster is in PASSIVE or FROZEN mode. Dispatches a Slack notification, and if auto_restore_active_state is enabled with dry_run disabled, executes restore_cluster_state (POST /hazelcast/rest/management/cluster/changeState) to return the cluster to ACTIVE.
    • MIGRATION_BACKLOG_DETECTED: Warns the platform team when pending migrations exceed threshold capacity.
    • HEALTHY: Confirms nominal cluster state, partition safety, and empty migration queues.
  6. log_audit_summary (io.kestra.plugin.core.log.Log) writes an immutable audit record documenting evaluated cluster state and safety metrics.
  7. Global errors handler captures connection drops, timeouts, or unreachable node instances, immediately routing a probe failure alert to Slack.

What you get

  • Proactive detection of partition replica desynchronization (clusterSafe=false) before secondary node failures trigger permanent data loss.
  • Automated detection of cluster freeze or passive states that silently block application writes.
  • Safe guarded self-healing: dry_run defaults to true to ensure zero unintended cluster mutations during rollout.
  • Direct Slack notifications containing cluster name, node address, and exact failure metrics for accelerated MTTR.

Who it's for

  • Site Reliability Engineers and Platform Teams managing production Hazelcast IMDG clusters on Kubernetes or cloud infrastructure.
  • Distributed Systems Engineers maintaining caching layers, session stores, and real-time computing grids.
  • Database Administrators overseeing in-memory data integrity and partition replication compliance.

Why orchestrate this with Kestra

Hazelcast provides low-level health REST endpoints but lacks built-in alerting, scheduling, or multi-step self-healing workflows. Relying on custom shell scripts or ad-hoc cron jobs introduces single points of failure, credential exposure, and zero audit lineage. Kestra delivers a declarative, version-controlled YAML blueprint with native scheduling, credential protection through secret masking, conditional branching, and complete execution observability.

Prerequisites

  • A running Hazelcast cluster member (version 5.0+) accessible over HTTP with REST endpoints enabled. Hazelcast publishes an official open-source Docker image (hazelcast/hazelcast:latest) requiring no commercial license.
  • An incoming Slack webhook URL for operational notifications.

Secrets

  • SLACK_WEBHOOK_URL: Slack incoming webhook URL for operational alert notifications.
  • HAZELCAST_CLUSTER_PASSWORD: Cluster management password required for state transition remediation requests.

Quick start

  1. Start a local Hazelcast test container with health REST endpoints enabled:
    docker run -d --name hazelcast-sentinel-test -p 5701:5701 -e HZ_NETWORK_RESTAPI_ENABLED=true -e HZ_NETWORK_RESTAPI_ENDPOINTGROUPS_HEALTHCHECK_ENABLED=true hazelcast/hazelcast:latest
    
  2. Configure SLACK_WEBHOOK_URL and HAZELCAST_CLUSTER_PASSWORD secrets in your Kestra namespace.
  3. Import this blueprint into Kestra and trigger an execution with default inputs (dry_run: true).
  4. Verify that log_healthy_cluster logs nominal cluster state and partition safety.
  5. Test state degradation detection by temporarily changing cluster state:
    curl -X POST http://localhost:5701/hazelcast/rest/management/cluster/changeState -d "dev&password&FROZEN"
    
  6. Re-run the flow to observe alert_state_degraded_slack firing.
  7. Enable periodic_hazelcast_audit to activate recurring 15-minute surveillance.

How to extend

  • Add Prometheus metric exports via io.kestra.plugin.prometheus to track partition migration queue trends and member counts over time.
  • Integrate with PagerDuty via io.kestra.plugin.pagerduty.notifications.PagerDutyAlert for high-severity partition safety violations.
  • Add multi-member health sweeps iterating through all cluster node IPs using io.kestra.plugin.core.flow.EachParallel.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.