Azure HDInsight 之初体验 (Windows PC)
2017/01/23
前提步骤
- 下载并安装 Azure SDK
- 在cmd界面输入
azure help
,确保安装成功 - 输入
azure config mode arm
,更改模式 - 输入
azure login
,通过https://aka.ms/devicelogin,登陆Azure账号 - 输入
azure resource list
得到资源列表
- 在cmd界面输入
- 在Azure Portal创建 HDInsight Cluster (需要20分钟左右)
- 选择合适的虚机大小
- 配置相应的storage, resource group
- 配置用户名及密码
- 下载并安装 PuTTy, 利用ssh远程登陆
- 输入
ls /
- 输入
hdfs dfs -ls /exapmle/data
, 可以观察到示例文件
- 输入
简单操作
- 上传本地txt文件
- 在cmd界面继续输入
azure storage account connectionstring show [your storage] -g [your resource group]
SET AZURE_STORAGE_CONNCTION_STRING=[your connection string showed]
azure storage blob upload [file location]
- 在PuTTy界面观察
hdfs dfs -ls /data
hdfs dfs -text /data/[file.txt]
- 在cmd界面继续输入
运行MapReduce jobs
- count word
- 远程界面
ls /usr/hdp/current/hadoop-mapreduce-client
hadoop jar /usr/hdp/current/hadoop-mapreduce-client/hadoop-mapreduce-examples.jar
hadoop jar /usr/hdp/current/hadoop-mapreduce-client/hadoop-mapreduce-examples.jar wordcount /data/test.txt /data/results
hdfs dfs -ls /data/results
hdfs dfs -text /data/results/par-r-00000
- 下载运行结果(cmd界面)
azure storage blob download [your container name] [file location]
- 远程界面
(待续)