Configuring and Importing Sample Projects
Scenario
To execute sample codes of CQL, perform the following operations:
Applications can be submitted through the Windows or Linux environment during application development.
Windows Environment
- Obtain the sample project folder cql-examples in the src\storm-examples directory where the sample code is decompressed. For details, see Configuring Huawei Open-Source Mirrors.
- Copy the cluster configuration file obtained in section Preparing an Operating Environment to the cql-examples\src\main\resources directory of the sample project.
- After installing the IntelliJ IDEA and JDK, configure the JDK in the IntelliJ IDEA.
- Start IntelliJ IDEA and choose Configure.
Figure 1 Quick Start
- Choose Project Defaults > Project Structure from the drop-down list box.
Figure 2 Configure
- On the Project Structure for New Projects page that is displayed, select SDKs and click the plus sign (+) to add JDK.
Figure 3 Project Structure for New Projects
- In the displayed Select Home Directory for JDK window, select the JDK directory, and click OK.
Figure 4 Select Home Directory for JDK
- After selecting the JDK, click OK to complete the configuration.
Figure 5 Completing the JDK configuration
- Start IntelliJ IDEA and choose Configure.
- Import the sample project into the IntelliJ IDEA development environment.
- Choose Open.
- The dialog box for browsing directories is displayed.
- Select the sample project directory and click OK.
- Set the IntelliJ IDEA text file coding format to prevent invalid characters.
- On the IntelliJ IDEA menu bar, choose File > Settings.
The Settings window is displayed.
- Choose Editor > File Encodings in the navigation tree. In the Project Encoding area and Global Encoding area, set the parameter to UTF-8, click Apply, and then click OK, as shown in Figure 6.
- On the IntelliJ IDEA menu bar, choose File > Settings.
- Add the configuration information such as the address of the open-source image repository to the setting.xml configuration file of the local Maven by referring to Configuring Huawei Open-Source Mirrors.
When using the IntelliJ IDEA development tool, you can choose File > Settings > Build, Execution, Deployment > Build Tools > Maven to view the directory where the settings.xml file is stored. Ensure that the directory is <Local Maven installation directory>\conf\settings.xml.Figure 7 Directory for storing the settings.xml file
Linux Environment
- Initialize client environment variables.
Access the installation directory /opt/client/, and run the following command to import environment variables:
source bigdata_env
- Access Storm/streaming-cql-*/bin in the installation directory and run the following command:
./cql
If information about the currently running application is found and no error occurs after you run the following command, the commands are successfully run.
[root@host1 bin]# ./cql End CQL with ';' and end client with 'exit;' Streaming>show applications; applicationName Status Num_workers Uptime_secs Streaming>
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.