Skip to content

Latest commit

 

History

History
79 lines (53 loc) · 3.95 KB

apache-hbase-phoenix-squirrel-linux.md

File metadata and controls

79 lines (53 loc) · 3.95 KB
title description services author ms.reviewer ms.service ms.custom ms.topic ms.date ms.author
Use Apache Phoenix and SQLLine with HBase in Azure HDInsight
Learn how to use Apache Phoenix in HDInsight. Also, learn how to install and set up SQLLine on your computer to connect to an HBase cluster in HDInsight.
hdinsight
hrasheed-msft
jasonh
hdinsight
hdinsightactive
conceptual
01/03/2018
hrasheed

Use Apache Phoenix with Linux-based Apache HBase clusters in HDInsight

Learn how to use Apache Phoenix in Azure HDInsight, and how to use SQLLine. For more information about Phoenix, see Phoenix in 15 minutes or less. For the Phoenix grammar, see Phoenix grammar.

Note

For Phoenix version information about HDInsight, see What's new in the Hadoop cluster versions provided by HDInsight.

Use SQLLine

SQLLine is a command-line utility to execute SQL.

Prerequisites

Before you can use SQLLine, you must have the following items:

When you connect to an HBase cluster, you need to connect to one of the Apache ZooKeeper VMs. Each HDInsight cluster has three ZooKeeper VMs.

To get the ZooKeeper host name

  1. Open Apache Ambari by browsing to https://<cluster name>.azurehdinsight.net.
  2. To sign in, enter the HTTP (cluster) user name and password.
  3. In the left menu, select ZooKeeper. Three ZooKeeper Server instances are listed.
  4. 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

  1. Connect to the cluster by using SSH. For more information, see Use SSH with HDInsight.

  2. In SSH, use the following commands to run SQLLine:

     cd /usr/hdp/2.2.9.1-7/phoenix/bin
     ./sqlline.py <ZOOKEEPER SERVER FQDN>:2181:/hbase-unsecure
    
  3. 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
    

For more information, see the SQLLine manual and Apache Phoenix grammar.

Next steps

In this article, you learned how to use Apache Phoenix in HDInsight. To learn more, see these articles: