1) RHadoop安装
下载RHadoop相关的2个程序包:
https://github.com/RevolutionAnalytics/RHadoop/wiki/Downloads
rmr-3.3.1
rhdfs-1.0.8
安装依赖库:
安装上面的两个库之前,我们需要先安装这两个库的依赖库。
首先是rJava,由于我们已经配置好JDK1.8的环境,运行R CMD javareconf命令,R的程序从系统变量中会读取Java配置。然后打开R程序,通过install.packages的方式,安装rJava。
然后,我们还要安装其他的几个依赖库,reshape2,Rcpp,iterators,itertools,digest,RJSONIO,functional,通过install.packages都直接安装。
命令行执行
[Command005]:
R CMD javareconf
[Command006]:
R
启动R程序
[Command007]:
install.packages(“rJava”)
[Command008]:
install.packages(“reshape2”)
[Command009]:
install.packages(“Rcpp”)
[Command010]:
install.packages(“iterators”)
[Command011]:
install.packages(“itertools”)
[Command012]:
install.packages(“digest”)
[Command013]:
install.packages(“RJSONIO”)
[Command014]:
install.packages(“functional”)
[Command015]:
install.packages(“caTools”)
配置rhdfs库:
hadoop-streaming-<version>.jar下载地址:
http://www.java2s.com/Code/Jar/h/Downloadhadoopstreaming210betajar.htm
然后在hadoop目录下建contrib文件夹,并在它文件夹下建立streaming文件夹,最后把hadoop-streaming-<version>.jar放在/contrib/streaming/
文件夹下。
例如我用的路径:
/home/hyxy/project/hadoop-2.7.3/contrib/streaming/hadoop-streaming-2.1.0-beta.jar
把HADOOP_CMD和HADOOP_STREAMING设置到环境变量
[Command016]:
vi ~/.bashrc
exportHADOOP_CMD=/home/hyxy/project/hadoop-2.7.3/bin/hadoop
exportHADOOP_STREAMING=/home/hyxy/project/hadoop-2.7.3/contrib/streaming/ hadoop-streaming-2.1.0-beta.jar
[Command017]:
source ~/.bashrc
修改/etc/Hadoop/yarn-site.xml
[Code001]:
<property>
<name>yarn.scheduler.maximum-allocation-mb </name>
<value>9216</value>
</property>
<property>
<name>yarn.scheduler.minimum-allocation-mb</name>
<value>4000</value>
</property>
<property>
<name>yarn.nodemanager.vmem-pmem-ratio</name>
<value>4.1</value>
</property>
安装rmr库和rhdfs库:
[Command 018]:
R CMD INSTALL rmr2_3.3.1.tar.gz
[Command018]:
R CMD INSTALL rhdfs_1.0.8.tar.gz