如何遷移HDInsight Hive Table到Azure SQL Database

如何遷移HDInsight Hive Table到Azure SQL Database

在我寫的博客裏提到過如何Load TXT 到HDInsight Hive table https://blog.csdn.net/weixin_44953126/article/details/102254360

那麼如何把Hive table遷移到Azure SQL Database呢?遷移到Azure SQL Database後,你就可以把它當作Onprem SQL來處理了。

如何遷移?你可以用Azure Data Factory來實現:

1, 創建ADF V2.
2, 創建Hive Database Linked Server, 輸入主機名,端口號,還有用戶名和密碼。

在這裏插入圖片描述

3, 創建dataset, hivetest爲你的HDInsight Hive Database, hiveexample爲Hive table。

0: jdbc:hive2://headnodehost:10001/> select * from hiveexample;
+-------------------+-----------------+------------------+--+
| hiveexample.name  | hiveexample.id  | hiveexample.sex  |
+-------------------+-----------------+------------------+--+
| linlin            | 123             | male             |
| brian             | 345             | male             |
| lin               | 567             | female           |
+-------------------+-----------------+------------------+--+

HDInsight的table hiveexample.

在這裏插入圖片描述

Note: 可以用同樣的辦法創建Azure SQL Database Dataset.

在這裏插入圖片描述
hivetable爲Azure Sql Database的表。

在這裏插入圖片描述
如何創建Azure Sql Database: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-single-database-get-started?tabs=azure-portal

4, 創建pipeline, source.

在這裏插入圖片描述

Sink:

在這裏插入圖片描述

Mapping:

在這裏插入圖片描述

5, 運行pipeline:

在這裏插入圖片描述
6, pipeline 運行成功後,我們可以看到Hive table裏的數據成功move到Azure Sql Database.

在這裏插入圖片描述

在這裏插入圖片描述

發佈了13 篇原創文章 · 獲贊 0 · 訪問量 967
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章