A graphic featuring the text "meshIQ®" in a modern font. The design emphasizes clean lines and a minimalist aesthetic, suitable for branding or logo use.

Apache ActiveMQ Zero-Downtime Maintenance: The Complete Procedures Guide

meshIQ July 28, 2026

The broker is processing 8,000 messages per second. There are 340 active client connections. A configuration change is needed: a memoryUsage limit increase to prevent an approaching producer flow control event. The question is not whether to make the change. The question is how to make it without dropping messages, disconnecting clients, or triggering a cascade of client reconnect storms that themselves cause the resource pressure you are trying to resolve.

Zero-downtime maintenance for Apache ActiveMQ® is a discipline, not a configuration parameter. It requires understanding which operations require a restart and which do not, how to sequence HA failover to make restarts transparent, how to configure both the broker and Kubernetes to honor the graceful shutdown window, and how to validate that the maintenance operation achieved its goal without introducing new problems.

This guide covers the complete Apache ActiveMQ® zero-downtime maintenance procedure set: the maintenance type decision matrix, graceful shutdown for Apache ActiveMQ® and Apache Artemis™, the HA rolling restart pattern, Kubernetes drain procedures, hot-reloadable configuration, KahaDB maintenance operations, and the pre/post maintenance checklists.

Maintenance Type Decision Matrix

Not every maintenance operation requires a broker restart. Understanding which operations can be performed online saves maintenance windows and reduces operational risk.

OperationRestart Required?MethodRisk Level
Log level changeNolog4j2 monitorInterval hot-reloadLow
Apache Artemis™ address settings changeNobroker.xml hot-reload (Apache Artemis™ detects file changes)Low
Security role/policy update (Apache ActiveMQ®)Noreload=true on authorizationPluginLow
memoryUsage limit changeNo (via JMX)JMX setBrokerService attributesLow
KahaDB journal compactionNoJMX gc() on KahaDB MBeanLow
Destination purgeNoJMX purge() on destination MBeanMedium
JVM flags changeYesRestart via HA rolling procedureMedium
Transport connector changeYesRestart via HA rolling procedureMedium
Persistence adapter changeYesRestart with full backup prerequisiteHigh
OS patching / node maintenanceVariesK8s drain or HA failoverMedium
ActiveMQ® version upgradeYesUpgrade procedure (see Post #19)High

The Shutdown Spectrum: SIGTERM vs. SIGKILL vs. Graceful

Every Apache ActiveMQ® broker shutdown falls somewhere on a spectrum from clean to catastrophic:

The Correct Approach: Broker Shutdown CLI or SIGTERM

On clean shutdown:

  • KahaDB journal is flushed: no recovery replay needed on next startup
  • Network connector bridges are closed gracefully: remote brokers detect the disconnect immediately
  • Client connections receive an IOException with a meaningful disconnect message: failover transport can reconnect immediately to a backup broker
  • JVM exits normally: heap dump is not triggered

The Catastrophic Approach: SIGKILL

SIGKILL bypasses all cleanup paths. Use it only as a last resort when the broker process is unresponsive to SIGTERM and has been so for more than 60 seconds. When SIGKILL is used, always check the KahaDB directory for corruption on next startup and ensure checksumJournalFiles=true is enabled.

Apache Artemis™ Graceful Shutdown

When graceful-shutdown-enabled=true and the broker is shut down, it will first prevent any additional clients from connecting and then wait for any existing connections to be terminated by the client before completing the shutdown process.

What graceful shutdown enables: with graceful-shutdown-enabled=true, the Apache Artemis™ broker’s shutdown sequence is:

  1. Stop the acceptors: no new connections accepted
  2. Wait for existing client connections to close naturally (up to graceful-shutdown-timeout)
  3. If clients are using the failover transport, they receive a redirect signal and reconnect to the backup broker before the primary closes
  4. After all clients disconnect (or timeout is reached), complete shutdown

This means clients using the failover transport experience the broker shutdown as a transparent connection switch to the backup, not as an error. The failover transport reconnects within the graceful-shutdown-timeout window, well before the broker fully closes.

The allow-failback interaction: if allow-failback=false, the backup server will remain passive if this broker is shutdown gracefully. For a planned maintenance restart where you want the backup to activate, either set allow-failback=true or trigger failover explicitly via the management API before initiating the graceful shutdown.

The HA Rolling Restart: Zero Client Disruption

For HA deployments (Apache ActiveMQ® Master/Slave or Apache Artemis™ live-backup replication), the rolling restart achieves genuine zero client disruption. Clients using the failover transport are redirected to the backup before the primary goes down, experience a 2–5 second reconnection pause, and resume processing without any application-level errors.

Apache ActiveMQ® HA Rolling Restart Procedure

Apache Artemis™ HA Rolling Restart Procedure

Planning a Maintenance Window on a Production Apache ActiveMQ® Deployment?

Zero-downtime maintenance requires more than the right procedure: it requires verifying HA synchronization state, confirming client failover behavior in your specific topology, and having a tested rollback plan. meshIQ’s team supports enterprise organizations through production Apache ActiveMQ® maintenance operations.

Kubernetes: Zero-Downtime Broker Pod Maintenance

For Apache ActiveMQ® on Kubernetes (covered in our Apache ActiveMQ® on Kubernetes post), zero-downtime maintenance requires coordinating Kubernetes eviction controls with broker-level graceful shutdown.

PodDisruptionBudget: Protect Against Involuntary Eviction

With minAvailable: 1, kubectl drain on a node hosting the Apache ActiveMQ® pod will block until the pod is rescheduled and Ready on another node. For a single-replica broker, this means node drain requires the pod to successfully restart elsewhere before the drain completes.

terminationGracePeriodSeconds: Critical for KahaDB Flush

The most common Kubernetes maintenance error for Apache ActiveMQ®: the default terminationGracePeriodSeconds is 30 seconds. If broker shutdown (including KahaDB journal flush and journal replay protection) takes longer than 30 seconds, Kubernetes sends SIGKILL before the broker can complete clean shutdown.

Why preStop matters: Kubernetes sends SIGTERM to the container and simultaneously starts the terminationGracePeriodSeconds countdown. The preStop hook runs before SIGTERM, giving the broker time to initiate its own clean shutdown sequence (flush journal, close connections) before the countdown begins. Without preStop, SIGTERM arrives while the broker is in the middle of processing, relying entirely on the broker’s SIGTERM handler to clean up within the grace period.

StatefulSet Rolling Update

For configuration changes that require a pod restart, use Kubernetes’s native rolling update:

Hot-Reloadable Configuration: What You Can Change Without Restarting

Log Levels: Instant Hot-Reload

The most frequently used hot-reload capability. As covered in our Log Analysis & Diagnostics post, both Apache ActiveMQ® and Apache Artemis™ use Log4j2 with monitorInterval:

Apache Artemis™ Address Settings: File-Based Hot-Reload

Apache Artemis™ monitors broker.xml for changes to the address-settings section at runtime:

Note: hot-reload applies to address-settings changes. Changes to acceptors, connectors, ha-policy, or persistence elements are NOT applied dynamically. They require a broker restart.

Apache ActiveMQ® Security Reload

JMX Runtime Configuration Changes (Apache ActiveMQ®)

Several Apache ActiveMQ® broker parameters can be changed via JMX without a restart:

KahaDB Online Maintenance Operations

Journal Compaction (Online, No Restart Required)

KahaDB accumulates journal files as messages are written and acknowledged. Acknowledged messages leave “holes” in journal files. Compaction removes these holes, reclaiming disk space and improving read performance. This operation can be performed while the broker is running.

When to run compaction: when StorePercentUsage is elevated, but queue depths suggest the store should be smaller. If StorePercentUsage is 80% but total pending messages represent only 20% of configured capacity, journal files are accumulating unreclaimed space.

Index Rebuild (Requires Restart)

If the KahaDB index (db.data) is suspected to be corrupted or inconsistent, it must be rebuilt offline:

We covered the complete KahaDB corruption recovery procedure in our Backup & DR post.

Destination Purge via JMX (Online)

For queues that have accumulated messages that should be deleted (e.g., poison messages, stale test data):

Network of Brokers: Maintenance Without Disrupting the Mesh

When performing maintenance on a node in a Network of Brokers topology, the sequence matters to prevent message loss or routing disruption:

We covered NoB configuration and topology in our Network of Brokers Configuration post, and multi-DC maintenance sequencing in our Multi-Datacenter Deployment Patterns post.

Real-Time Broker State Visibility During Maintenance Operations

meshIQ Console shows queue depths, consumer counts, connection states, and HA synchronization status across all brokers in real time, giving you the visibility to confirm the broker has drained, the backup has activated, and client reconnection is complete before each step in the maintenance procedure.

Pre and Post-Maintenance Checklists

Pre-Maintenance Checklist

□ 1. BACKUP: Complete backup of broker data and configuration

     – KahaDB directory (Classic) or journal directory (Artemis)

     – activemq.xml / broker.xml, bin/env / artemis.profile

     – Verify backup integrity (restore test in staging, or md5sum check)

□ 2. HA VALIDATION (for HA rolling restart)

     – Verify backup/slave is synchronized with primary/master

     – Confirm backup broker is reachable and healthy

     – Classic: grep “Slave” /opt/activemq/data/activemq.log

     – Artemis: grep “AMQ221024” /opt/artemis/log/artemis.log

□ 3. QUEUE DRAIN STATUS

     – Document current queue depths for all critical destinations

     – Confirm consumer counts are at expected levels

     – Note any queues with unusual depth (potential slow consumers)

□ 4. CLIENT FAILOVER VERIFICATION

     – Confirm client applications use failover transport (Classic)

       or static connector list with reconnect-attempts=-1 (Artemis)

     – Verify failover was tested in staging within last 90 days

□ 5. MONITORING ACTIVE

     – Confirm Prometheus / MeshIQ Console is collecting metrics

     – Alert thresholds are active (not silenced)

     – Log monitoring is active for ERROR and WARN patterns

□ 6. ROLLBACK PLAN DOCUMENTED

     – Identify the rollback trigger condition

     – Document the exact rollback steps

     – Identify who has authority to call rollback

     – Estimate rollback time (should be < 10 minutes)

□ 7. NOTIFICATION SENT

     – Application teams notified of maintenance window

     – On-call engineer confirmed available during maintenance

Post-Maintenance Validation

Maintenance Is a First-Class Operation

Zero-downtime maintenance is not achieved by being lucky or moving fast. It is achieved by having the right procedures, validated in staging, with the right tooling (HA for transparent failover, graceful shutdown for orderly connection drain, Kubernetes PDB for pod protection), and the right checklists (pre-maintenance backup, post-maintenance validation).

Every procedure in this guide has an inverse: the rollback. Knowing the rollback before starting the maintenance operation is the difference between a 10-minute recovery and a multi-hour incident.

Get your Apache ActiveMQ® maintenance procedures reviewed by our team → Request Maintenance Support

Frequently Asked Questions

Q: How do I restart Apache ActiveMQ® without losing messages?

For persistent messages: use the proper stop command (not SIGKILL). Persistent messages survive a clean restart via journal recovery. For zero client disruption: use HA rolling restart. For Kubernetes: configure terminationGracePeriodSeconds > broker shutdown time and use a preStop lifecycle hook.

Q: Can I reload Apache ActiveMQ® configuration without restarting?

Yes for: log4j2 levels (both Apache ActiveMQ® and Apache Artemis™ via monitorInterval), Apache Artemis™ address settings (broker.xml file change), Apache ActiveMQ® security plugins (reload=true), JMX-accessible attributes (memoryUsage). No for: transport acceptors, persistence adapter, JVM flags, HA policy. These require restart.

Q: How do I drain an Apache ActiveMQ® broker before maintenance?

Stop or redirect producers, monitor queue depths via JMX until all reach zero, verify no active consumers remain, then shut down. For NoB, disconnect the bridge connector first to prevent new messages from remote brokers during the drain window.

Q: What is graceful shutdown in Apache Artemis™?

graceful-shutdown-enabled=true in broker.xml causes Apache Artemis™ to stop accepting new connections and wait for existing clients to close naturally (up to graceful-shutdown-timeout) before completing shutdown. This gives failover transport clients time to reconnect to the backup broker before the primary fully closes.

Q: How do I perform maintenance on a Kubernetes ActiveMQ® deployment?

Use PodDisruptionBudget with minAvailable:1 to prevent eviction during node drains. Set terminationGracePeriodSeconds ≥ 120 seconds. Add a preStop lifecycle hook calling the broker stop CLI. For HA StatefulSets, use rolling update with partition to update the backup pod first, then the primary.

Cookies preferences

Others

Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.

Necessary

Necessary
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.

Advertisement

Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.

Analytics

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.

Functional

Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.

Performance

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.