Kafka - Getting started
Find out how to set up and manage your Public Cloud Databases for Kafka
Find out how to set up and manage your Public Cloud Databases for Kafka
Last updated 5th January 2022
Apache Kafka is an open-source and highly resilient event streaming platform based on 3 main capabilities:
You can get more information on Kafka from the official Kafka website{.external).
This guide explains how to successfully configure Public Cloud Databases for Kafka via the OVHcloud Control Panel.
Log in to your OVHcloud Control Panel and switch to Public Cloud
in the top navigation bar. After selecting your Public Cloud project, click on Databases
in the left-hand navigation bar under Storage.
Click the Create a database instance
button. (Create a service
if your project already contains databases.)
Click on the type of database you want to use and then select the version to install from the respective drop-down menu. Click Next
to continue.
In this step, choose an appropriate service plan. If needed, you will be able to upgrade the plan after creation.
Please visit the capabilities page of your selected database type for detailed information on each plan's properties.
Click Next
to continue.
Choose the geographical region of the datacenter where your service will be hosted.
Click Next
to continue.
You can increase the number of nodes and choose the node template in this step. The minimum and maximum amount of nodes depends on the solution chosen in step 2.
Please visit the capabilities page of your selected database type for detailed information on hardware resources and other properties of the database installation.
Take note of the pricing information and click Next
to continue.
You can name your database in this step and decide to attach a public or private network. Please note that attaching a private network is a feature not yet available at this time.
The final section will display a summary of your order as well as the API equivalent of creating this database instance with the OVHcloud API.
In a matter of minutes, your new Apache Kafka service will be deployed. Messages in the OVHcloud Control Panel will inform you when the streaming tool is ready to use.
Once the Public Cloud Databases for Kafka service is up and running, you will have to define at least one user and one authorised IP in order to fully connect to the service (as producer or consumer).
The General information
tab should inform you to create users and authorized IPs.
Switch to the Users
tab. An admin user is preconfigured during the service installation. You can add more users by clicking the Add user
button.
Enter a username, then click Create User
.
Once the user is created, the password is generated. Please keep it securely as it will not be shown again.
Passwords can be reset for the admin user or changed afterwards for other users in the Users
tab.
For security reasons the default network configuration doesn't allow any incoming connections. It is thus critical to authorize the suitable IP addresses in order to successfully access your Kafka cluster.
Switch to the Authorized IPs
tab. At least one IP address must be authorised here before you can connect to your database.
It can be your laptop IP for example.
Clicking on Add an IP address or IP address block (CIDR)
opens a new window in which you can add single IP addresses or blocks to allow access to the database.
You can edit and remove database access via the ...
button in the IP table.
If you don't know how to get your IP, please visit a website like www.WhatismyIP.com. Copy the IP address shown on this website and keep it for later.
Your Apache Kafka service is now fully accessible!
Optionally, you can configure access control lists (ACL) for granular permissions and create something called topics, as shown below.
Topics can be seen as categories, allowing you to organize your Kafka records. Producers write to topics, and consumers read from topics.
To create Kafka topics, click on the Add a topic
button:
In advanced configuration you can change the default value for the following parameters:
Public Cloud Databases for Kafka supports access control lists (ACLs) to manage permissions on topics. This approach allows you to limit the operations that are available to specific connections and to restrict access to certain data sets, which improves the security of your data.
By default the admin user has access to all topics with admin privileges. You can define some additional ACLs for all users / topics, click on Add a new entry
button:
For a particular user, and one topic (or all with '*'), define the ACL with the the following permissions:
Note: Write permission allows the service user to create new indexes that match the pattern, but it does not allow deletion of those indexes.
When multiple rules match, they are applied in the order listed above. If no rules match, access is denied.
Verify that the IP address visible from your browser application is part of the "Authorised IPs" defined for this Kafka service.
Check also that the user has granted ACLs for the target topics.
In order to connect to the Apache Kafka service, it is required to use server and user certificates.
The server CA (Certificate Authority) certificate can be downloaded from the General information tab:
The user certificate can be downloaded from the Users tab:
Also download the user access key.
As part of the Apache Kafka official installation, you will get different scripts that will also allow you to connect to Kafka in a Java 8+ environment: Apache Kafka Official Quickstart.
We propose to use a generic producer and consumer client instead: Kcat (formerly known as kafkacat). Kcat is more lightweight since it does not require a JVM.
For this client installation, please follow the instructions available at: Kafkacat Official Github.
Let's create a configuration file to simplify the CLI commands to act as Kafka Producer and Consumer:
kafkacat.conf :
bootstrap.servers=kafka-f411d2ae-f411d2ae.database.cloud.ovh.net:20186
enable.ssl.certificate.verification=false
ssl.ca.location=/home/user/kafkacat/ca.pem
security.protocol=ssl
ssl.key.location=/home/user/kafkacat/service.key
ssl.certificate.location=/home/user/kafkacat/service.cert
In our example, the cluster address and port are kafka-f411d2ae-f411d2ae.database.cloud.ovh.net:20186 and the previously downloaded CA certificates are in the /home/user/kafkacat/ folder.
Change theses values according to your own configuration.
For this first example let's push the "test-message-key" and its "test-message-content" to the "my-topic" topic.
echo test-message-content | kcat -F kafkacat.conf -P -t my-topic -k test-message-key
Note: depending on the installed binary, the CLI command can be either kcat or kafkacat.
The data can be retrieved from "my-topic".
kcat -F kafkacat.conf -C -t my-topic -o -1 -e
Note: depending on the installed binary, the CLI command can be either kcat or kafkacat.
Congratulations, you now have an up and running Apache Kafka cluster, fully managed and secured. You are able to push and retrieve data easily via CLI.
Some UI tools for Kafka are also available:
Visit the Github examples repository to find how to connect to your database with several languages.
Visit our dedicated Discord channel: https://discord.gg/ovhcloud. Ask questions, provide feedback and interact directly with the team that builds our databases services.
Please feel free to give any suggestions in order to improve this documentation.
Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.
Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.
Thank you. Your feedback has been received.
Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.
Discuss with the OVHcloud community