Managed Kafka

Run an Apache Kafka cluster for event streaming and data pipelines, without servers to look after. We take care of provisioning, broker recovery and patch updates, and every connection uses TLS and SASL authentication.

Create a Kafka cluster

  1. Go to Databases and click Create database.
  2. Select Kafka.
  3. Enter a Name. It must be unique in your organization.
  4. Select the Data center your servers run in. See Regions.
  5. Select a Plan.
  6. Under Nodes, keep 3 brokers. The broker count can't change later.
  7. Turn on Allow public access if clients outside your private networks connect to the cluster.
  8. Click Create database.

The cluster is ready when its status reads Running.

Create database form with Kafka selected

Plans

Plan vCPU and RAM per broker Storage per broker Partitions
KA1 4 vCPU, 4 GB 64 GB 250
KA2 8 vCPU, 8 GB 128 GB 500
KA3 8 vCPU, 32 GB 192 GB 2,000
KA4 16 vCPU, 64 GB 256 GB 4,000
KA5 32 vCPU, 120 GB 512 GB 8,000
KA6 48 vCPU, 160 GB 768 GB 10,000
KA7 64 vCPU, 192 GB 1,024 GB 12,000
KA8 128 vCPU, 480 GB 1,536 GB 30,000

Every broker holds a full copy of every partition, so the storage and partition figures apply to each broker and to the whole cluster at once. Every broker bills at the plan's price. Traffic over private networks, replication between brokers included, is free. Consumer traffic over public access counts as internet egress. See Pricing philosophy for its price.

Connect to your cluster

Open the cluster and find the Bootstrap servers, the default user, its password and the CA certificate under Connection. Save the certificate as betterstack-db-ca.pem. Clients connect with SASLSSL and the SCRAM-SHA-512 mechanism. Certificates are issued by the Better Stack Managed CA, which isn't in system trust stores, so pass the CA certificate to your client. Set the bootstrap servers as `KAFKABOOTSTRAPand the password asKAFKA_PASSWORD`, or paste them into the Java properties:

kcat and librdkafka Java client
kcat -b "$KAFKA_BOOTSTRAP" -X security.protocol=SASL_SSL \
     -X sasl.mechanism=SCRAM-SHA-512 \
     -X sasl.username=default -X sasl.password="$KAFKA_PASSWORD" \
     -X ssl.ca.location=betterstack-db-ca.pem -L
bootstrap.servers=<bootstrap servers>
security.protocol=SASL_SSL
sasl.mechanism=SCRAM-SHA-512
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
  username="default" password="<password>";
ssl.truststore.type=PEM
ssl.truststore.location=betterstack-db-ca.pem

A new cluster is reachable only from the private networks attached to it, on port 9092. There's no plain or unauthenticated listener.

Allow public access adds a public endpoint on port 9095, with its own bootstrap and broker hostnames. Use the public endpoint from the internet and the private one from your private networks. Credentials and the CA certificate are the same for both. Restrict who can connect with a firewall that allows TCP port 9095.

Client connects but can't produce or fetch?

Kafka clients use the bootstrap servers once, then connect to every broker directly at its own hostname. Make sure your network rules let clients reach every broker, not only the bootstrap address.

Rotate credentials

To replace the default user's password:

  1. Click Rotate credentials on the cluster page.
  2. Click Rotate credentials to confirm.

The old password stops working for new connections right away, while open connections stay up, so update your clients promptly.

Topics and users

The default user can produce to and consume from every topic. Brokers don't create topics automatically, and clients can't create them. Create a topic on the cluster's page: under Topics, click Create topic. Under Users, click Create user for users with their own per-topic Privileges. The API can create topics and users too. So topics that Kafka Streams and similar libraries would create on their own, such as -changelog and -repartition topics, must exist before the application starts.

Consumer group offsets are kept for 7 days without activity.

Brokers and replication

With 3 brokers, every partition has three copies, and a write with acks=all needs two of them. So the cluster keeps running with one broker down. Partition leadership moves within seconds and producers using acks=all keep succeeding. Rolling updates and rescales don't interrupt clients. Run production on 3 brokers.

A broker that stops responding is repaired automatically. We restart it first, and if it's still down after 15 minutes we replace its machine. It keeps its hostname and copies every partition back from the other brokers. The cluster reads Degraded until the copy catches up. Your clients keep working throughout.

1 broker is for development and testing. Restarts for updates and rescales interrupt service, and there's only one copy of your data. If that broker can't be restarted, the cluster stays Degraded and we can't rebuild it without losing data, so contact us.

Snapshots

Kafka clusters don't have snapshots. Replication across brokers and topic retention keep your data, and removing a cluster deletes its data for good. To survive the loss of a whole cluster, replicate to a second cluster from your application.

Rescale and storage

To change the plan:

  1. Click Rescale on the cluster page.
  2. Select a Plan and click Rescale database.

With 3 brokers, brokers resize one at a time and clients aren't interrupted. You can move to a smaller plan only if your topics' storage and partitions fit it.

The cluster turns Degraded when a broker's disk passes 90% of the plan's storage. Above 95%, creating and growing topics is refused until usage drops, so rescale to a bigger plan before the disk gets there.

Updates

We apply Kafka patch releases automatically as rolling restarts, one broker at a time. A 3-broker cluster stays available, while a 1-broker cluster is interrupted for each restart.

Need help?

Please let us know at hello@betterstack.com.
We're happy to help! 🙏