Kafka Adaptive Balancer Setup
The AxonOps Kafka Adaptive Balancer runs as a separate service, axon-kafka-adaptive-balancer, that reads from and writes to axon-server and is reached through axon-dash. On AxonOps Cloud, AxonOps runs and connects the service. On a self-hosted installation, the operator installs the package, gives the balancer an AxonOps credential, lists the Kafka clusters it manages, and connects axon-dash to it.
| Task | AxonOps Cloud | Self-hosted |
|---|---|---|
| Install and run the balancer | AxonOps | Operator, from the AxonOps package repositories |
| AxonOps credential for the balancer | AxonOps | Operator creates an API token with the Admin role |
| Register Kafka clusters with the balancer | Every Kafka cluster in the organisation, when the balancer starts | Clusters listed in /etc/axonops/adaptive-balancer.yml |
| Connect axon-dash to the balancer | Automatic | Base URL and bearer token under Settings → Kafka |
| Model refresh interval and metrics window | Settings → Kafka | Settings → Kafka |
In both deployments the kafka_adaptive_balancer feature must be enabled for the organisation. See Availability.
AxonOps Cloud
Section titled “AxonOps Cloud”No installation is required. When the feature is enabled for the organisation, AxonOps deploys a balancer for the organisation, registers its Kafka clusters, and connects it to the dashboard.
On AxonOps Cloud, the Adaptive Balancer card under Settings → Kafka shows only Model refresh interval, Metrics window, Raise alerts from anomalies, and Save. The Base URL and Bearer token fields are not shown. Continue with Tuning the model refresh interval and metrics window and Verifying the connection.
Kafka clusters are registered with the balancer when it starts. Where a Kafka cluster added to the organisation later reports "cluster <name> not found" on the Adaptive Balancing pages, contact AxonOps support.
Self-hosted installation
Section titled “Self-hosted installation”Before starting
Section titled “Before starting”The following are required:
- A working AxonOps installation: axon-server and axon-dash installed and running, the organisation configured (the
org_namevalue in/etc/axonops/axon-server.yml), and the Kafka cluster already monitored by AxonOps. See AxonOps Server Installation, AxonOps Dashboard Installation, and Kafka agent setup. - The
kafka_adaptive_balancerfeature enabled in the AxonOps licence. To enable it, contact AxonOps. - A Linux host with systemd, running a Debian-based distribution (amd64 or arm64) or a Red Hat-based distribution (x86_64 or aarch64).
- Network access from the balancer host to the axon-server API, and from the axon-dash host to the balancer's API port (8080 by default).
- An AxonOps user with the SuperUser role, to create the API token, and a user with the Admin or SuperUser role, to save the Base URL and use the Adaptive Balancing pages.
- The name of each Kafka cluster to balance, exactly as it appears in AxonOps.
- The Kafka clusters must meet the prerequisites for metrics, agent connectivity, and Kafka version.
One balancer instance serves every Kafka cluster in an organisation. The balancer has no mechanism that detects or prevents a second instance. Two instances would each hold their own state in memory and submit reassignments independently, so exactly one instance must run per organisation. Before installing, confirm that no other host runs axon-kafka-adaptive-balancer for the organisation. A Base URL already saved on the Adaptive Balancer card under Settings → Kafka for any of the organisation's Kafka clusters indicates an existing instance.
The balancer can run on the axon-server host or on a separate host. Two points apply to the choice:
- axon-server's API listens on port 8080 by default, which is also the balancer's default API port. On a host shared with axon-server, set the balancer's
service.portto a free port, for example 8090, and use that port wherever this page shows 8080 for the balancer. - On a separate host, axon-server's API must listen on an address the balancer host can reach. That address is set by
api_hostandapi_portin/etc/axonops/axon-server.yml; the sample configuration binds the API to127.0.0.1, which is reachable only from the axon-server host itself.
Step 1: Install the package
Section titled “Step 1: Install the package”The package is published in the same AxonOps APT and YUM repositories as axon-server and axon-agent. The following commands add the repository and install the package.
Debian and Ubuntu
Section titled “Debian and Ubuntu”sudo apt-get updatesudo apt-get install -y curl gnupg ca-certificates
curl -L https://packages.axonops.com/apt/repo-signing-key.gpg \ | sudo gpg --dearmor -o /usr/share/keyrings/axonops.gpg
echo "deb [signed-by=/usr/share/keyrings/axonops.gpg]\ https://packages.axonops.com/apt axonops-apt main" \ | sudo tee /etc/apt/sources.list.d/axonops-apt.listsudo apt-get update
sudo apt-get install axon-kafka-adaptive-balancerRed Hat and derivatives
Section titled “Red Hat and derivatives”sudo tee /etc/yum.repos.d/axonops-yum.repo << EOL[axonops-yum]name=axonops-yumbaseurl=https://packages.axonops.com/yum/enabled=1repo_gpgcheck=0gpgcheck=0EOLsudo yum install axon-kafka-adaptive-balancerWhere the AxonOps repository is already configured on the host, only the final install command is needed.
The package installs the following:
| Item | Path or name |
|---|---|
| Binary | /usr/share/axonops/axon-kafka-adaptive-balancer |
| Configuration file | /etc/axonops/adaptive-balancer.yml (mode 640, group axonops) |
| systemd unit | axon-kafka-adaptive-balancer.service |
| Service account | axonops user and group, created if absent |
| Log file | /var/log/axonops/adaptive-balancer.log |
With the default rotation settings (service.log_max_size 100 MB and service.log_max_backups 5), the balancer log occupies at most about 600 MB under /var/log/axonops: the active file plus five rotated files. Rotated files are compressed with gzip, so the space used is normally lower. The configuration reference describes the rotation settings.
The package enables the service but does not start it, so the configuration and network restrictions can be completed first. To confirm the installation:
systemctl is-enabled axon-kafka-adaptive-balancerThe command prints enabled.
Step 2: Create an AxonOps API token
Section titled “Step 2: Create an AxonOps API token”The balancer authenticates to axon-server with an API token that carries the Admin role. Reassignments and the balancer's history writes are rejected for any lower role.
- Sign in to the AxonOps dashboard as a SuperUser.
- Open Settings → API Tokens. The menu item is shown only to SuperUser accounts.
- Select Create new API token.
- Under Allowed Roles, select Add role, set Cluster to
_global_, and set Role toadmin. - Leave Token Expiry Time at
permanent, or set an expiry date. An expired token stops the balancer from reading the cluster or submitting reassignments until a new token is configured. - Select Create.
- Copy the token from the New API Token dialog. The dialog is the only place the token is shown.
Step 3: Configure the balancer
Section titled “Step 3: Configure the balancer”Edit /etc/axonops/adaptive-balancer.yml as root. The following is a complete working configuration; keys it omits take built-in defaults, which match the values in the shipped file for every key that has an effect.
service: port: 8080 # Bearer token that axon-dash must present on every balancer API call. auth_token: "<balancer bearer token>" log_file: /var/log/axonops/adaptive-balancer.log
clusters: # AxonOps Kafka cluster names, exactly as shown in AxonOps. auto_register_clusters: - kafka-prod persist_state: true
axonops: # axon-server API address. The balancer appends /api/v1/... to this value. base_url: http://axon-server.example.com:8080 # AxonOps organisation name. organization: myorg # API token from step 2. auth_token: "<AxonOps API token>" auth_scheme: AxonApi| Key | Value to set |
|---|---|
service.port | The balancer's API port. Change it from 8080 when the host already runs axon-server. |
service.auth_token | A random string that axon-dash must send as a bearer token. Generate one with openssl rand -hex 32. |
service.log_file | The log file path. The directory must be writable by the axonops user, or the balancer fails to start. |
clusters.auto_register_clusters | The Kafka clusters the balancer manages. Each name must match the AxonOps cluster name. |
clusters.persist_state | true keeps analyses, executions, anomalies, maintenance windows, and per-cluster settings in axon-server across restarts. It must be true for AxonOps alerts to be raised from anomalies. |
axonops.base_url | The address of axon-server's API, not of axon-dash. <base_url>/api/v1/ must reach axon-server's REST API. |
axonops.organization | The AxonOps organisation name. On a self-hosted installation, this is the org_name value in /etc/axonops/axon-server.yml. |
axonops.auth_token | The API token created in step 2. |
axonops.auth_scheme | AxonApi, the scheme for an AxonOps API token. |
Use clusters.auto_register_clusters, not clusters.auto_register: true. With an API token, auto_register currently finds no clusters, and the log records "auto-register: no Kafka clusters reported by AxonOps". Every key is described in the configuration reference.
An empty service.auth_token leaves the balancer API open
When service.auth_token is empty, the balancer accepts every API request without authentication and logs a warning at startup. Any host that can reach the API port can then start a live execution that reassigns partitions in Kafka. Set service.auth_token before the balancer is started, and limit the API port to the axon-dash host as described in step 4.
Before starting the balancer, confirm that the address, organisation, cluster name, and token work together by requesting the cluster's broker list from axon-server:
curl -s -H "Authorization: AxonApi <AxonOps API token>" \ http://axon-server.example.com:8080/api/v1/myorg/kafka/kafka-prod/clusterInfoA JSON document describing the cluster's brokers confirms the settings. The response unable to validate API Key indicates a wrong token, and API Key expired an expired one.
Step 4: Restrict network access
Section titled “Step 4: Restrict network access”The balancer's listeners use plain HTTP and bind to every network interface. The balancer has no option to enable TLS or to restrict the bind address, so access must be limited with host or network firewall rules. Apply the rules before the balancer is started in step 5, so that its ports are never reachable from other hosts.
| Port | Serves | Must be reachable from | Authentication |
|---|---|---|---|
8080 (service.port) | Balancer API, /health, /version | The axon-dash host only | Bearer token (service.auth_token) on the API; /health and /version are always open |
9090 (service.metrics_port) | Prometheus /metrics | The metrics scraper only, or no other host | None |
The balancer also makes outbound connections to the axon-server API at axonops.base_url.
To encrypt traffic between axon-dash and the balancer, place a TLS-terminating reverse proxy in front of the balancer, block direct access to the balancer's port from other hosts, and use an https:// Base URL in step 7. axon-dash verifies the proxy's certificate against its default trust store; AxonOps has no setting to add a certificate authority or to skip verification for this connection. For an https:// axonops.base_url, the balancer verifies axon-server's certificate against the operating system's trust store.
Step 5: Start the balancer
Section titled “Step 5: Start the balancer”sudo systemctl enable --now axon-kafka-adaptive-balancersudo systemctl status axon-kafka-adaptive-balancerThe status output shows active (running). The unit restarts the balancer 5 seconds after any exit, so a configuration error appears as a repeating restart rather than a stopped service. See Troubleshooting.
Step 6: Verify the service
Section titled “Step 6: Verify the service”Check the health and version endpoints from the balancer host:
curl -s http://localhost:8080/healthcurl -s http://localhost:8080/versionThe health endpoint returns {"status":"healthy"}, and the version endpoint returns the build's version, commit, and date. Neither endpoint requires the bearer token.
Then confirm that each cluster was registered and that its first model refresh completed:
sudo grep -E 'auto-register|Cluster refresh completed|Failed to refresh cluster model' \ /var/log/axonops/adaptive-balancer.logThe log is JSON, one object per line. A working setup shows an "auto-register: cluster added" entry for each cluster, followed by "Cluster refresh completed" with a health field. The first refresh starts at registration and issues one request per topic, so it takes longer on clusters with many topics. A "Failed to refresh cluster model" entry carries the error that prevented the refresh.
When service.log_file is set, the balancer writes its log only to that file. Startup errors raised before the log file opens, and the balancer's audit events, go to standard output, which systemd records in the journal:
sudo journalctl -u axon-kafka-adaptive-balancerStep 7: Connect axon-dash to the balancer
Section titled “Step 7: Connect axon-dash to the balancer”The Base URL is stored for each Kafka cluster separately, so this step is repeated for every cluster listed in clusters.auto_register_clusters.
- Select the Kafka cluster in the dashboard.
- Open Settings → Kafka, and locate the Adaptive Balancer card.
- In Base URL, enter the balancer's address as reached from the axon-dash server, including the scheme, for example
http://balancer.example.com:8080. The placeholderhttp://localhost:8080is correct only where the balancer runs on the axon-dash host. - In Bearer token, enter the
service.auth_tokenvalue. - Leave Model refresh interval and Metrics window unchanged. They are blank until the balancer is reachable. The Raise alerts from anomalies switch is saved on its own when changed and is not part of Save; see Anomaly alerts.
- Select Save. The message "Adaptive Balancer URL saved" confirms that axon-server stored the Base URL.
- Wait up to 60 seconds, then reload the page. Model refresh interval shows
5mand Metrics window shows Hourly, read from the balancer. Blank fields mean axon-dash still cannot reach the balancer; open Adaptive Balancing → Analyses to see the error message. Then confirm the connection as described in Verifying the connection: the Balancer Status card shows StatusACTIVEand a recent Last refresh time.
axon-dash caches the balancer address for each cluster for up to 60 seconds. A Save that includes a refresh setting reads the Base URL again immediately, so the refresh settings reach the balancer at the new address in the same Save. A Save with both refresh fields blank does not, and a new or changed Base URL then takes up to 60 seconds to apply to the Adaptive Balancing pages. A failed Base URL lookup is not cached.
The two credentials behave differently:
- The Base URL is stored in AxonOps for the Kafka cluster and applies to every browser. Saving it requires the Admin or SuperUser role. It can be replaced but cannot be cleared from the dashboard.
- The bearer token is stored only in the browser's local storage and is never stored in AxonOps. axon-dash forwards it to the balancer with each request without storing it. Every browser that opens the Adaptive Balancing pages must have it entered. Saving the card with the Bearer token field empty removes the token from that browser. A browser without the token receives the error "missing Authorization header" from the balancer.
Tuning the model refresh interval and metrics window
Section titled “Tuning the model refresh interval and metrics window”Both settings are per Kafka cluster and are set on the Adaptive Balancer card under Settings → Kafka, on AxonOps Cloud and self-hosted alike.
| Setting | Format | Range | Default |
|---|---|---|---|
| Model refresh interval | Duration with a unit, for example 90s, 5m, or 2h | 30s to 6h | 5m |
| Metrics window | 15 minutes, Hourly, Daily, or Weekly | 1m to 7d | Hourly (1h) |
The model refresh interval sets how often the balancer rebuilds its picture of the cluster: broker load, partition sizes, and topology. An analysis works from the model as of the last refresh, so a long interval means proposals can be based on older load. Each rebuild issues one request per topic, so a short interval adds load to axon-server on a cluster with many topics. A change takes effect immediately: the next rebuild is rescheduled from the time of the last one.
The metrics window sets how much history each metric query covers. Rate metrics, such as network and disk throughput and I/O wait, are averaged across the window, so a wider window makes the balancer less responsive to short spikes. Sizes, such as partition size, are read from the latest sample regardless of the window. A change applies from the next rebuild. Where the balancer holds a window other than the four listed, such as one set through its API, the dropdown shows that value as an additional option.
To change either setting, enter the value and select Save. The fields then show the balancer's normalised form of the value; for example, 90s is shown as 1m30s. A value outside the range, or one without a unit such as 5, is rejected, and an error dialog shows the balancer's message, for example "refresh interval must be between 30s and 6h0m0s". With clusters.persist_state enabled, both values are stored in AxonOps and survive a balancer restart.
Verifying the connection
Section titled “Verifying the connection”Open Adaptive Balancing → Overview with the Kafka cluster selected. The page shows the cards Balancer Status, Cluster Status, Latest Analysis, Latest Execution, and Recent Anomalies. A connected balancer populates the Balancer Status card:

| Field | Expected value |
|---|---|
| Status | ACTIVE, or REFRESHING while the model is rebuilt. See the values below. |
| Error | Shown only when the last refresh failed, in red, with the reason |
| Last refresh | Time of the last model rebuild |
| Next scheduled refresh | Time of the next model rebuild, with the Force refresh button |
| Refresh interval, Metrics window | The values set under Settings → Kafka |
| Active maintenance windows | The number of open maintenance windows |
| Status | Meaning |
|---|---|
ACTIVE | The last refresh succeeded; analyses use current data. |
REFRESHING | The balancer is reading the latest data from AxonOps. |
ERROR | The last refresh failed, so analyses use data from the last successful one. The Error row gives the reason. Shown in red. |
DISABLED | The cluster is disabled in the balancer, so it is never refreshed. |
Force refresh rebuilds the model immediately.
The Cluster Status card draws six pie charts of the cluster's broker nodes, either By broker (the default) or By rack; the dashboard remembers the choice. The charts show partitions, leaders, log size, CPU, bytes in, and bytes out per broker or per rack. Partitions, leaders, and log size are summed per rack, CPU is the average host CPU percentage (averaged, not summed, per rack), and bytes in and bytes out are five-minute rates. The charts use the metrics the balancer reads and follow the dashboard time selector, so a lopsided chart shows the skew an analysis sees. Only nodes that AxonOps reports as Kafka brokers are included; dedicated KRaft controller nodes, Kafka Connect, and Schema Registry nodes are not. Combined-mode KRaft nodes (process.roles=broker,controller) report as brokers and are included.

The Error row reports only the balancer's own refresh failures. The Overview does not show connection errors between axon-dash and the balancer: when the balancer cannot be reached, the fields show no values. Open Adaptive Balancing → Analyses, which shows the error message.
Adding a Kafka cluster later
Section titled “Adding a Kafka cluster later”The balancer registers clusters only when it starts, so adding a cluster requires a restart. A restart ends any execution in progress: the execution is marked FAILED, and reassignments it already submitted continue in Kafka without being tracked.
-
On Adaptive Balancing → Executions, confirm that no execution is
RUNNINGon any cluster the balancer serves. -
Add the cluster name to
clusters.auto_register_clustersin/etc/axonops/adaptive-balancer.yml. -
Restart the balancer:
Terminal window sudo systemctl restart axon-kafka-adaptive-balancer -
Confirm that the log shows
"auto-register: cluster added"for the new cluster, as in step 6. -
Select the new cluster in the dashboard and save its Base URL and bearer token, as in step 7.
With clusters.persist_state enabled, the restart reloads each existing cluster's goal settings, refresh settings, and maintenance windows from AxonOps, together with up to 7 days of analyses, executions, and anomalies, at most 200 records of each kind per cluster. History retention gives the full rules.
To stop balancing a cluster, remove it from the list and restart. Its stored history remains in AxonOps.
Upgrading
Section titled “Upgrading”-
On Adaptive Balancing → Executions, confirm that no execution is
RUNNING. -
Upgrade the package.
On Debian and Ubuntu:
Terminal window sudo apt-get updatesudo apt-get install --only-upgrade axon-kafka-adaptive-balancerOn Red Hat and derivatives:
Terminal window sudo yum update axon-kafka-adaptive-balancer -
Restart the balancer. The package upgrade does not restart it.
Terminal window sudo systemctl restart axon-kafka-adaptive-balancer -
Confirm the new version with
curl -s http://localhost:8080/version.
An upgrade preserves /etc/axonops/adaptive-balancer.yml. On Debian and Ubuntu, where the packaged default file has changed, the package manager asks whether to keep the installed version; keep it. On Red Hat and derivatives, the new default is written beside the existing file as adaptive-balancer.yml.rpmnew.
To return to the previous version, install that version explicitly, for example sudo apt-get install axon-kafka-adaptive-balancer=<version> or sudo yum downgrade axon-kafka-adaptive-balancer-<version>, and restart the service.
Container image
Section titled “Container image”The balancer is also published as a container image, europe-docker.pkg.dev/axonops-public/axonops-docker/axon-kafka-adaptive-balancer:<version>. The image runs as the axonops user, exposes ports 8080 and 9090, and reads /etc/axonops/adaptive-balancer.yml, which the image ships empty. A configuration file must be mounted at that path; without one, the balancer starts on built-in defaults and the environment variables only. Set service.log_file: "" so that the log goes to the container's standard output. The one-instance-per-organisation rule applies to containers as well.
Troubleshooting
Section titled “Troubleshooting”Balancer service
Section titled “Balancer service”| Symptom | Cause | Fix |
|---|---|---|
| The service restarts every 5 seconds; the journal shows "Failed to load configuration" | The configuration file is not valid YAML, or cannot be read | Correct the YAML syntax. Confirm the file is readable by the axonops group. |
| The journal shows "Failed to initialize logger: open log file" | service.log_file points to a path the axonops user cannot write | Correct the path or its permissions, or set service.log_file: "" to log to the journal. |
| The log shows "Failed to start API server" or "Failed to start metrics server" | Another process uses service.port or service.metrics_port, commonly axon-server on port 8080 | Set a free port and restart. Update the Base URL if service.port changed. |
| The log shows "auto-register: no Kafka clusters reported by AxonOps" | clusters.auto_register: true with an API token finds no clusters | List the clusters in clusters.auto_register_clusters. |
| The log shows "Failed to refresh cluster model" | Wrong axonops.base_url, organisation, or cluster name, or an unknown or expired API token | Run the clusterInfo check in step 3 and correct the setting it identifies. |
| The log shows "Failed to refresh cluster model" with "AxonOps returned an empty broker list for org=… cluster=…; skipping this refresh rather than modelling every broker as dead" | axon-server briefly returned no brokers, which can happen while a broker shuts down. The balancer keeps its previous model, shows Status ERROR, and retries after half the refresh interval. | No action is needed when the next refresh succeeds. If the message persists, confirm that the Kafka agents are reporting to AxonOps. |
Live movements fail with an error containing available kafka nodes not found | No broker's agent has an active Kafka connection | Restore the Kafka agent on at least one broker. See Kafka agent setup. |
Messages in the dashboard
Section titled “Messages in the dashboard”The Adaptive Balancing pages show these messages in a red box. The Overview page shows none of them, only the balancer's own refresh error in the Error row; open Analyses to see the message.
| Message | Cause | Fix |
|---|---|---|
Could not reach the Adaptive Balancer at http://axon-kafka-adaptive-balancer.cst-<org>.svc.cluster.local:8080 (host <hostname> not found). No Base URL is saved for this cluster, so the SaaS in-cluster default was used. Set one under Settings → Kafka. | No Base URL is stored for the selected cluster, or one was saved less than 60 seconds ago, unless the Save also included refresh settings. | Save the Base URL for this cluster as in step 7, wait 60 seconds, and reload. |
Could not reach the Adaptive Balancer at <url> (<reason>). Check the Base URL under Settings → Kafka and that the balancer is running. | The saved Base URL did not answer. On AxonOps Cloud, the message ends after the first sentence. connection refused means nothing listens on that port; host <name> not found means the host name does not resolve from the axon-dash server; ETIMEDOUT usually means a firewall drops the traffic. | Confirm the balancer is running, that the Base URL is correct as seen from the axon-dash server, and that the firewall allows the axon-dash host. |
Could not reach the Adaptive Balancer at <url> (<reason>). The saved Base URL couldn't be read from axon-server (<lookupError>), so the SaaS in-cluster default was used. | axon-dash could not read the stored Base URL from axon-server: axon-server is unreachable, its data store failed, or the stored value is unreadable. | Check the axon-server address in axon-server.private_endpoints in /etc/axonops/axon-dash.yml, and that axon-server is running. |
The saved Adaptive Balancer Base URL "<url>" isn't a valid URL. Include the scheme, e.g. http://host:8080, under Settings → Kafka. | The Base URL has no http:// or https:// scheme, or is malformed. | Save the Base URL again with its scheme. |
The Adaptive Balancer at <url> did not respond within 120s. | The balancer accepted the connection but did not answer. | Check the balancer log for errors and the host for resource exhaustion. |
| missing Authorization header | service.auth_token is set and this browser has no bearer token. | Enter the token under Settings → Kafka in this browser and save. |
| invalid bearer token | The token stored in this browser differs from service.auth_token. | Enter the current token and save. |
cluster <name> not found, or Cluster not found | The selected cluster is not registered with the balancer. | Add it to clusters.auto_register_clusters and restart, as in Adding a Kafka cluster later. |
Failed to save Adaptive Balancer URL: <error> | axon-server rejected the Base URL, commonly because the user lacks the Admin or SuperUser role. | Save as an Admin or SuperUser. |
Related pages
Section titled “Related pages”- Kafka Adaptive Balancer: what the balancer does, availability, and prerequisites
- Kafka Adaptive Balancer Configuration Reference: every key in
/etc/axonops/adaptive-balancer.yml - Rebalancing a Kafka Cluster with the Adaptive Balancer: running the first analysis and execution
- Kafka Adaptive Balancer Goals and Cluster Model: the goals analyses use and how to change them
- AxonOps Server Installation: axon-server configuration, including the API address
- AxonOps Dashboard Installation: axon-dash configuration, including its axon-server address