Step 1:
Prepare the sample set, because there is too much data to intercept only part of the data
1,1.52101,13.64,4.49,1.10,71.78,0.06,8.75,0.00,0.00,1 2,1.51761,13.89,3.60,1.36,72.73,0.48,7.83,0.00,0.00,1
3,1.51618,13.53,3.55,1.54,72.99,0.39,7.78,0.00,0.00,1 4,1.51766,13.21,3.69,1.29,72.61,0.57,8.22,0.00,0.00,1
5,1.51742,13.27,3.62,1.24,73.08,0.55,8.07,0.00,0.00,1 6,1.51596,12.79,3.61,1.62,72.97,0.64,8.07,0.00,0.26,1
7,1.51743,13.30,3.60,1.14,73.09,0.58,8.17,0.00,0.00,1 8,1.51756,13.15,3.61,1.05,73.24,0.57,8.24,0.00,0.00,1
9,1.51918,14.04,3.58,1.37,72.08,0.56,8.30,0.00,0.00,1 10,1.51755,13.00,3.60,1.36,72.99,0.57,8.40,0.00,0.11,1
11,1.51571,12.72,3.46,1.56,73.20,0.67,8.09,0.00,0.24,1 12,1.51763,12.80,3.66,1.27,73.01,0.60,8.56,0.00,0.00,1
13,1.51589,12.88,3.43,1.40,73.28,0.69,8.05,0.00,0.24,1 14,1.51748,12.86,3.56,1.27,73.21,0.54,8.38,0.00,0.17,1
15,1.51763,12.61,3.59,1.31,73.29,0.58,8.50,0.00,0.00,1 16,1.51761,12.81,3.54,1.23,73.24,0.58,8.39,0.00,0.00,1
17,1.51784,12.68,3.67,1.16,73.11,0.61,8.70,0.00,0.00,1 18,1.52196,14.36,3.85,0.89,71.36,0.15,9.15,0.00,0.00,1 19,1.51911,13.90,3.73,1.18,72.12,0.06,8.89,0.00,0.00,1 20,1.51735,13.02,3.54,1.69,72.73,0.54,8.44,0.00,0.07,1
21,1.51750,12.82,3.55,1.49,72.75,0.54,8.52,0.00,0.19,1 22,1.51966,14.77,3.75,0.29,72.02,0.03,9.00,0.00,0.00,1 23,1.51736,12.78,3.62,1.29,72.79,0.59,8.70,0.00,0.00,1
Step 2:
Execute the command on the NODE11 node to create the sample file
Vi/opt/apps/mahout/apache-mahout-distribution-0.10.2/test/glass.dat
Step 3:
Execute commands on three nodes, respectively, to start zookeeper
zkserver.sh Start
zkserver.sh status
Step 4:
Execute commands on the NODE11 node to start HDFs and yarn
start-all.sh
Execute command on Node12 node, start ResourceManager
yarn-daemon.sh start ResourceManager
Step 5:
Open browser, enter URL to view HDFs
192.168.80.11:50070
192.168.80.12:50070
Open browser, enter URL to view yarn
192.168.80.11:8088
192.168.80.12:8088
Step 6:
Execute commands on the NODE11 node, create a folder, and upload the sample set to HDFs
Hadoop fs-mkdir randomforest
Hadoop fs-put/opt/apps/mahout/apache-mahout-distribution-0.10.2/test/glass.dat Randomforest
Hadoop fs-ls randomforest
Step 7:
Execute command on NODE11 node, start mahout, generate file description
Mahout org.apache.mahout.classifier.df.tools.describe-p randomforest/glass.dat-f randomforest/glass.info-d I 9 N L
Step 8:
Execute commands on the NODE11 node and use Mahout for training data
Mahout org.apache.mahout.classifier.df.mapreduce.buildforest-d Randomforest/glass.dat-ds Randomforest/glass.info- SL 3-T 5-o Randomforest/forest_result
Step 9:
Execute commands on the NODE11 node and test data with Mahout
Mahout org.apache.mahout.classifier.df.mapreduce.testforest-i Randomforest/glass.dat-ds randomforest/glass.info-m RANDOMFOREST/FOREST_RESULT-A-O Predictions