Updated on 2024-08-12 GMT+08:00

Configuring and Importing Sample Projects

Background

The Storm development example project is included in the Storm client installation directory. Import the project to IntelliJ IDEA for learning.

Prerequisites

Ensure that the difference between the local PC time and the cluster time is less than 5 minutes. If the time difference cannot be determined, contact the system administrator. You can view the cluster time in the lower-right corner on FusionInsight Manager.

Procedure

  1. Obtain the sample project folder storm-examples in the src\storm-examples directory where the sample code is decompressed. For details, see Obtaining the MRS Application Development Sample Project.
  2. Copy the files user.keytab and krb5.conf files obtained in Preparing a Developer Account section and the cluster configuration file obtained in section Preparing an Operating Environment to the storm-examples\src\main\resources directory of the sample project.

    • To submit a topology when no client is installed in Windows or Linux, you need to place both streaming-site.xml and storm.yaml in the storm-examples\src\main\resources directory of the sample project.
    • To submit a topology when the client is installed in Linux, you only need to place streaming-site.xml in the storm-examples\src\main\resources directory of the sample project.

  3. After installing the IntelliJ IDEA and JDK tools, configure JDK in IntelliJ IDEA.

    1. Open IntelliJ IDEA and click Configure.
      Figure 1 Quick Start
    2. Choose Project Defaults > Project Structure.
      Figure 2 Configure

    3. In the displayed Project Structure for New Projects interface, click SDKs. Then click the plus sign (+) and choose JDK.
      Figure 3 Project Structure for New Projects
    4. In the displayed Select Home Directory for JDK interface, select the JDK directory, and click OK.
      Figure 4 Select Home Directory for JDK
    5. Click OK.
      Figure 5 Completing the JDK configuration

  4. In the application development environment, import the sample project to the IntelliJ IDEA development environment.

    1. Configure the IntelliJ IDEA Maven project environment.

      Choose File > Settings and search for Maven. Configure the Maven project, and choose Apply > OK.

      Figure 6 Configuring the IntelliJ IDEA Maven project environment
    2. Choose File > New > Project from Existing Sources…. .
      Figure 7 The Project from Existing Sources.... page is displayed
    3. Select the sample project to be imported, for example, storm-examples.
      Figure 8 Selecting the sample project to be imported
    4. Import the project as a Maven project.
      Figure 9 Importing the project as a Maven project.

  5. Set the IntelliJ IDEA text file coding format to prevent garbled characters.

    1. On the IntelliJ IDEA menu bar, choose File > Settings.

      The Settings window is displayed.

    2. In the navigation tree, choose Editor > File Encodings. In the Project Encoding area and Global Encoding area, set the value to UTF-8, click Apply, and click OK, as shown in Figure 10.
      Figure 10 Setting the IntelliJ IDEA encoding format