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: articles/hdinsight/spark/apache-spark-intellij-tool-plugin.md
+28-24Lines changed: 28 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,11 @@
2
2
title: 'Azure Toolkit for IntelliJ: Create Spark applications for an HDInsight cluster '
3
3
description: Use the Azure Toolkit for IntelliJ to develop Spark applications written in Scala, and submit them to an HDInsight Spark cluster.
4
4
author: hrasheed-msft
5
+
ms.author: hrasheed
5
6
ms.reviewer: jasonh
6
7
ms.service: hdinsight
7
-
ms.custom: hdinsightactive
8
8
ms.topic: conceptual
9
-
ms.date: 02/15/2019
10
-
ms.author: maxluk
9
+
ms.date: 05/31/2019
11
10
---
12
11
# Use Azure Toolkit for IntelliJ to create Apache Spark applications for an HDInsight cluster
13
12
@@ -20,18 +19,20 @@ Use the Azure Toolkit for IntelliJ plug-in to develop [Apache Spark](https://spa
20
19
## Prerequisites
21
20
22
21
* An Apache Spark cluster on HDInsight. For instructions, see [Create Apache Spark clusters in Azure HDInsight](apache-spark-jupyter-spark-sql.md).
23
-
*[Oracle Java Development kit](https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). This tutorial uses Java version 8.0.202.
22
+
* Storage account name and key. See [Manage storage account settings in the Azure portal](../../storage/common/storage-account-manage.md).
23
+
*[Java Developer Kit (JDK) version 8](https://aka.ms/azure-jdks).
24
24
* IntelliJ IDEA. This article uses [IntelliJ IDEA Community ver. 2018.3.4](https://www.jetbrains.com/idea/download/).
25
25
* Azure Toolkit for IntelliJ. See [Installing the Azure Toolkit for IntelliJ](https://docs.microsoft.com/java/azure/intellij/azure-toolkit-for-intellij-installation?view=azure-java-stable).
26
26
* WINUTILS.EXE. See [Problems running Hadoop on Windows](https://wiki.apache.org/hadoop/WindowsProblems).
27
27
28
28
## Install Scala plugin for IntelliJ IDEA
29
+
29
30
Perform the following steps to install the Scala plugin:
30
31
31
32
1. Open IntelliJ IDEA.
32
33
33
34
2. On the welcome screen, navigate to **Configure** > **Plugins** to open the **Plugins** window.
3. Select **Install** for the Scala plugin that is featured in the new window.
@@ -40,7 +41,6 @@ Perform the following steps to install the Scala plugin:
40
41
41
42
4. After the plugin installs successfully, you must restart the IDE.
42
43
43
-
44
44
## Create a Spark Scala application for an HDInsight Spark cluster
45
45
46
46
1. Start IntelliJ IDEA, and select **Create New Project** to open the **New Project** window.
@@ -82,7 +82,7 @@ Perform the following steps to install the Scala plugin:
82
82
83
83
9. Add your application source code by doing the following:
84
84
85
-
a. From Project, navigate to **myApp** > **src** > **main** > **scala**.
85
+
a. From **Project**, navigate to **myApp** > **src** > **main** > **scala**.
86
86
87
87
b. Right-click **scala**, and then navigate to **New** > **Scala Class**.
88
88
@@ -115,6 +115,7 @@ Perform the following steps to install the Scala plugin:
115
115
The code reads the data from HVAC.csv (available on all HDInsight Spark clusters), retrieves the rows that have only one digit in the seventh column in the CSV file, and writes the output to `/HVACOut` under the default storage container for the cluster.
116
116
117
117
## Connect to your HDInsight cluster
118
+
118
119
User can either [sign in to Azure subscription](#sign-in-to-your-azure-subscription), or [link a HDInsight cluster](#link-a-cluster) using Ambari username/password or domain joined credential to connect to your HDInsight cluster.
119
120
120
121
### Sign in to your Azure subscription
@@ -123,9 +124,9 @@ User can either [sign in to Azure subscription](#sign-in-to-your-azure-subscript
123
124
124
125

125
126
126
-
2. From Azure Explorer, right-click the **Azure** node, and then select **Sign In**.
127
+
2. From **Azure Explorer**, right-click the **Azure** node, and then select **Sign In**.
127
128
128
-
3. In the **Azure Sign In** dialog box, select**Sign in**, and then enter your Azure credentials.
129
+
3. In the **Azure Sign In** dialog box, leave**Device Login** selected, and then select **Sign in**. Complete the sign in process.
129
130
130
131

131
132
@@ -142,11 +143,12 @@ User can either [sign in to Azure subscription](#sign-in-to-your-azure-subscript
You can link an HDInsight cluster by using the Apache Ambari managed username. Similarly, for a domain-joined HDInsight cluster, you can link by using the domain and username, such as [email protected]. Also you can link Livy Service cluster.
146
148
147
149
1. From the menu bar, navigate to **View** > **Tool Windows** > **Azure Explorer**.
148
150
149
-
2. From Azure Explorer, right-click the **HDInsight** node, and then select **Link A Cluster**.
151
+
2. From **Azure Explorer**, right-click the **HDInsight** node, and then select **Link A Cluster**.
4. You can see your linked cluster from the **HDInsight** node.
182
184
@@ -189,7 +191,7 @@ You can link an HDInsight cluster by using the Apache Ambari managed username. S
189
191
## Run a Spark Scala application on an HDInsight Spark cluster
190
192
After creating a Scala application, you can submit it to the cluster.
191
193
192
-
1. From Project, navigate to **myApp** > **src** > **main** > **scala** > **myApp**. Right-click **myApp**, and select **Submit Spark Application** (It will likely be located at the bottom of the list).
194
+
1. From **Project**, navigate to **myApp** > **src** > **main** > **scala** > **myApp**. Right-click **myApp**, and select **Submit Spark Application** (It will likely be located at the bottom of the list).
193
195
194
196

195
197
@@ -203,7 +205,7 @@ After creating a Scala application, you can submit it to the cluster.
203
205
|Select an Artifact to submit|Leave default setting.|
204
206
|Main class name|The default value is the main class from the selected file. You can change the class by selecting the ellipsis(**...**) and choosing another class.|
205
207
|Job configurations|You can change the default keys and/or values. For more information, see [Apache Livy REST API](https://livy.incubator.apache.org./docs/latest/rest-api.html).|
206
-
|Commandline arguments|You can enter arguments separated by space for the main class if needed.|
208
+
|Command-line arguments|You can enter arguments separated by space for the main class if needed.|
207
209
|Referenced Jars and Referenced Files|You can enter the paths for the referenced Jars and files if any. For more information: [Apache Spark Configuration](https://spark.apache.org/docs/latest/configuration.html#runtime-environment). See also, [How to upload resources to cluster](https://docs.microsoft.com/azure/storage/blobs/storage-quickstart-blobs-storage-explorer).|
208
210
|Job Upload Storage|Expand to reveal additional options.|
209
211
|Storage Type|Select **Use Azure Blob to upload** from the drop-down list.|
@@ -225,7 +227,7 @@ You can perform various operations by using Azure Toolkit for IntelliJ. Most of
225
227
226
228
### Access the job view
227
229
228
-
1. From Azure Explorer, navigate to **HDInsight** > \<Your Cluster> > **Jobs**.
230
+
1. From **Azure Explorer**, navigate to **HDInsight** > \<Your Cluster> > **Jobs**.
@@ -245,21 +247,21 @@ You can perform various operations by using Azure Toolkit for IntelliJ. Most of
245
247
246
248
### Access the Spark history server
247
249
248
-
1. From Azure Explorer, expand **HDInsight**, right-click your Spark cluster name, and then select **Open Spark History UI**.
250
+
1. From **Azure Explorer**, expand **HDInsight**, right-click your Spark cluster name, and then select **Open Spark History UI**.
249
251
2. When you're prompted, enter the cluster's admin credentials, which you specified when you set up the cluster.
250
252
251
253
3. On the Spark history server dashboard, you can use the application name to look for the application that you just finished running. In the preceding code, you set the application name by using `val conf = new SparkConf().setAppName("myApp")`. Therefore, your Spark application name is **myApp**.
252
254
253
255
### Start the Ambari portal
254
256
255
-
1. From Azure Explorer, expand **HDInsight**, right-click your Spark cluster name, and then select **Open Cluster Management Portal(Ambari)**.
257
+
1. From **Azure Explorer**, expand **HDInsight**, right-click your Spark cluster name, and then select **Open Cluster Management Portal(Ambari)**.
256
258
257
259
2. When you're prompted, enter the admin credentials for the cluster. You specified these credentials during the cluster setup process.
258
260
259
261
### Manage Azure subscriptions
260
262
By default, Azure Toolkit for IntelliJ lists the Spark clusters from all your Azure subscriptions. If necessary, you can specify the subscriptions that you want to access.
261
263
262
-
1. From Azure Explorer, right-click the **Azure** root node, and then select **Select Subscriptions**.
264
+
1. From **Azure Explorer**, right-click the **Azure** root node, and then select **Select Subscriptions**.
263
265
264
266
2. From the **Select Subscriptions** window, clear the check boxes next to the subscriptions that you don't want to access, and then select **Close**.
265
267
@@ -285,22 +287,24 @@ Ensure you have satisfied the WINUTILS.EXE prerequisite.
285
287
286
288

287
289
288
-
5. From Project, navigate to **myApp** > **src** > **main** > **scala** > **myApp**.
290
+
5. From **Project**, navigate to **myApp** > **src** > **main** > **scala** > **myApp**.
289
291
290
292
6. From the menu bar, navigate to **Tools** > **Spark Console** > **Run Spark Local Console(Scala)**.
291
293
292
-
7. Then two dialogs may be displayed to ask you if you want to auto fix dependencies. If so, select **Auto Fix**.
294
+
7. From the **Setting file system** dialog, select **Yes** to use a mocked file system.
295
+
296
+
8. Then two dialogs *may* be displayed to ask you if you want to auto fix dependencies. If so, select **Auto Fix**.
293
297
294
298

295
299
296
300

297
301
298
-
8. The console should look similar to the picture below. In the console window type `sc.appName`, and then press ctrl+Enter. The result will be shown. You can terminate the local console by clicking red button.
302
+
9. The console should look similar to the picture below. In the console window type `sc.appName`, and then press ctrl+Enter. The result will be shown. You can terminate the local console by clicking red button.
1. Save the changes. Your application should now be compatible with Azure Toolkit for IntelliJ. You can test it by right-clicking the project name in Project. The pop-up menu now has the option **Submit Spark Application to HDInsight**.
353
+
1. Save the changes. Your application should now be compatible with Azure Toolkit for IntelliJ. You can test it by right-clicking the project name in **Project**. The pop-up menu now has the option **Submit Spark Application to HDInsight**.
0 commit comments