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