Connect with Aiven for Apache Kafka® cluster using SSL protocol
Aiven for Apache Kafka is a fully managed distributed data streaming platform, deployable in the cloud of your choice. This section provides information on connecting Aiven for Apache Kafka cluster with Klaw using SSL authentication protocol.
Prerequisite
- Set up the connection between the Klaw APIs (Klaw Core API and Klaw Cluster
API), see
klaw-core-with-clusterapi
. This involves configuring theklaw.clusterapi.url
setting in the Klaw UI and testing the connectivity to ensure the two APIs can communicate. - A running Aiven for Apache Kafka service. See Getting started with Aiven for Apache Kafka for more information.
- Configured Java keystore and truststore containing the service SSL certificates to access Apache Kafka.
Configure and connect using SSL protocol
Follow the steps below to configure and connect to an Aiven for Apache Kafka and Klaw using SSL protocol:
-
In the Klaw web interface, navigate to Environments, and click Clusters.
-
On the Clusters page, click Add Cluster.
-
On the Add Kafka cluster page, enter the following details:
- Cluster Type: Select Kafka from the drop-down list
- Cluster Name: Provide a name for the cluster
- Protocol: Select SSL protocol for your cluster
- Kafka Flavor: Select Aiven for Apache Kafka as the flavor
- Project Name: Select the project name defined in the Aiven Console
- Bootstrap server: Enter the Service URI for your Apache Kafka service. You can find the service URI in the Connection information page of your service in Aiven Console.
- Service Name: Enter the name of the service as defined in the Aiven Console for your Apache Kafka service
-
Click Save.
-
Add the cluster to the preferred environment. Click Environments from the Environments drop-down menu.
-
Click Add Environment and enter the details to add your Apache Kafka environment.
-
Enter an environment name, select the added cluster from the drop-down list, and configure partitions, replication factor, and tenant (set to default).
-
Copy the Cluster ID from the Clusters page using the copy icon that is available on the right-hand side of each cluster row.
-
Open the
application.properties
file located in theklaw/cluster-api/src/main/resources
directory. -
Configure the SSL properties to connect to Aiven for Apache Kafka clusters by copying and editing the following lines.
clusterid.kafkassl.keystore.location=client.keystore.p12
clusterid.kafkassl.keystore.pwd=klaw1234
clusterid.kafkassl.key.pwd=klaw1234
clusterid.kafkassl.truststore.location=client.truststore.jks
clusterid.kafkassl.truststore.pwd=klaw1234
clusterid.kafkassl.keystore.type=pkcs12
clusterid.kafkassl.truststore.type=JKSIt is possible to configure JKS, PKCS12 and PEM certificate types.
- For the lines starting with
clusterid
, replaceclusterid
with the Klaw cluster ID. - Replace
client.keystore.p12
with the path for the keystore andklaw1234
with the password configured for the keystore file. - Replace
client.truststore.jks
with the path for the truststore andklaw1234
with the password configured for the truststore file. - Save the
application.properties
file.
The following is an example of an application.properties file configured with Klaw cluster ID:
demo_cluster.kafkassl.keystore.location=/Users/demo.user/Documents/Klaw/demo-certs/client.keystore.p12
demo_cluster.kafkassl.keystore.pwd=Aiventest123!
demo_cluster.kafkassl.key.pwd=Aiventest123!
demo_cluster.kafkassl.truststore.location=/Users/demo.user/Documents/Klaw/demo-certs/client.truststore.jks
demo_cluster.kafkassl.truststore.pwd=Aiventest123!
demo_cluster.kafkassl.keystore.type=pkcs12
demo_cluster.kafkassl.truststore.type=JK - For the lines starting with
-
To enable ACL authorization, copy the Authorization token from Aiven Console and configure
klaw.clusters.accesstoken
with the copied authorization token. -
Re-deploy the Klaw Cluster API with the updated configuration. This will apply the changes and enable Klaw to connect to Aiven for Apache Kafka cluster using SSL protocol.