如何调整和固化Azure HDInsight相关参数
2015-11-02 15:59
253 查看
如何调整和固化相关参数
前面提到,有些参数可以在创建集群时指定,这样在集群做ReImage 时这些参数还是会生效而不会改回为默认值。但有些参数,比如之前提到的关于Topology结构的参数,在创建集群的时候是不能指定的,这就需要人为去调整这些参数。
一种办法是RDP到NameNode,直接修改相关参数后再重启相应的服务。但这种做法最大的问题是当HDInsight 做ReImage 后这些参数会恢复为原来值。
如何固化这些参数?可以借助HDInsight 的Script Action 的功能来实现:
1.准备一个PowerShell 脚本: HDConfigureChange.ps1, 如下所示:
2.将该PowerShell 脚本上传到存储账号的一个Container,
这个Container要设置为Public blob Access (允许对该Blob 进行只读访问)
3.在创建HDInsight 的脚本中增加下面的代码,在创建HDInsight 集群时会执行该段脚本。
前面提到,有些参数可以在创建集群时指定,这样在集群做ReImage 时这些参数还是会生效而不会改回为默认值。但有些参数,比如之前提到的关于Topology结构的参数,在创建集群的时候是不能指定的,这就需要人为去调整这些参数。
一种办法是RDP到NameNode,直接修改相关参数后再重启相应的服务。但这种做法最大的问题是当HDInsight 做ReImage 后这些参数会恢复为原来值。
如何固化这些参数?可以借助HDInsight 的Script Action 的功能来实现:
1.准备一个PowerShell 脚本: HDConfigureChange.ps1, 如下所示:
param () # Download config action module from a well-known directory. $CONFIGACTIONURI = "https://hdiconfigactions.blob.core.windows.net/configactionmodulev05/HDInsightUtilities-v05.psm1"; $CONFIGACTIONMODULE = "C:\apps\dist\HDInsightUtilities.psm1"; $webclient = New-Object System.Net.WebClient; $webclient.DownloadFile($CONFIGACTIONURI, $CONFIGACTIONMODULE); # (TIP) Import config action helper method module to make writing config action easy. if (Test-Path ($CONFIGACTIONMODULE)) { Import-Module $CONFIGACTIONMODULE; } else { Write-Output "Failed to load HDInsightUtilities module, exiting ..."; exit; } #Loading Core-site.xml file $coreSiteConfigFileLocation = "$env:HADOOP_HOME\etc\hadoop\core-site.xml"; [xml]$configFile = Get-Content $coreSiteConfigFileLocation #Looking up for the property file. $existingproperty = $configFile.configuration.property | where {$_.Name -eq "topology.script.file.name"} if ($existingproperty) { $existingproperty.Value = "" } else { Write-Host "Config Not Found" exit } #Saving Core-site.xml file after changes. $configFile.Save($coreSiteConfigFileLocation) #Restarting all running services $services = Get-HDIServicesRunning foreach ($service in $services) { Restart-Service $service.Name }
2.将该PowerShell 脚本上传到存储账号的一个Container,
这个Container要设置为Public blob Access (允许对该Blob 进行只读访问)
3.在创建HDInsight 的脚本中增加下面的代码,在创建HDInsight 集群时会执行该段脚本。
$config = Add-AzureHDInsightScriptAction -Config $config –Name TestScriptAction1 –Uri "https://publicstorage.blob.core.windows.net/hdconfig/HDConfigureChange.ps1" -ClusterRoleCollection HeadNode
相关文章推荐
- C++各种头文件及其函数
- 安卓&android工程逆向记录
- 首页功能管理
- How can I disable/modify the SSH login banner for a given user?
- Oracle数据库查询高效分页
- Remix OS——一个很有魅力的Android系统
- Unix目录结构的来历
- PowerShell入门(序):为什么需要PowerShell?
- cocos2d-x改底层之动态改变UIListView中的某项在链表中的位置
- Java使用TCP聊天程序
- ViewPager中fragment切换动作实现
- Android adb input 命令介绍
- 51nod 1119 机器人走方格 V2 (求组合数__模板)
- android开发必用工具集合
- MATLAB 循环移位序列,二进制的按位循环右移/左移
- 树-------完全二叉树结点数
- tomcat启动的内存溢出解决
- 金字塔和重采样的解析
- linux挂载共享文件夹
- html5页面平滑切换实现以及问题(20160120更新)