Commissioning a Spring Boot Application
Scenario
After the application code is developed, compile the code in the Windows environment to generate a JAR package. The JAR package can be debugged in the local Windows environment or deployed in the Linux environment for debugging. If the local host can communicate with the cluster service plane network, you can debug the application on the local host.
Notes and Constraints
For MRS 3.6.0-LTS.1 or later: The hetu-rest-client-example sample code can run only on JDK 17 and JDK 21.
This section applies only to MRS 3.6.0-LTS or later.
Procedure
- Configure the properties required for connecting the Spring Boot sample program to HetuEngine. Set the following parameters in the springboot\hetu-examples\src\main\resources\application.yml configuration file:
Table 1 Configuring HetuEngine Parameter
Mandatory
Description
host
Yes
HS Fabric address list of the HetuEngine service. The format is HSFabric_IP1:HSFabric_Port,HSFabric_IP2:HSFabric_Port,HSFabric_IP3:HSFabric_Port.
Log in to FusionInsight Manager, choose Cluster > Services > HetuEngine > Instances, and obtain the service IP addresses of all HSFabric instances. In the Configurations tab, search for gateway.port to obtain the HSFabric port.
catalog
Yes
Catalog name of the HetuEngine compute instance
schema
Yes
Schema name of the HetuEngine compute instance
user
Yes
Username for connecting to the HetuEngine compute instance
password
Yes
Password for connecting to the HetuEngine compute instance
Leave this parameter empty for a cluster in normal mode.
ssl
Yes
Whether to use SSL to connect to the HetuEngine compute instance
- For a cluster in security mode, set this parameter to true.
- For a cluster in normal mode, set this parameter to false.
tenant
Yes
Queue used for task execution.
- Click Terminal on the lower left part of the IDEA page to access the terminal. Run the following command to compile the file: mvn clean packageFigure 1 Compile command
If "BUILD SUCCESS" is displayed, the compilation is successful. A JAR package containing the hetu-rest-client-example field is generated in the target directory of the sample project.
Figure 2 Successful compilation
- Create a directory in the system as the run directory to save the JAR package that contains the hetu-rest-client-example field generated in 2.
- Create a directory on Windows, for example, D:\hetu-rest-client-example.
- Create a directory on Linux, for example, /opt/hetu-rest-client-example.
- Run the following command to start the SpringBoot service:
- Commands for Windows:
Open the Command Prompt window as an administrator.
Run the d: command.
cd hetu-rest-client-example
java -jar hetu-rest-client-example-*-SNAPSHOT.jar
- If the package is compiled using JDK in Windows, use the JDK of the corresponding version to run the package in Linux.
- To specify the JDK 17 to run the sample code, run the following command: Client installation path/JDK17/jdk/bin/java -classpath hetu-rest-client-example-*.jar.
- To specify the JDK 21 to run the sample code, run the following command: Client installation path/JDK21/jdk/bin/java -classpath hetu-rest-client-example-*.jar.
The preceding JAR package names are for reference only. Use the actual names.
- Commands for Windows:
- Call a Spring Boot sample API of HetuEngine to run the sample code.
- For the Windows environment:
Open a browser and enter http://localhost:8080/hetu/example/executesql in the address box.
- For the Linux environment:
Run the curl http://localhost:8080/hetu/example/executesql command on the node where the JAR package is stored in 3.
- For the Windows environment:
- View the query result of the SQL statement used in the sample code. Figure 3 Query results
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot