Got it

HBase Thrift API Invoking Example

Latest reply: May 9, 2022 14:07:41 386 2 2 0 0

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:

  1. Obtain the configuration file for interconnecting with the cluster.

  2. Obtain and authenticate authentication information.

  3. HBase Thrift Interface Access and Operations


Procedure for Invoking the Windows Environment Sample

  1. Prepare the environment. For details, see the first lesson.

  2. The difference between the time and the cluster time cannot exceed 5 minutes.

  3. Check whether the C:\Windows\System32\drivers\etc\hosts file contains the domain name and IP address mapping information of all cluster nodes.

  4. 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.

  5. 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.

  6. Place core-site.xml, hbase-site.xml, and hdfs-site.xml in the hbase directory on the client to the resources/conf directory.

  7. 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.

  8. Add configuration items to the end of the hbase-site.xml file based on the appendix.

  9. Right-click the resources directory and choose Mark Directory as > Resources Root from the shortcut menu.

  10. Modify the authentication user name and cluster IP address in the code.

  11. Open the TestMain.java file and right-click Run to start the sample code.


Debugging Procedure in the Linux Environment

  1. Completing the Windows Environment Sample Call Procedure.

  2. Check whether the time difference between the Linux environment and the cluster is less than or equal to 5 minutes.

  3. Check whether the JDK version in the Linux environment is 1.8.

  4. Check whether the /etc/hosts file in the Linux environment contains the domain name and IP address mapping information of all cluster nodes.

  5. Create a sample execution path, for example, /opt/hbase_thrift_test.

  6. 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.

  7. Upload the conf directory in the resources directory of the sample project to /opt/hbase_thrift_test.

  8. Use the plug-in to generate the dependency directory lib in the IDEA and upload it to /opt/hbase_thrift_test.

  9. 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!


  • x
  • convention:

olive.zhao
Admin Created Aug 23, 2021 08:45:12

Thanks for your sharing!
View more
  • x
  • convention:

Vien
Created May 9, 2022 14:07:41

Good share
View more
  • x
  • convention:

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.
Information Protection Guide
Thanks for using Huawei Enterprise Support Community! We will help you learn how we collect, use, store and share your personal information and the rights you have in accordance with Privacy Policy and User Agreement.