利用 Azure HDInsight 預覽 HBase Cluster 做為 Azure Blobs 上的 NoSQL 資料庫

首先,小編先來帶大家複習一下 TechDays Taiwan 2013 蘇國鈞老師主講的「打開窗,讓大象跨進來 - Microsoft HDInsight」課程。

https://channel9.msdn.com/Events/TechDays/Techdays-Taiwan-2013/WAD303

本課程將說明以往僅存在於 Linux 世界中的 Apache Hadoop 以及 MapReduce、HDFS 等重要家族成員,是如何變身成為 HDInsight,並融入 Windows 作業系統中,執行既有的 Hadoop 功能。另外也將介紹 HDInsight on Azure,協助大家了解 Hadoop 飛上 Azure 後帶來的方便性,以及 HDInsight 如何整合 Microsoft SQL Server 與其他成員,提供完整的 Big Data 解決方案。


接下來就是今天要分享給大家的新消息啦~~~

原文發表於  Azure HDInsight previewing HBase clusters as a NoSQL database on Azure Blobs  (原始發佈於 Microsoft Azure 中文部落格 )

2014 年 6 月 3 日,Azure HDInsight 公開了一項更新消息,Azure HDInsight 將支援 Hadoop 2.4,並提升查詢資料的效能 100 倍。而今天,我們宣佈在 HDInsight 產品中,開始預覽 Apache HBase Cluster。

HBase 是一個低延遲的 NoSQL 資料庫,適合用來做大數據的線上交易處理(OLTP, online transactional processing)。我們在 Azure 中提供 HBase Cluster,而叢集的資料直接儲存於 Azure Blob 之中,如此一來便能在成本及效能的考量上,取得最大的存取效能以及擴充彈性。這個產品讓我們的客戶能擁有一個大型資料庫來建立高互動性的網站、或是儲存從百萬個感測器回傳的遙測資料等等,並且能在 Hadoop 中分析這些資料。

如何建立 HBase Cluster

由於目前 Azure HDInsight 上的 HBase 還在預覽階段,所以操作上需要利用 PowerShell。

  1. 安裝為 Azure 環境優化的 PowerShell
  2. 按照文章步驟設定環境
  3. 利用下列指令將認證資料存在變數中:
    PS C:\> $creds = Get-Credential
  4. 建立 HBase Cluster(可根據需求修改資料中心位置,以及修改 Blob 帳號的資料):
    PS C:\> New-AzureHDInsightCluster -Name yourclustername -ClusterType HBase -Version 3.0 -Location "West US" -DefaultStorageAccountName yourstorageaccount.blob.core.windows.net -DefaultStorageAccountKey "yourstorageaccountkey"  -DefaultStorageContainerName hbasecontainername -Credential $creds -ClusterSizeInNodes 4

在 HBase Cluster 中操作資料

應用程式開發人員可以透過 REST APIs 、HBase shell 或是不同的 map/reduce 工具如 Hive 及 Pig 來存取 HBase 的資料,HBase shell 提供了一個互動式的主控台(console)讓您可以管理 HBase Cluster、建立或刪除資料表(table)、以及操作資料。

  1. 要使用 HBase shell,首先您必須開啟建立的 HBase Cluster 的遠端桌面連線(RDP)來連上它。
    在 Cluster 建立完成時,你可以在 Azure 管理介面上 設定(CONFIGURATION) 的頁面中,在最下方按下 ENABLE REMOTE 的按鈕來開啟 RDP,最後可以利用 CONNECT 按鈕來進行連線。

  2. 連結進叢集後,按下桌面上 Hadoop command prompt 的捷徑,然後輸入下列指令來開啟 HBase shell:

     cd %HBASE_HOME%\bin
    hbase shell
    
  3. 下面的指令則是建立一個範例資料表,並且加入一列資料、以及列出資料表的所有資料:

     create ‘sampletable’, ‘cf1′
    put ‘sampletable’, ‘row1′, ‘cf1:col1′, ‘value1′
    scan ‘sampletable’
    

如果您想瞭解更多關於 Azure HDInsight 上的 HBase,下面是一些參考資料: