At Vectorized, operational simplicity and a good developer experience (DX) are two of our major goals.
rpk was born because of that: you shouldn’t need to be a Linux expert to configure the machine where Redpanda will run. You shouldn’t need magic shell scripts to do basic stuff such as querying a topic’s health.
We’ve been there, and we know it sucks.
We also think you shouldn’t need to follow long guides to get started (and yes, we’re working to make our onboarding guide even shorter and simpler!). A single command should do the trick.
Today I’m very happy to introduce
rpk container, a group of
rpk commands that will allow developers to deploy local multi-node Redpanda clusters in an instant!
rpk container uses the official Redpanda image to spin up a local containerized cluster.
The best thing, though, is that this feature is also available for Mac users!
If you haven’t done so yet, follow the installation instructions for Linux or MacOS so you can follow along.
It’s important to note, however, that you won’t need to interact with Docker directly or have experience with it.
To get started, run
rpk container start -n 3. This will start a 3-node cluster. You should see something like this (the addresses may vary):
rpk container startwill take a minute the first time you run it, since it will download the latest stable version of Redpanda. The next time you run it it should be quicker.
$ rpk container start -n 3Starting clusterWaiting for the cluster to be ready...NODE ID ADDRESS0 127.0.0.1:652791 127.0.0.1:652872 127.0.0.1:65286Cluster started! You may use rpk to interact with it. E.g:rpk cluster info
It says we can check our cluster with
rpk cluster info. Let’s try that!
When you run
rpk commands, you need to include the list of brokers to run the command against.
In our example that would be:
$ rpk cluster info --brokers 127.0.0.1:65279,127.0.0.1:65287,127.0.0.1:65286BROKERS=======ID HOST PORT0* 127.0.0.1 652791 127.0.0.1 652872 127.0.0.1 65286
For example, you can run
rpk topic create and it will work!
$ rpk topic create -p 6 -r 3 new-topic --brokers 127.0.0.1:65279,127.0.0.1:65287,127.0.0.1:65286Created topic 'new-topic'. Partitions: 6, replicas: 3, cleanup policy: 'delete'
Now verify that the topic was created with
rpk topic list:
$ rpk topic list --brokers 127.0.0.1:65279,127.0.0.1:65287,127.0.0.1:65286Name Partitions Replicasnew-topic 6 3
Check our previous blog post on Getting Started with Redpanda to learn more about
To stop a cluster, run
rpk container stop:
$ rpk container stopStopping node 2Stopping node 0Stopping node 1
And you can restart it by running
rpk container start again.
$ rpk container startWaiting for the cluster to be ready...Found an existing cluster:NODE ID ADDRESS2 127.0.0.1:435510 127.0.0.1:378931 127.0.0.1:46027To change the number of nodes, first purge the existing cluster:rpk container purge
Finally, if you wanna wipe out all the cluster data and configuration, you can use
rpk container purge.
$ rpk container purgeStopping node 0Stopping node 2Stopping node 1Deleted cluster data.
It’s worth also mentioning that Redpanda’s API is Kafka®-compatible, so you can point your existing code or Kafka® client to the local cluster’s addresses and keep hacking. You don’t need to change your existing code, deploy Zookeeper, craft complex docker-compose files or maintain obscure bash scripts.
Announcing the official
vectorized/redpanda Docker image
The ideal way to run a database such as Redpanda is as a “standalone” process. You can achieve that by deploying each Redpanda broker on a different machine, and using the systemd units included in our pre-built packages for Debian and RHEL systems to achieve as much isolation as possible (i.e. by running
sudo systemctl start redpanda). This also guarantees you will get the best results out of
rpk redpanda tune.
However, we know that’s not always possible. In a world where Docker & Kubernetes have become the standard, we need to provide the tools for you to be able to get the best out of Redpanda, no matter how you choose to deploy it.
So thanks to everyone in our Community Slack workspace who shared their interest in running Redpanda in a container; Roko, our Head of Solutions Engineering who gathered all the feedback; and Dimitris, who has been hard at work to enable the continuous release of new Redpanda Docker Images, I’m glad to say there’s now an official
vectorized/redpanda Docker image that you can try today.
This is the image used by
rpk container behind the curtains, so if you followed the brief guide above, you already have it. If you don’t, you can pull it by running
docker pull vectorized/redpanda.
It works out of the box, so if you wanna start a single broker you can run
docker run -ti -p 9092:9092 vectorized/redpanda and start using it right away. However, for dev environments
rpk container start is the recommended way.
rpk container and our official Docker image will help you deploy Redpanda more easily both locally and to production, and that they will help you be more productive and focus on writing code that matters.
If you have any feedback regarding this post,
rpk, or Redpanda, or if you just wanna chat, join us on Slack!