This topic describes how to use a Java client to access an ApsaraDB for HBase Standard Edition cluster.
Prerequisites
- If you connect to an ApsaraDB for HBase Standard Edition cluster over an internal
network, make sure that an Elastic Compute Service (ECS) instance is purchased. This
ECS instance must be deployed in the same virtual private cloud (VPC) as the cluster.
The IP address of the ECS instance must be added to the whitelist of the cluster.
- For more information about how to purchase an ECS instance, see Create an ECS instance.
- For more information about how to configure an IP address whitelist for an ApsaraDB for HBase Standard Edition cluster, see Configure a whitelist.
- If you connect to an ApsaraDB for HBase Standard Edition cluster over the Internet,
you must first use ApsaraDB for HBase SDK for Java to create a client. For more information
about how to download the SDK, see Download ApsaraDB for HBase SDK for Java.
Make sure that an IP address whitelist is configured to allow access to the ApsaraDB for HBase Standard Edition cluster. For more information, see Configure a whitelist.
Background information
- To connect to an ApsaraDB for HBase Standard Edition cluster, you can use the client provided by HBase Community Edition or use ApsaraDB for HBase SDK for Java to create a client.
- If you do not have the required JAR file in your runtime environment, you must add
the following configuration to your Maven project. This ensures that the JAR file
contains the dependencies that are required by the HBase client.
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <artifactSet> </artifactSet> </configuration> </execution> </executions> </plugin> </plugins> </build>
Procedure
What to do next
You can also download the Java code-based project provided by Alibaba Cloud. In the Java code, replace the value of zkAddress with the ZooKeeper endpoints of your ApsaraDB for HBase Standard Edition cluster. Then, you can use this code to access the cluster.