1安装环境
hadoop 节点列表
系统明\名称 |
hadoop节点 |
ip地址 |
备注 |
debain7 |
namenode |
192.168.1.111 |
|
datanode1 |
datanode |
192.168.1.112 |
|
datanode2 |
datanode |
192.168.1.113 |
|
datanode3 |
datanode |
192.168.1.114 |
|
2安装步骤
2.1 解压mahout-distribution-0.4.tar.gz
tar -axvf mahout-distribution-0.4.tar.gz
2.2 将文件重名为mahout
mv mahout-distribution-0.4 mahout
2.3 修改~/.bashrc文件,增加下面的几行数据
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-amd64 export HADOOP_HOME=/usr/local/hadoop export HADOOP_CONF_DIR=/usr/local/hadoop/conf export MAHOUT_HOME=/usr/local/mahout export MAHOUT_CONF_DIR=/usr/local/mahout/conf export PATH=$PATH:$HADOOP_HOME_DIR:$HADOOP_HOME/bin:$MAHOUT_HOME/conf:$MAHOUT_HOME/bin
2.4 重新启动服务器,要不上面设置的信息不起作用
2.5 启动hadoop,测试mahout是否安装成功
mahout
2.6 下载mahout测试数据
wget http://archive.ics.uci.edu/ml/databases/synthetic_control/synthetic_control.data
2.7 hadoop创建测试目录
2.8 上传测试数据
2.9 启动kmeans算法,开始测试
mahout org.apache.mahout.clustering.syntheticcontrol.kmeans.Job
2.10查看结果
3问题
tianbx@localhost :/usr/local/mahout/bin$ ./mahout --help MAHOUT_LOCAL is not set; adding HADOOP_CONF_DIR to classpath. Exception in thread "main" java.lang.NoClassDefFoundError: classpath Caused by: java.lang.ClassNotFoundException: classpath at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) Could not find the main class: classpath. Program will exit. Running on hadoop, using /usr/local/hadoop/bin/hadoop and HADOOP_CONF_DIR=/usr/local/hadoop/conf
原因:一开始我按装的是mahout0.8,而hadoop是0.2,版本之间的兼容问题.
解决办法:不安装mahout0.8,换成mahout0.4 就可以了.
|