Skip to content

Clusters and providers

A cluster in Brokerium has a provider (who runs the nodes) and a flavor (which Kafka distribution or service). Together they decide which actions the dashboard offers; actions a cluster cannot support are not shown.

ProviderNodes are run byBrokerium can
externalyoueverything over the Kafka protocol: health, topics, ACLs, quotas, groups, messages, rebalancing, leader elections, cordon and unregister brokers, remove controllers from dynamic quorums
agentbrokerium-agent on your hostsall of the above plus creating clusters on hosts you choose, adding, replacing and decommissioning brokers, adding controllers, quorum migration, rolling restarts and upgrades
strimzithe Strimzi operator on KubernetesKafka-protocol features plus node pool scaling with rebalancing, rolling restarts and upgrades through the operator
dockerthe Docker provider (Docker installation, labs)everything, with nodes as containers on the server’s Docker host

PLAINTEXT, SSL (with optional client certificates for mTLS), SASL_PLAINTEXT and SASL_SSL with PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, AWS_MSK_IAM or OAUTHBEARER. Passwords, keys, tokens and kubeconfigs are write-only: they are sealed with the server’s secret key and never returned by the API. The principal needs admin rights for the features you use (Describe/Alter on the cluster, topics and groups; ClusterAction for reassignments and elections).

When no broker answers but the cluster has controller addresses (settings.controllerBootstrapServers, filled in automatically for agent and Docker clusters), Brokerium still reads the controller quorum directly from the controllers.

Clusters of the provider agent run on hosts with brokerium-agent (installation). You choose the host of every Kafka node; Brokerium installs the Kafka release, writes the configuration with the advertised host of the host, formats the storage and starts the node. A host can be chosen when its agent is connected, it runs no Kafka node, it belongs to no other cluster (a join token for a cluster reserves its host for that cluster) and its Kafka data directory is empty or holds the data of the same node. The dashboard offers these hosts; through the API, take their ids from GET /api/v1/nodes. Kafka stores its data in the data directory of the agent (BROKERIUM_AGENT_KAFKA_DATA_DIR, see the installation). Clusters that Brokerium creates accept clients without authentication; see security.

In the dashboard, Add cluster → Create on hosts with agents lists the free hosts. Give each host you need a role (controller, broker, or controller and broker), keep the suggested node id or type one, and set its rack and the address its listeners advertise. Add host shows the install command with a join token for another host, and the table picks the host up as soon as its agent connects. The dashboard checks the choice (at least one controller and one broker, at most five voters, no Kafka data left from another node), saves changed addresses on the hosts, shows the plan and starts it after Create cluster. Add broker, Add controller and Replace broker on the pages of the cluster offer its free hosts the same way.

Through the API, create the cluster record, then plan the creation of its nodes:

Terminal window
api() { curl -fsS -H "Authorization: Bearer $TOKEN" -H 'X-Brokerium-Request: 1' -H 'Content-Type: application/json' "$@"; }
api -d '{"name": "prod", "provider": "agent", "skipTest": true, "bootstrapServers": []}' \
https://brokerium.example.com/api/v1/clusters
api -d '{"type": "bootstrap-cluster", "params": {"version": "4.3.1", "nodes": [
{"node": "3f9c0d2a6b1e4c7d", "role": "controller"},
{"node": "8a41e6b0c2d94f13", "role": "controller"},
{"node": "c07d5e9b1a2f3468", "role": "controller"},
{"node": "1b2c3d4e5f607182", "role": "broker", "rack": "rack-a"},
{"node": "92a8b7c6d5e4f301", "role": "broker", "rack": "rack-b"},
{"node": "e5f4d3c2b1a09887", "role": "broker", "nodeId": 110}]}}' \
https://brokerium.example.com/api/v1/clusters/<cluster id>/operations
  • Choose one to five voters and at least one broker: a host has the role controller, broker or combined (broker and controller in one process, see combined nodes), which counts as both.
  • Node ids default to 1, 2, … for controllers and combined nodes and 101, 102, … for brokers in the order of the list; nodeId sets one explicitly (unique, at least 0).
  • rack defaults to the rack of the host; quorum is dynamic (default) or static.
  • version defaults to the Kafka release the server gives new clusters, defaultKafkaVersion in GET /api/v1/server; the dashboard proposes it too.
  • The plan lists the hosts with their node ids, racks and advertised hosts. Confirm it with POST /api/v1/operations/<operation id>/confirm. Afterwards the cluster connects to the advertised hosts of its brokers.

Later operations name their hosts the same way:

OperationParameters
add-broker{"nodes": [{"node": "<node id>", "rack": "rack-c"}], "rebalance": true}; nodeId per host is optional, by default ids continue after the highest broker.
add-controller{"node": "<node id>"}, optionally "nodeId": 4; a quorum has at most five voters.
replace-broker{"brokerId": 103, "mode": "same-id"} starts broker 103 again on its host, for example after its disk was replaced, and followers re-replicate what the disk lacks; add "node" to move the id to another free host. {"brokerId": 103, "mode": "new-id", "node": "<node id>"} starts a broker with a new id on that host and moves the replicas over.

Decommissioning a broker, removing a controller and replacing a broker stop Kafka on the old host and release it: the host has no role and no cluster afterwards, but keeps its Kafka data. A host that is down at that moment is released at once and stops Kafka as soon as its agent connects again, so it does not run the old node next to its replacement. Clear the data directory of a released host before it runs a node of another cluster or with another node id. Deleting the registration of an agent cluster releases its hosts too and leaves Kafka running on them.

An operation that fails halfway leaves the hosts it already reached with their role; a failed operation cannot be resumed. After a failed add-broker or add-controller, fix the cause and plan it again with the same hosts: a host whose broker is not registered, or whose controller is not a voter, continues that node. After a failed creation, delete the cluster registration, stop Kafka on its hosts (sudo systemctl stop brokerium-kafka.service) and clear their data directories before you choose them again.

A combined node runs the broker and the controller in one Kafka process (process.roles=broker,controller), with the client listener on port 9092 and the controller listener on port 9093 of its advertised host. It is a voter of the quorum like a controller (initial controllers, quorum bootstrap servers, static voters) and hosts partitions like a broker. Apache Kafka recommends combined nodes only for small and test clusters: a busy broker slows the quorum down, both roles fail and restart together, and the controllers cannot be scaled apart from the brokers. Choose dedicated controllers for production clusters.

  • Agent clusters: give a host the role combined in bootstrap-cluster; it gets the next id from the voter range (1, 2, …) and the broker rack of the host.
  • Docker clusters: {"controllers": 2, "combined": 1, "brokers": 2}. Voters get the ids from 1, controllers before combined nodes, and brokers the ids from 101. With combined, a count of 0 means none, so {"combined": 3} is a cluster of three combined nodes. Combined containers are named <cluster>-cb<id> and publish their client listener on localhost:<port base + node id> and their controller listener on localhost:<port base + 900 + node id>.
  • The plan of the cluster warns about combined nodes. They run with the broker heap.
  • Rolling restarts, upgrades and quorum migrations restart combined nodes with the controllers, the quorum leader last, then the brokers. Each restart of a combined node also waits until its broker is back and every replica is in sync.
  • add-broker and add-controller add dedicated brokers and controllers.

Brokerium refuses replace-broker, drain-broker (with or without decommission) and remove-controller on a combined node, with a message that names the node: each would stop, replace or empty one role while the other one keeps running, and a replacement would give a voter a new directory id. A cluster outgrows its combined nodes this way:

  1. Add dedicated controllers with add-controller (a quorum has at most five voters) and dedicated brokers with add-broker.
  2. Cordon the combined node (cordon-broker) and move its replicas to the dedicated brokers with move-partitions. The node then holds no data but still votes.
  3. To take it out of the cluster, use the Kafka tools: remove it from the quorum (kafka-metadata-quorum.sh --bootstrap-controller <controller>:9093 remove-controller --controller-id <id> --controller-directory-id <directory id>, see the controller quorum runbook), stop Kafka on the host (sudo systemctl stop brokerium-kafka.service) and unregister its broker with unregister-broker. Then delete the node on the Nodes page. Brokerium deletes a combined node only once its cluster no longer has its node id as a registered broker, a voter or an observer; a stopped node stays an observer for a few minutes. Deleting the node stops its agent: remove it with the uninstall script, or install the host again with a new join token and clear its data directory before it runs another node. Docker clusters keep their combined containers until their nodes are deleted.

Adopted nodes (adopting running nodes) with process.roles=broker,controller become combined nodes.

  • Bootstrap servers: the IAM endpoint (port 9098), protocol SASL_SSL, mechanism AWS_MSK_IAM, the cluster region.
  • Credentials: an access key, or nothing to use the AWS default chain (environment, EKS web identity, ECS task role, instance profile) of the Brokerium server.
  • IAM policy: kafka-cluster:Connect, DescribeCluster, AlterCluster, DescribeTopic, CreateTopic, AlterTopic, DeleteTopic, DescribeGroup, AlterGroup, DeleteGroup, ReadData, WriteData on the cluster’s resources.
  • Available: data plane and rebalancing. MSK runs brokers, controllers and versions, so the quorum, SCRAM and finalization are not offered.

Protocol SASL_SSL, mechanism PLAIN, a Kafka API key as username and its secret as password. Placement, brokers and versions belong to Confluent: Brokerium offers the data plane only.

Protocol SSL with the service CA and the access certificate and key, or SASL_SSL with SCRAM. Aiven manages nodes, users and placement: Brokerium offers the data plane only.

Settings: the namespace and name of the Kafka resource, and either a kubeconfig (embedded token or client certificate; exec plugins are not supported) or in-cluster access when Brokerium runs in the same Kubernetes cluster (Helm value rbac.strimzi). Strimzi 1.x (kafka.strimzi.io/v1) and 0.4x (v1beta2) are detected automatically. Validated with Strimzi 1.3.0 in the lab (deploy/lab/strimzi).

  • Scale node pool: growing a broker pool waits for the new brokers and rebalances onto them; shrinking first moves every replica off the brokers Strimzi will remove (the highest ids, pinned with strimzi.io/remove-node-ids), then lowers spec.replicas.
  • Rolling restart: annotates each pool’s StrimziPodSet with strimzi.io/manual-rolling-update, controllers first, health gate after each pool.
  • Upgrade: sets spec.kafka.version and pins metadataVersion to the current level, so the operator does not finalize on its own; Finalize sets metadataVersion.
  • Controller pools are not scaled: Strimzi does not support dynamic controller quorums yet.

Add cluster → Create in Docker builds a cluster from the lab node image as containers on the server’s Docker host, for evaluations, labs and tests. Give it the numbers of controllers, brokers and combined nodes (broker and controller in one process). Settings → Delete cluster nodes removes the containers and volumes again. The form proposes the Kafka release the server gives new clusters; the lab node image ships Kafka 4.3.1, and the agents in the nodes download any other release (from BROKERIUM_KAFKA_MIRROR first).

The dashboard offers it only when the server offers Docker clusters, which BROKERIUM_DOCKER_PROVIDER decides (ADR 0019):

ValueDocker clusters
auto (default)Only in the Docker installation: the server runs in a Docker container (/.dockerenv exists), not in Kubernetes (KUBERNETES_SERVICE_HOST is not set), and the Docker API at BROKERIUM_DOCKER_HOST answers. The server asks the Docker API again at most every 30 seconds, so a Docker daemon that starts later is found.
onAlways, for development with the server on the Docker host (make dev, the end-to-end tests).
offNever. The Helm chart sets it.

GET /api/v1/server reports the result in providers.docker, with the reason when Docker clusters are unavailable. Creating a Docker cluster then fails with 409 docker_unavailable, and so do operations that change the nodes of an existing Docker cluster. Such clusters stay registered and monitored over the Kafka protocol, and Kafka-level operations such as rebalancing keep working.

How the server reaches the nodes depends on where it runs:

  • In a container (the Docker installation): the server is attached to the network BROKERIUM_LAB_NETWORK and reaches brokers at <container>:9092 and controllers at <container>:9093, the names Brokerium records as the bootstrap and controller servers of the cluster.
  • On the Docker host (development): through the ports the nodes publish on localhost.

In both cases every broker also publishes a listener on localhost:<port base + node id> for clients on the Docker host. Clusters keep the addresses recorded when they were created: after moving the server between the Docker host and a container, change the bootstrap servers of existing Docker clusters.

The Docker provider also needs:

  • the Docker API at BROKERIUM_DOCKER_HOST (by default unix:///var/run/docker.sock);
  • the Docker network BROKERIUM_LAB_NETWORK (by default brokerium-lab). The lab creates it; elsewhere run docker network create brokerium-lab;
  • the lab node image BROKERIUM_AGENT_IMAGE: Apache Kafka with the agent as the main process. A release of the server defaults to bvaliev/brokerium-agent:<version>-lab, other builds to bvaliev/brokerium-agent:lab, published nightly from main. The provider pulls the image when it is missing; make images builds it locally after agent changes;
  • the address of the agent gateway for the agents in the nodes, BROKERIUM_DOCKER_AGENT_ENDPOINT: brokerium:8443 in the Docker installation. It defaults to BROKERIUM_AGENT_ENDPOINT, whose default host.docker.internal:8443 suits a server on the Docker host. BROKERIUM_AGENT_ENDPOINT itself is the address in the join commands for agents on other hosts.

Source: docs/guide/clusters.md at v0.3.2.

Apache®, Apache Kafka® and Kafka® are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries. Brokerium is not affiliated with, endorsed by, or sponsored by the Apache Software Foundation.