如何遷移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.