You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/content/docs/connectors/datastream/kafka.md
+19
Original file line number
Diff line number
Diff line change
@@ -465,6 +465,25 @@ client dependencies in the job JAR, so you may need to rewrite it with the actua
465
465
For detailed explanations of security configurations, please refer to
466
466
<ahref="https://kafka.apache.org/documentation/#security">the "Security" section in Apache Kafka documentation</a>.
467
467
468
+
## Kafka Rack Awareness
469
+
470
+
Kafka rack awareness allows Flink to select and control the cloud region and availability zone that Kafka consumers read from, based on the Rack ID. This feature reduces network costs and latency since it allows consumers to connect to the closest Kafka brokers, possibly colocated in the same cloud region and availability zone.
471
+
A client's rack is indicated using the `client.rack` config, and should correspond to a broker's `broker.rack` config.
setRackIdSupplier() is the Builder method allows us to determine the consumer's rack. If provided, the Supplier will be run when the consumer is set up on the Task Manager, and the consumer's `client.rack` configuration will be set to the value.
478
+
479
+
One of the ways this can be implemented is by making setRackId equal to an environment variable within your taskManager, for instance:
Copy file name to clipboardexpand all lines: flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/reader/KafkaPartitionSplitReader.java
+23
Original file line number
Diff line number
Diff line change
@@ -80,11 +80,20 @@ public KafkaPartitionSplitReader(
Copy file name to clipboardexpand all lines: flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/source/reader/KafkaPartitionSplitReaderTest.java
Copy file name to clipboardexpand all lines: flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/source/reader/KafkaSourceReaderTest.java
0 commit comments