Compiling and Running an Application When No Client Is Installed
Scenario
In a Linux environment where no HBase client is installed, you can upload the JAR package to the Linux and then run an application after the code development is complete.
Prerequisites
- A JDK has been installed in the Linux environment. The version of the JDK must be consistent with that of the JDK used by the JAR package exported by IntelliJ IDEA.
- If the Linux host is not a node in the cluster, set the mapping between the host name and the IP address in the hosts file on the node. The host name and IP address must be in one-to-one mapping.
Procedure
- Export a JAR package. For details, see 1 in section Compiling and Running an Application When a Client Is Installed.
- Prepare for the required JAR packages and configuration files.
- In the Linux environment, create a directory, for example, /opt/test, and create subdirectories lib and conf. Export the JAR package that the sample project depends on. For details about how to export the JAR package, see 2 in 1.4.2.1 Compiling and Running an Application When a Client Is Installed. Upload this JAR file and that exported in 1 to the lib directory on the Linux server. Upload the conf configuration file and authentication file in the sample project to the conf directory on Linux.
- In /opt/test, create the run.sh script, modify the following content, and save the file:
#!/bin/sh BASEDIR=`cd $(dirname $0);pwd` cd ${BASEDIR} for file in ${BASEDIR}/lib/*.jar do i_cp=$i_cp:$file echo "$file" done for file in ${BASEDIR}/conf/* do i_cp=$i_cp:$file done java -cp .${i_cp} com.huawei.bigdata.hbase.examples.TestMain
In the preceding content, com.huawei.bigdata.hbase.examples.TestMain is used as an example.
- Go to /opt/test and run the following commands to run the JAR packages:
sh run.sh
Feedback
Was this page helpful?
Provide feedbackThank 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