Google Cloud Storage Sink Connector for Confluent Cloud¶
If you are installing the connector locally for Confluent Platform, see Google Cloud Storage Sink Connector for Confluent Platform.
The Kafka Connect Google Cloud Storage (GCS) connector, currently available as a sink, allows you to export data from Apache Kafka® topics to GCS objects in various formats. Additionally, for certain data layouts, the GCS connector exports data by guaranteeing exactly-once delivery semantics to consumers of the GCS objects it produces.
The GCS connector is the counterpart of the S3 cloud storage sink connector in Google Cloud.
The Confluent Cloud Google Cloud Storage (GCS) sink connector provides the following features:
- Exactly Once Delivery: Records that are exported using a deterministic partitioner are delivered with exactly-once semantics regardless of the eventual consistency of GCS.
- Data Format with or without Schema: Out of the box, the connector supports writing data to GCS in Avro, JSON, and Bytes. Schema validation is disabled for JSON.
- Schema Evolution:
schema.compatibilityis set to
- Partitioner: The connector supports the
TimeBasedPartitionerclass based on the Kafka class
- Flush size:
flush.sizedefaults to 1000. For example, if you use the default setting of 1000 and your topic has six partitions, files start to be created in the storage bucket after more than 1000 records exist in each partition. Note that the default value of 1000 can be increased if needed.
Refer to Cloud connector limitations for additional information.
Use this quick start to get up and running with the Confluent Cloud GCS sink connector. The quick start provides the basics of selecting the connector and configuring it to stream events to a GCS bucket.
Authorized access to a Confluent Cloud cluster on GCP.
The Confluent Cloud CLI installed and configured for the cluster. See Install and Configure the Confluent Cloud CLI.
A GCP GCS bucket in the same region as your Confluent Cloud cluster.
Your GCP service account role must have permission to create new objects in the GCS bucket. For example, the Storage Admin role can be selected for this purpose. If you are concerned about security and do not want to use the Storage Admin role, only use the storage.objects.get and storage.objects.create roles. Also, note that the Storage Object Admin role does not work for this purpose.
Either one of the following to use for the Kafka cluster credentials fields:
- A Confluent Cloud API key and secret. After you have created your cluster, go to Cluster settings > API access > Create Key.
- A Confluent Cloud service account.
Step 1: Launch your Confluent Cloud cluster.¶
See the Confluent Cloud Quick Start for installation instructions.
Step 2: Add a connector.¶
Click Connectors > Add connector.
Step 3: Select your connector.¶
Click the Google Cloud Storage Sink connector icon.
Step 4: Enter the connector details.¶
Make sure you have all your prerequisites completed.
Complete the following and click Continue.
Enter a Connector Name.
Enter your Kafka Cluster credentials. The credentials are either the API key and secret or the service account API key and secret.
Enter one or more Topic names. Separate multiple topic names with a comma.
Step 5: Enter the destination details.¶
Complete the following and click Continue.
Your GCP credentials and bucket name are validated here. Make sure you enter these correctly.
Upload the JSON file you downloaded earlier. The downloaded JSON file contains your GCP service account credentials.
Enter the GCS bucket name.
Select the message format.
Select the Time interval that sets how you want your messages grouped in the GCS bucket. For example, if you select Hourly, messages are grouped into folders for each hour data is streamed to the bucket.
Enter the Flush size. This value defaults to 1000. For example, if you use the default setting of 1000 and your topic has six partitions, files start to be created in the storage bucket after more than 1000 records exist in each partition. Note that the default value of 1000 can be increased if needed.
Enter the number of tasks in use by the connector. Do not enter a value that exceeds the Max number displayed.
Step 6: Launch the connector.¶
Verify the following and click Launch.
Step 7: Check the connector status.¶
The status for the connector should go from Provisioning to Running.
Step 8: Check the GCS bucket.¶
Go to the the bucket Objects page for your GCS bucket.
Open your topic folder and each subsequent folder until you see your messages displayed.
For additional information about the GCS connector see Google Cloud Storage Sink Connector for Confluent Platform. Note that not all Confluent Platform GCS connector features are provided in the Confluent Cloud GCS connector.