brokers with broker IDs as keys and hostnames as valuesthreshold with the value 2filtered_brokers that includes only brokers with IDs greater than thresholdfiltered_brokers dictionarybrokers with broker IDs as keys and hostnames as valuesthreshold with the value 2filtered_brokers that includes only brokers with IDs greater than thresholdfiltered_brokers dictionarybrokers with these exact entries: 1: 'broker1.example.com', 2: 'broker2.example.com', 3: 'broker3.example.com', 4: 'broker4.example.com'Use curly braces {} to create a dictionary with integer keys and string values.
threshold and set it to 2Just assign the number 2 to the variable threshold.
filtered_brokers that includes only the brokers from brokers where the broker ID is greater than threshold. Use a dictionary comprehension with broker_id and hostname as variables.Use a dictionary comprehension with for broker_id, hostname in brokers.items() and an if condition.
print statement to display the filtered_brokers dictionaryUse print(filtered_brokers) to show the result.
What is the primary role of a broker node in Kafka?
Which of the following is the correct way to specify a broker's unique ID in the Kafka server.properties file?
broker.id with a dot separator.broker.id=1 matches Kafka's expected syntax.Given the following snippet from a Kafka server.properties file:
broker.id=2 listeners=PLAINTEXT://localhost:9093 log.dirs=/tmp/kafka-logs-2
What will be the broker's ID and listening port when Kafka starts?
broker.id=2 sets the broker ID to 2.listeners=PLAINTEXT://localhost:9093 means the broker listens on port 9093.Consider this server.properties snippet:
broker.id=abc listeners=PLAINTEXT://localhost:9092
What is the issue when starting Kafka with this configuration?
broker.id to be an integer number.broker.id=abc is invalid and causes startup error.You want to run three Kafka broker nodes on the same machine for testing. Which configuration change is essential for each broker to avoid conflicts?
broker.id to identify it in the cluster.Pass the test and this pattern moves unknown