Skip to content

Commit 7b53e72

Browse files
authored
Merge pull request #90352 from dagiro/devops3c
devops3c
2 parents 0658e4c + af5c38c commit 7b53e72

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

articles/hdinsight/kafka/apache-kafka-streams-api.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: 'Tutorial: Use the Apache Kafka Streams API - Azure HDInsight '
33
description: Tutorial - Learn how to use the Apache Kafka Streams API with Kafka on HDInsight. This API enables you to perform stream processing between topics in Kafka.
4-
ms.service: hdinsight
54
author: hrasheed-msft
65
ms.author: hrasheed
76
ms.reviewer: jasonh
7+
ms.service: hdinsight
88
ms.custom: hdinsightactive
99
ms.topic: tutorial
10-
ms.date: 06/25/2019
10+
ms.date: 10/08/2019
1111
#Customer intent: As a developer, I need to create an application that uses the Kafka streams API with Kafka on HDInsight
1212
---
1313

@@ -57,9 +57,9 @@ The important things to understand in the `pom.xml` file are:
5757
```xml
5858
<!-- Kafka client for producer/consumer operations -->
5959
<dependency>
60-
<groupId>org.apache.kafka</groupId>
61-
<artifactId>kafka-clients</artifactId>
62-
<version>${kafka.version}</version>
60+
<groupId>org.apache.kafka</groupId>
61+
<artifactId>kafka-clients</artifactId>
62+
<version>${kafka.version}</version>
6363
</dependency>
6464
```
6565

@@ -68,7 +68,7 @@ The important things to understand in the `pom.xml` file are:
6868
* Plugins: Maven plugins provide various capabilities. In this project, the following plugins are used:
6969

7070
* `maven-compiler-plugin`: Used to set the Java version used by the project to 8. Java 8 is required by HDInsight 3.6.
71-
* `maven-shade-plugin`: Used to generate an uber jar that contains this application as well as any dependencies. It is also used to set the entry point of the application, so that you can directly run the Jar file without having to specify the main class.
71+
* `maven-shade-plugin`: Used to generate an uber jar that contains this application as well as any dependencies. It's also used to set the entry point of the application, so that you can directly run the Jar file without having to specify the main class.
7272

7373
### Stream.java
7474

@@ -155,32 +155,31 @@ To build and deploy the project to your Kafka on HDInsight cluster, use the foll
155155
sudo apt -y install jq
156156
```
157157
158-
3. Set up environment variables. Replace `PASSWORD` and `CLUSTERNAME` with the cluster login password and cluster name respectively, then enter the command:
158+
3. Set up password variable. Replace `PASSWORD` with the cluster login password, then enter the command:
159159
160160
```bash
161161
export password='PASSWORD'
162-
export clusterNameA='CLUSTERNAME'
163162
```
164163
165-
4. Extract correctly cased cluster name. The actual casing of the cluster name may be different than you expect, depending on how the cluster was created. This command will obtain the actual casing, store it in a variable, and then display the correctly cased name, and the name you provided earlier. Enter the following command:
166-
164+
4. Extract correctly cased cluster name. The actual casing of the cluster name may be different than you expect, depending on how the cluster was created. This command will obtain the actual casing, and then store it in a variable. Enter the following command:
167165
```bash
168-
export clusterName=$(curl -u admin:$password -sS -G "https://$clusterNameA.azurehdinsight.net/api/v1/clusters" \
169-
| jq -r '.items[].Clusters.cluster_name')
170-
echo $clusterName, $clusterNameA
166+
export clusterName=$(curl -u admin:$password -sS -G "http://headnodehost:8080/api/v1/clusters" | jq -r '.items[].Clusters.cluster_name')
171167
```
172168
169+
> [!Note]
170+
> If you're doing this process from outside the cluster, there is a different procedure for storing the cluster name. Get the cluster name in lower case from the Azure portal. Then, substitute the cluster name for `<clustername>` in the following command and execute it: `export clusterName='<clustername>'`.
171+
173172
5. To get the Kafka broker hosts and the Apache Zookeeper hosts, use the following commands. When prompted, enter the password for the cluster login (admin) account. You are prompted for the password twice.
174173
175174
```bash
176-
export KAFKAZKHOSTS=`curl -sS -u admin:$password -G \
177-
https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/ZOOKEEPER/components/ZOOKEEPER_SERVER \
178-
| jq -r '["\(.host_components[].HostRoles.host_name):2181"] | join(",")' | cut -d',' -f1,2`;
179-
export KAFKABROKERS=`curl -sS -u admin:$password -G \
180-
https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/KAFKA/components/KAFKA_BROKER \
181-
| jq -r '["\(.host_components[].HostRoles.host_name):9092"] | join(",")' | cut -d',' -f1,2`;
175+
export KAFKAZKHOSTS=$(curl -sS -u admin:$password -G https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/ZOOKEEPER/components/ZOOKEEPER_SERVER | jq -r '["\(.host_components[].HostRoles.host_name):2181"] | join(",")' | cut -d',' -f1,2);
176+
177+
export KAFKABROKERS=$(curl -sS -u admin:$password -G https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/KAFKA/components/KAFKA_BROKER | jq -r '["\(.host_components[].HostRoles.host_name):9092"] | join(",")' | cut -d',' -f1,2);
182178
```
183179
180+
> [!Note]
181+
> These commands require Ambari access. If your cluster is behind an NSG, run these commands from a machine that can access Ambari.
182+
184183
6. To create the topics used by the streaming operation, use the following commands:
185184
186185
> [!NOTE]
@@ -227,7 +226,7 @@ To build and deploy the project to your Kafka on HDInsight cluster, use the foll
227226
The `--property` parameters tell the console consumer to print the key (word) along with the count (value). This parameter also configures the deserializer to use when reading these values from Kafka.
228227
229228
The output is similar to the following text:
230-
229+
231230
dwarfs 13635
232231
ago 13664
233232
snow 13636
@@ -269,4 +268,4 @@ To remove the resource group using the Azure portal:
269268
In this document, you learned how to use the Apache Kafka Streams API with Kafka on HDInsight. Use the following to learn more about working with Kafka.
270269
271270
> [!div class="nextstepaction"]
272-
> [Analyze Apache Kafka logs](apache-kafka-log-analytics-operations-management.md)
271+
> [Analyze Apache Kafka logs](apache-kafka-log-analytics-operations-management.md)

0 commit comments

Comments
 (0)