Kafka Adaptive Balancer Configuration Reference
The AxonOps Kafka Adaptive Balancer service, axon-kafka-adaptive-balancer, reads its configuration from /etc/axonops/adaptive-balancer.yml. The systemd unit and the container image both pass this path to the service with --config. This page lists every key that takes effect, with its built-in default, and the one anomaly detection setting that takes effect. Settings that are held per Kafka cluster, such as the model refresh interval and the enabled goals, are not in this file; they are listed under Per-cluster settings.
Kafka Adaptive Balancer Setup shows a minimal working file for a self-hosted installation.
Applying changes
Section titled “Applying changes”The balancer reads the file once, at startup. A change takes effect only after a restart:
sudo systemctl restart axon-kafka-adaptive-balancerA restart clears the balancer's in-memory state. An execution in progress is marked FAILED, and reassignments it already submitted continue in Kafka without being tracked. On Adaptive Balancing → Executions, confirm that no execution is RUNNING before restarting.
The following rules apply to the whole file:
- The file is YAML. A syntax error, or a file the service cannot read, stops the balancer from starting, and the journal records "Failed to load configuration".
- Unknown or misspelled keys are ignored without a warning. A key that appears to have no effect should be checked against the names on this page.
- Durations are written as a number and a unit of
s,m, orh, for example90s,5m, or1h30m. Days are not accepted; write 7 days as168h. - A value set through one of the supported environment variables overrides the value in the file. A key set in neither place takes its built-in default.
service
Section titled “service”Settings for the balancer's own listeners and logging.
| Key | Default | Description |
|---|---|---|
port | 8080 | Port of the balancer API and of the /health and /version endpoints. |
metrics_port | 9090 | Port of the Prometheus /metrics endpoint, served on a separate listener. This listener never requires authentication. |
log_level | info | One of debug, info, warn, or error. Any other value is treated as info. |
log_file | "" (standard output) | Path of the log file. The package ships the value /var/log/axonops/adaptive-balancer.log. When set, the log is written only to this file, as JSON with one object per line, and the file is rotated. The axonops user must be able to write the path, or the balancer fails to start. Audit events always go to standard output, which systemd records in the journal. |
log_max_size | 100 | Size in MB at which the log file is rotated. |
log_max_backups | 5 | Number of rotated log files kept. Rotated files are compressed with gzip. |
log_max_age | 28 | Days a rotated log file is kept. |
auth_token | "" | Bearer token required on every /api/v1 request, sent as Authorization: Bearer <token>. The same value is entered as Bearer token in axon-dash. When empty, the API accepts unauthenticated requests and the balancer logs a warning at startup. /health, /version, and /metrics are always unauthenticated. |
allowed_origins | [] | Browser origins allowed to call the API directly (CORS). axon-dash calls the balancer from its server, so it needs no entry. An empty list permits no cross-origin requests. ["*"] should not be used unless a reverse proxy enforces origin checks. |
max_request_body_bytes | 1048576 | Maximum request body size in bytes. A value of 0 or less applies the default. |
read_header_timeout | 10s | Time allowed for a client to send request headers. A value of 0 or less applies the default. |
Both listeners use plain HTTP and bind to every network interface; the balancer has no TLS or bind-address setting. Kafka Adaptive Balancer Setup describes how to restrict and encrypt access.
clusters
Section titled “clusters”Settings that control which Kafka clusters the balancer manages and whether its state is stored in AxonOps.
| Key | Default | Description |
|---|---|---|
auto_register | false | When true, the balancer lists the Kafka clusters of axonops.organization at startup and registers each one. AxonOps Cloud uses this setting. With an AxonOps API token (auth_scheme: AxonApi), it currently finds no clusters, and the log records "auto-register: no Kafka clusters reported by AxonOps". A failure to list clusters does not stop startup. |
auto_register_clusters | [] | Names of AxonOps Kafka clusters to register at startup. Each name must match the cluster name in AxonOps and is used as the balancer's cluster ID. The list is combined with auto_register, and a cluster that is already registered is skipped. This is the setting to use on a self-hosted installation. |
persist_state | true | When true, the balancer stores analyses, executions, anomalies, maintenance windows, and each cluster's goal and model settings in axon-server, and reloads them at startup; see History retention. axon-server raises anomaly alerts from the anomaly records the balancer stores. When false, the balancer writes nothing to axon-server, no AxonOps alerts are raised from anomalies, and all of this state is lost when the balancer restarts. A failed write to axon-server is logged as a warning and does not fail the operation; for an anomaly, the alert for that detection is not raised until the condition is next reported successfully. |
Clusters are registered only at startup; the balancer does not discover clusters while running, so a cluster added to either list requires a restart. Both settings need axonops.organization; without it, registration is skipped with a warning.
History retention
Section titled “History retention”With persist_state enabled, the following rules apply to the history stored in axon-server:
- At startup, the balancer reloads the last 7 days of analyses, executions, and anomalies, or the axon-server events retention period if that is shorter, up to 200 records of each kind per cluster. It also reloads the current maintenance windows and goal and model settings.
- Every detection of a persisting condition is stored as a new anomaly record. One persisting goal violation, detected every minute, produces about 200 records in a little over 3 hours. After a balancer restart, First Detected and Count in Recent Anomalies therefore reflect only the reloaded records, not the whole life of the condition.
- axon-server deletes stored analyses, executions, and anomalies older than its events retention period,
retention.eventsin/etc/axonops/axon-server.yml, 1 week by default.retention.eventsis axon-server's shared events retention, so changing it also changes the retention of other AxonOps event history. The deletion runs once a day, so records can remain for up to about a day past the retention period. - Maintenance windows, goal and model settings, and the anomaly alerts setting are not deleted. AxonOps provides no other way to delete the stored history.
- The history of a Kafka cluster that has been removed from AxonOps is not deleted and remains in the AxonOps data store. A Kafka cluster later added with the same name is associated with that history.
axonops
Section titled “axonops”Settings for the balancer's connection to axon-server.
| Key | Default | Description |
|---|---|---|
base_url | none | Address of the axon-server REST API, for example http://axon-server.example.com:8080. The balancer appends paths that begin with /api/v1/ to this value, so it must point at axon-server's API, not at axon-dash. A trailing slash is removed. The value in the shipped file, http://localhost:8081/dashboard, is a placeholder, not a default. For an https:// address, the certificate is verified against the operating system's trust store; there is no setting for a custom certificate authority or for skipping verification. |
organization | none | AxonOps organisation name. Required for cluster registration. On a self-hosted installation, this is the org_name value in /etc/axonops/axon-server.yml. |
auth_token | "" | Credential sent to axon-server. On a self-hosted installation, an AxonOps API token with the Admin role. Ignored when auth_scheme is CloudBearer. |
auth_scheme | "" (Bearer) | How auth_token is sent: AxonApi sends Authorization: AxonApi <token> and is the value for an AxonOps API token; Bearer, or an empty value, sends Authorization: Bearer <token>; CloudBearer is used by AxonOps Cloud. |
timeout | 30s | Timeout for each HTTP request to axon-server. |
retry_count | 3 | Number of retries after a network error, an HTTP 5xx response, or HTTP 429. Other 4xx responses are not retried. |
retry_delay | 1s | Fixed delay between retries. |
cloudapi_url, cloudapi_token, cloudapi_user_login, cloudapi_roles, cloudapi_ttl_secs | none | Used by AxonOps Cloud with auth_scheme: CloudBearer. Not set on a self-hosted installation. |
cloudapi_user_id | kafka-adaptive-balancer when the system-user login is used, otherwise unset | User ID sent with AxonOps Cloud tokens. Used by AxonOps Cloud only. Not set on a self-hosted installation. |
The credential must carry the Admin role on the organisation. axon-server rejects reassignments and history writes for any lower role.
global_optimization.thresholds
Section titled “global_optimization.thresholds”Thresholds used by the goals. Every key is optional, and a key left unset keeps its built-in default. The defaults match Cruise Control's. The keys capacity_threshold, resource_balance_percentage, and low_utilization_threshold each take the resource keys cpu, disk, network_in, and network_out.
| Key | Default | Description |
|---|---|---|
max_replicas_per_broker | 10000 | Most replicas one broker may hold, enforced by ReplicaCapacityGoal. The lower of this value and the broker's own replica capacity, also 10000 by default, applies. |
capacity_threshold.cpu | 0.7 | Largest fraction of a broker's CPU capacity it may use, enforced by CpuCapacityGoal. |
capacity_threshold.disk | 0.8 | Largest fraction of a broker's disk capacity it may use, enforced by DiskCapacityGoal. |
capacity_threshold.network_in, capacity_threshold.network_out | 0.8 | Largest fraction of network capacity that may be used, enforced by the network capacity goals. Network capacity is evaluated per host. |
resource_balance_percentage.* | 0.09 for each resource | Allowed spread of each resource's utilisation around the cluster mean, used by the usage distribution goals. |
low_utilization_threshold.* | 0.0 for each resource | When the mean utilisation of a resource is at or below this value, its usage distribution goal reports the cluster as over-provisioned and accepts being unsatisfied. It does not change which moves are proposed. |
replica_balance_percentage | 0.09 | Allowed spread of replica counts per broker around the mean, used by ReplicaDistributionGoal. |
leader_replica_balance_percentage | 0.09 | Allowed spread of leader counts per broker around the mean, used by LeaderReplicaDistributionGoal. |
topic_replica_balance_percentage | 3.0 | Allowed spread of each topic's replicas across brokers, used by TopicReplicaDistributionGoal. This value is a ratio of 1 or more, not a fraction. |
topic_replica_balance_min_gap, topic_replica_balance_max_gap | 2, 40 | Lower and upper bounds on the allowed gap between a broker's replica count for a topic and the topic average, used by TopicReplicaDistributionGoal. |
A capacity threshold is an absolute fraction of capacity: a move is rejected when it would bring a broker's projected utilisation to the threshold or above.
A balance percentage is relative to the mean, not a number of percentage points. The allowed band is the mean multiplied by (1 - p) to the mean multiplied by (1 + p). With the default of 0.09 and a mean disk utilisation of 50%, the band is 45.5% to 54.5%, not 41% to 59%. For replica and leader counts, the band is rounded outwards to whole numbers: with a mean of 1,000 replicas per broker, the band is 910 to 1,090.
The following rules apply to thresholds:
- The values apply to every cluster the balancer manages. There is no per-cluster override.
- Values are not range-checked. A value such as
8for a capacity threshold is accepted and used as 800% of capacity. - An unrecognised resource key is ignored without a warning.
- A change applies to analyses run after the balancer is restarted.
- The thresholds of the goal violation anomaly detector are separate from these values and are not configurable; see Anomaly detection.
The following example lowers the disk capacity threshold and narrows the disk balance band, leaving every other threshold at its default:
global_optimization: thresholds: capacity_threshold: disk: 0.75 resource_balance_percentage: disk: 0.05Kafka Adaptive Balancer Goals and Cluster Model describes each goal and which thresholds it reads.
global_execution
Section titled “global_execution”Limits that pace a live execution. Each limit applies to one execution; limits are not shared between executions. The first three can be overridden for a single execution in the Throttle panel of the analysis page, as described in Rebalancing a Kafka Cluster with the Adaptive Balancer.
| Key | Default | Description | Throttle panel field |
|---|---|---|---|
default_max_concurrent_movements | 5 | Largest number of replica movements in flight across the cluster. A movement is in flight from its submission to AxonOps until the cluster topology shows it complete. A value of 0 or less applies the executor's built-in limit of 10. | Max concurrent movements |
default_max_tasks_per_broker | 2 | Largest number of movements in flight on one broker. A replica move counts against both its source and its destination broker. On small clusters this is usually the limit that binds. A value of 0 or less applies the default. | Max tasks per broker |
default_data_movement_rate_limit | 50MB/s | Target data movement rate, applied as a limit on data in flight rather than on bandwidth. See Data movement rate limit. | Max data rate (MB/s) |
default_max_concurrent_leader_movements | 100 | Largest number of leader changes in flight across the cluster, counted separately from replica movements. A value of 0 or less applies the default. | None |
data_movement_window | 60s | Window used to turn the data movement rate into a limit on data in flight. A value of 0 or less applies the default. | None |
movement_stall_timeout | 5m | A movement that shows no progress for this long fails and is not retried. A value of 0 or less applies the default. | None |
dispatch_stall_timeout | 2m | When movements remain queued, none can be dispatched, and nothing is in flight, the execution's remaining movements fail after this long. A negative value disables the check; 0 applies the default. | None |
Data movement rate limit
Section titled “Data movement rate limit”The balancer cannot set Kafka's replication throttles through AxonOps. It approximates a rate limit by capping the total size of movements in flight at the rate multiplied by data_movement_window. With the defaults, the cap is 50 MiB/s × 60 s, about 2.93 GiB. A movement is dispatched only when the bytes already in flight plus its own size fit within the cap. A movement is always dispatched when nothing is in flight, so a partition larger than the cap still moves, on its own. Proposals whose size is unknown, because metrics were missing, are not counted against the cap.
The value is a number followed by B, KB, MB, or GB, with an optional /s or /sec, in any letter case, for example 50MB/s, 500KB/s, or 1GB/s. A number without a unit is a byte count. The units are binary: 1 MB is 1,048,576 bytes. The MiB spelling is not recognised. An empty value, 0, or a value that cannot be parsed applies the built-in 50 MiB/s; an unparseable value is also logged as "Invalid default_data_movement_rate_limit; keeping built-in default". The limit therefore cannot be switched off; a larger value loosens it.
Fixed execution limits
Section titled “Fixed execution limits”The following limits are built in and cannot be configured:
| Limit | Value | Effect |
|---|---|---|
| Maximum execution duration | 2 hours | The execution stops dispatching movements and finishes in state COMPLETED. Reassignments already submitted continue in Kafka. |
| Per-movement timeout | 30 minutes | A movement not complete within this time is retried by submitting the same target placement again. |
| Retries | 3, 5 seconds apart | A movement that fails with a retryable error is retried up to three times. |
| Completion check | Every 10 seconds | Interval at which the balancer reads the cluster topology to detect completed movements. |
Anomaly detection
Section titled “Anomaly detection”The balancer's three anomaly detectors, described in Anomaly detection on the overview page, run with built-in thresholds and intervals. Those thresholds and intervals are not configurable through adaptive-balancer.yml. The shipped file contains no anomaly detection section, and with none present every detector runs on its built-in settings.
The only supported use of the global_anomaly_detection key is to turn anomaly detection off as a whole:
global_anomaly_detection: enabled: falseWith this block, the balancer logs "Anomaly detection disabled by config; skipping bootstrap" at startup, records no new anomalies, raises no AxonOps alerts, and starts no analyses in response to anomalies.
Do Not Do This
Problem: Adding a global_anomaly_detection: block with detector, interval, or threshold settings, as shown in older examples, disables all three detectors. The balancer does not read those settings and reports no error.
Symptoms: No new anomalies appear in the Recent Anomalies table on the Overview, AxonOps raises no balancer alerts, and the balancer starts no analyses in response to anomalies, although the balancer starts and runs normally.
Instead: Leave global_anomaly_detection out of the file so that the built-in detectors run. Add it only to turn detection off, with enabled: false as its only key.
# BAD: disables every detector without an errorglobal_anomaly_detection: enabled: true detectors: goal_violation: enabled: true
# GOOD: no global_anomaly_detection block; the built-in detectors runEnvironment variables
Section titled “Environment variables”Only the following environment variables have an effect. Each overrides the corresponding key in the file.
| Variable | Key |
|---|---|
ADAPTIVE_BALANCER_SERVICE_AUTH_TOKEN | service.auth_token |
ADAPTIVE_BALANCER_SERVICE_ALLOWED_ORIGINS | service.allowed_origins, as a comma-separated list |
ADAPTIVE_BALANCER_AXONOPS_BASE_URL | axonops.base_url |
ADAPTIVE_BALANCER_AXONOPS_ORGANIZATION | axonops.organization |
ADAPTIVE_BALANCER_AXONOPS_AUTH_TOKEN | axonops.auth_token |
ADAPTIVE_BALANCER_AXONOPS_AUTH_SCHEME | axonops.auth_scheme |
ADAPTIVE_BALANCER_AXONOPS_TIMEOUT | axonops.timeout |
ADAPTIVE_BALANCER_AXONOPS_RETRY_COUNT | axonops.retry_count |
ADAPTIVE_BALANCER_AXONOPS_RETRY_DELAY | axonops.retry_delay |
CLOUD_API_URL, CLOUD_API_TOKEN, ADAPTIVE_BALANCER_AXONOPS_CLOUDAPI_USER_LOGIN, ADAPTIVE_BALANCER_AXONOPS_CLOUDAPI_USER_ID, ADAPTIVE_BALANCER_AXONOPS_CLOUDAPI_TTL_SECS | The axonops.cloudapi_* keys, used by AxonOps Cloud |
Other variables with the ADAPTIVE_BALANCER_ prefix are ignored. For example, ADAPTIVE_BALANCER_SERVICE_PORT and ADAPTIVE_BALANCER_SERVICE_LOG_LEVEL do not change the port or the log level.
Environment variables suit container deployments. On a package installation, the configuration file, which is readable only by root and the axonops group, is the better place for tokens: variables set in a systemd drop-in file are readable by any local user by default.
Per-cluster settings
Section titled “Per-cluster settings”The following settings are held for each Kafka cluster, not in the configuration file. They are changed in the dashboard and, with clusters.persist_state enabled, stored in AxonOps and restored when the balancer restarts. Raise alerts from anomalies is the exception: axon-server stores it regardless of the persist_state value. Alerts are raised only when persist_state is enabled, because the balancer reports anomalies to axon-server through its persistence writes.
| Setting | Location | Default | Range | Takes effect |
|---|---|---|---|---|
| Model refresh interval | Settings → Kafka → Adaptive Balancer | 5m | 30s to 6h | Immediately; the next rebuild is rescheduled from the last one |
| Metrics window | Settings → Kafka → Adaptive Balancer | 1h | 1m to 7d | At the next model rebuild |
| Enabled goals | Adaptive Balancing → Goals | See Kafka Adaptive Balancer Goals and Cluster Model | Not applicable | At the next analysis |
| Maintenance windows | Adaptive Balancing → Maintenance | None | Not applicable | At the next analysis |
| Raise alerts from anomalies | Settings → Kafka → Adaptive Balancer | On | On or off | Immediately; turning it off resolves the open balancer alerts. Has no effect with clusters.persist_state: false, which raises no alerts. See Anomaly alerts. |
Kafka Adaptive Balancer Setup describes the model refresh interval and metrics window in detail.
Keys in the shipped file that do not select behaviour
Section titled “Keys in the shipped file that do not select behaviour”The configuration file installed by the package contains four keys that are read but do not control the behaviour their names suggest. Changing them has no effect on analyses or executions.
| Key | Where the effective setting lives |
|---|---|
global_optimization.default_goals | Each cluster's own goal list, on the Goals page. A newly registered cluster starts from a built-in default set, listed in Kafka Adaptive Balancer Goals and Cluster Model, not from this list. The list's order and its hard_goal flags are also ignored. In particular, the shipped list enables RackAwareDistributionGoal and disables RackAwareGoal, but a newly registered cluster starts with RackAwareGoal enabled and RackAwareDistributionGoal disabled. |
clusters.refresh_interval | The per-cluster Model refresh interval. Every cluster starts at 5 minutes. |
clusters.metrics_window | The per-cluster Metrics window. Every cluster starts at 1 hour. |
global_execution.default_execution_progress_check_interval | Not configurable. The balancer checks execution progress every 10 seconds. |
Related pages
Section titled “Related pages”- Kafka Adaptive Balancer Setup: installing the package and writing a first configuration
- Kafka Adaptive Balancer: what the balancer does and its prerequisites
- Kafka Adaptive Balancer Goals and Cluster Model: the goals that read the thresholds on this page
- Rebalancing a Kafka Cluster with the Adaptive Balancer: the Throttle panel and execution failure semantics