You can use Thrift to enable multi-language access to ApsaraDB for HBase Performance-enhanced Edition clusters.


The endpoint of your cluster is obtained. For more information, see View cluster endpoints.

Background information

  • The Thrift 1 interface does not support permission authentication. It supports a maximum of 1,000 connections per core node.
  • Thrift 2 allows you to access ApsaraDB for HBase Performance-enhanced Edition clusters only by using HTTPClient. You must specify the username and the password.
  • For more information about how to use Thrift, see the official documentation of Apache Thrift.


  1. Download the Thrift installation package.
    Note Some programming languages provide methods to manage dependencies. You can install Thrift based on these programming languages. For example, you can run the pip install thrift command to install Thrift for Python, or directly add import {""} to the Go code.
  2. Download the Thrift 2 definition file of ApsaraDB for HBase.
  3. Generate the interface definition file for the specified programming language.
    1. Decompress the thrift-0.12.0.tar package that is downloaded in Step 1. For more information, see Thrift installation guide.
    2. Run a command to open the extracted thrift-0.12.0 file and run the following command to generate an interface definition file:
       thrift --gen <language> Hbase.thrift
      thrift --gen php Hbase.thrift 
      thrift --gen cpp Hbase.thrift 
      thrift --gen py Hbase.thrift 
  4. Initialize a client to access an ApsaraDB for HBase Performance-enhanced Edition cluster.
    • The transport layer of the Thrift server for ApsaraDB for HBase Performance-enhanced Edition uses HTTP. Therefore, the ThttpClient in Thrift is required when you initialize the client. If an access control list (ACL) is enabled, two headers must be added to the ThttpClient to transmit the username and the password to the server for authentication.
    • Thrift provides functions that allow you to customize headers in ThttpClients that are developed by using different programming languages.
    The following example shows how to use Python to initialize a client and configure the connection string, the username, and the password.
    # -*- coding: utf-8  -*-
    # Run the pip install thrift command to obtain the following modules:
    from thrift.protocol import TBinaryProtocol
    from thrift.transport import THttpClient
    # Run the thrift --gen py hbase.thrift command to generate the following modules:
    from hbase import THBaseService
    from hbase.ttypes import TColumnValue, TColumn, TTableName, TTableDescriptor, TColumnFamilyDescriptor, TNamespaceDescriptor, TGet, TPut, TScan
    # Configure the connection string.
    url = "http://host:9190"
    transport = THttpClient.THttpClient(url)
    headers = {}
    # Specify the username.
    # Specify the password.
    protocol = TBinaryProtocol.TBinaryProtocolAccelerated(transport)
    client = THBaseService.Client(protocol)
    # After you connect to the cluster and perform necessary operations, close the connection.


The demo code for different programming languages is uploaded to GitHub. The code includes the Thrift definition files and the dependencies that are supported by specific programming languages. You can directly download programming language-specific code to initialize clients from GitHub to access ApsaraDB for HBase Performance-enhanced Edition clusters.