1. Prepare 1.1 to start activemq and twister in advance.
xiuwenyi@Twister1:~/apache-activemq-5.4.2/bin$ ./activemq console
xiuwenyi@Twister1:~/twister-0.9/bin$ ./start_twister.sh
1.2 jar package (on all nodes) Run ant under $ twister_home/samples/kmeans to copy the generated Twister-Kmeans-0.9.jar to the $ twister_home/apps path
2. Run the kmeans algorithm 2.1 to create the kmeans input directory
xiuwenyi@Twister1:~$ cd $TWISTER_HOME/bin xiuwenyi@Twister1:~/twister-0.9/bin$ ./twister.sh mkdir kmeans
2.2 generate data
xiuwenyi@Twister1:~/twister-0.9/bin$ cd $TWISTER_HOME/samples/kmeans/bin xiuwenyi@Twister1:~/twister-0.9/samples/kmeans/bin$ ./gen_data.sh init_clusters.txt 3 3 /kmeans km_data 6 60000
Automatically upload the generated data files to each node in the cluster on average. If you do not need to generate data automatically, use the following command to allocate data.
cd $TWISTER_HOME/bin ./twister.sh put $TWISTER_HOME/samples/kmeans/input kmeans
2.3 create a partition File
xiuwenyi@Twister1:~/twister-0.9/samples/kmeans/bin$ cd $TWISTER_HOME/bin xiuwenyi@Twister1:~/twister-0.9/bin$ ./create_partition_file.sh kmeans km_data $TWISTER_HOME/samples/kmeans/bin/kmeans.pf
2.4 run
xiuwenyi@Twister1:~/twister-0.9/samples/kmeans/bin$ cd $TWISTER_HOME/samples/kmeans/binxiuwenyi@Twister1:~/twister-0.9/samples/kmeans/bin$ ./run_kmeans.sh init_clusters.txt 6 kmeans.pf