Use Apache Phoenix with Linux-based HBase clusters in HDInsight
For Phoenix version information about HDInsight, see What's new in the Hadoop cluster versions provided by HDInsight.
SQLLine is a command-line utility to execute SQL.
Before you can use SQLLine, you must have the following items:
- An HBase cluster in HDInsight. To create one, see Get started with Apache HBase in HDInsight.
When you connect to an HBase cluster, you need to connect to one of the ZooKeeper VMs. Each HDInsight cluster has three ZooKeeper VMs.
To get the ZooKeeper host name
- Open Ambari by browsing to https://<cluster name>.azurehdinsight.net.
- To sign in, enter the HTTP (cluster) user name and password.
- In the left menu, select ZooKeeper. Three ZooKeeper Server instances are listed.
- Select one of the ZooKeeper Server instances. On the Summary pane, find the Hostname. It looks similar to zk1-jdolehb.3lnng4rcvp5uzokyktxs4a5dhd.bx.internal.cloudapp.net.
To use SQLLine
Connect to the cluster by using SSH. For more information, see Use SSH with HDInsight.
In SSH, use the following commands to run SQLLine:
cd /usr/hdp/126.96.36.199-7/phoenix/bin ./sqlline.py <ZOOKEEPER SERVER FQDN>:2181:/hbase-unsecure
To create an HBase table, and insert some data, run the following commands:
CREATE TABLE Company (COMPANY_ID INTEGER PRIMARY KEY, NAME VARCHAR(225)); !tables UPSERT INTO Company VALUES(1, 'Microsoft'); SELECT * FROM Company; !quit
In this article, you learned how to use Apache Phoenix in HDInsight. To learn more, see these articles:
- HDInsight HBase overview. HBase is an Apache, open-source, NoSQL database built on Hadoop that provides random access and strong consistency for large amounts of unstructured and semistructured data.
- Provision HBase clusters on Azure Virtual Network. With virtual network integration, HBase clusters can be deployed to the same virtual network as your applications, so applications can communicate directly with HBase.
- Configure HBase replication in HDInsight. Learn how to set up HBase replication across two Azure datacenters.