Hello everyone,
I believe you can learn how to deal with HBase Thrift API Invoking Example from my case.
Sample Background
Assume that a user develops an application and uses a common thrift interface to invoke HBase. The operations involved in the code sample are as follows:
Obtain the configuration file for interconnecting with the cluster.
Obtain and authenticate authentication information.
HBase Thrift Interface Access and Operations
Procedure for Invoking the Windows Environment Sample
Prepare the environment. For details, see the first lesson.
The difference between the time and the cluster time cannot exceed 5 minutes.
Check whether the C:\Windows\System32\drivers\etc\hosts file contains the domain name and IP address mapping information of all cluster nodes.
Open the hbase-thrift-example directory in the sample code of the IDEA. By default, the dependency is automatically downloaded. If the directory is not downloaded, right-click the pom.xml file in the directory and choose Add As Maven Project. Wait until the project automatically downloads the dependency.
Download the user authentication credentials from Manager, decompress the user.keytab and krb5.conf files, and save the two files to the resources/conf directory of the project.
Place core-site.xml, hbase-site.xml, and hdfs-site.xml in the hbase directory on the client to the resources/conf directory.
Modify the hbase.thrift.security.qop parameter of the HBase cluster instance. The value of this parameter corresponds to that of hbase.rpc.protection.
The privacy(auth-conf)/authentication(auth)/integrity(auth-int) file takes effect.
Add configuration items to the end of the hbase-site.xml file based on the appendix.
Right-click the resources directory and choose Mark Directory as > Resources Root from the shortcut menu.
Modify the authentication user name and cluster IP address in the code.
Open the TestMain.java file and right-click Run to start the sample code.
Debugging Procedure in the Linux Environment
Completing the Windows Environment Sample Call Procedure.
Check whether the time difference between the Linux environment and the cluster is less than or equal to 5 minutes.
Check whether the JDK version in the Linux environment is 1.8.
Check whether the /etc/hosts file in the Linux environment contains the domain name and IP address mapping information of all cluster nodes.
Create a sample execution path, for example, /opt/hbase_thrift_test.
Upload the hbase-thrift-example-2.2.3-hw-ei-302002.jar package in the target directory generated in the Windows environment to the /opt/hbase_thrift_test directory.
Upload the conf directory in the resources directory of the sample project to /opt/hbase_thrift_test.
Use the plug-in to generate the dependency directory lib in the IDEA and upload it to /opt/hbase_thrift_test.
Run the following command to verify the sample code running in the Linux environment:
java -cp /opt/hbase_thrift_test/:/opt/hbase_thrift_test/lib/*:/opt/hbase_thrift_test/hbase-thrift-example-2.2.3-hw-ei-302002.jar com.huawei.bigdata.hbase.examples.TestMain
I hope it is helpful to you!