Configuring and Importing Sample Projects
Scenario
To execute sample codes of CQL, perform the following operations:
Application programs 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 Obtaining Sample Projects from Huawei Mirrors.
- Copy the user.keytab and krb5.conf files obtained in the Preparing a Developer Account section and 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 example 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.
- Choose Open.
- 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.
- Modify the parameter names of userPrincipal and keytabPath in the setSecurityConfs method in the CQLExample class of the com.huawei.streaming.example.cql package of the sample program.
String userPrincipal = "developuser@HADOOP.COM"; String keytabPath = confDir + "user.keytab";
Linux Environment
- Initialize client environment variables.
Access the installation directory, and run the following command to import environment variables:
source bigdata_env
- Use the development user created in Preparing a Developer Account section to execute kinit for secure login.
kinit user name
For example, run the following command:
kinit developuser
Enter a password as prompted. If no error message appears, kerberos authentication is completed for the user.
- Access Storm/streaming-cql-1.0/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.