How to connect to a Cluster for Apache Kafka®
You can use different frameworks to connect to your Cluster for Apache Kafka®, and integrate it with your applications.
All clients that want to connect to your cluster must:
- Have downloaded the cluster's TLS certificate and configured the client to recognize it
- Be attached to a Private Network in the same VPC as the cluster, or connect via a Public Gateway in the VPC
- Know the cluster's username and password
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- A Cluster for Apache Kafka®
How to download the TLS certificate
-
Click Apache Kafka® in the Data and Analytics section of the console side menu. A list of your clusters displays.
-
Click the cluster you want to connect to. Its Overview page displays.
-
In the Connectivity panel, click Download next to the TLS certificate.
The TLS certificate in .pem
format is downloaded to your local device. If using Java, import it into a truststore and configure your client.properties
appropriately. For other types of client (e.g. Python, Go, CLI), you may be able to use the certificate directly by setting its location in your Kafka consumer configuration code.
How to ensure clients have network access
Any clients wanting to connect to the cluster must be attached to a Private Network in the same VPC as the cluster.
How to access the username and password
The username and password for a Cluster for Apache Kafka® are defined when creating the cluster. During Private Beta, only one user can be created per cluster. The username cannot be modified after creation, but the password can be changed at any time.
If you need a reminder of the username after creating the cluster, follow the steps below. You cannot view the password you set, but you can change it to a new one.
-
Click Apache Kafka® in the Data and Analytics section of the console side menu. A list of your clusters displays.
-
Click the cluster you want to connect to. Its Overview page displays.
-
Click the Users tab.
The username displays in the list of users. Click Change password if you have forgotten the password and need to change it to a new one.
How to connect to the cluster
Once you have ensured that the client in question has the cluster's TLS certificate, appropriate network access and the correct username and password, you can facilitate connection via the Kafka-compatible framework of your choice. Code snippets are provided for Go, Python and Java; access them by following the steps below.
-
Click Apache Kafka® in the Data and Analytics section of the console side menu. A list of your clusters displays.
-
Click the cluster you want to connect to. Its Overview page displays.
-
In the Connectivity panel, click Connect.
A pop-up displays, with tabs for each sample framework: Go, Python, Java, Node.js, and Mongoose.
-
Click the tab of your choice to view the code sample.