搭建环境redhat6.4
1>.配置jdk1.6
2>.安装配置hadoop-1.2.1
3>.安装配置mahout0.9
1.下载mahout0.9 下载地址 http://archive.apache.org/dist/mahout/0.9/
2.用ssh等工具上传mahout-distribution-0.9.tar.gz 到/usr/local目录下
3. 解压
tar -zxvf mahout-distribution-0.9.tar.gz
重命名
mv mahout-distribution-0.9 mahout
4.修改配置文件
vi /etc/profile
添加
export HADOOP_CONF_DIR=/usr/local/hadoop
export MAHOUT_HOME=/usr/local/mahout
export MAHOUT_HOME=/usr/local/mahout/conf
PATH=.:$PATH:$MAHOUT_HOME/conf:$PATH:$MAHOUT_HOME/bin
使其生效
source /etc/profile
5.检查
a. myhout --help 看是否列出了一些算法
b. 下载一个文件synthetic_control.data,下载地址http://archive.ics.uci.edu/ml/databases/synthetic_control/synthetic_control.data,并把这个文件放在$MAHOUT_HOME目录下(该文件的位置可以任意放)。
启动Hadoop:$HADOOP_HOME/bin/start-all.sh
创建测试目录testdata,并把数据导入到这个tastdata目录中(这里的目录的名字只能是testdata)
hadoop fs -mkdir testdata
hadoop fs -put /usr/local/mahout/synthetic_control.data testdata
使用kmeans算法
hadoop jar /usr/local/mahout/mahout-examples-0.9-job.jar org.apache.mahout.clustering.syntheticcontrol.kmeans.Job
查看结果
hadoop fs -ls output