使用 安装包:
scala-2.10.3.tgz
spark-0.9.0-incubating-bin-hadoop2.tgz
hadoop-2.3.0-cdh5.0.0.tar.gz
jdk1.7.0_45
下载地址:http://mirror.bit.edu.cn/apache/spark/spark-0.9.0-incubating/
spark-0.9.0-incubating-bin-hadoop2.tgz
http://archive.cloudera.com/cdh5/cdh/5/下载 sacala和hadoop
安装软件
tar
zxvf
spark-0.9.0-incubating-bin-hadoop2.tgz
tar
zxvf
scala-2.10.3.tgz
配置用户环境变量~/.bashrc
export JAVA_HOME=/hadoop/jdk1.7.0_45
export HADOOP_HOME=/hadoop/hadoop
export HADOOP_CONF_DIR=/hadoop/hadoop-config
export PATH=$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$SCALA_HOME/bin:$SPARK_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
export HADOOP_HOME_WARN_SUPPRESS=1
export SCALA_HOME=/hadoop/scala-2.10.3
export SPARK_EXAMPLES_JAR=/hadoop/spark/examples/target/spark-examples_2.10-0.9.0-incubating.jar
export SPARK_HOME=/hadoop/spark-0.9.0-incubating-bin-hadoop2
配置环境变量: /hadoop/spark-0.9.0-incubating-bin-hadoop2/conf下
修改spark-env.sh文件,加入spark必要的配置:
export SCALA_HOME=/hadoop/scala-2.10.3
export JAVA_HOME=/hadoop/jdk1.7.0_45
export SPARK_HOME=/hadoop/spark
拷贝环境变量到其他节点,立即 生效 source .bash_profile
测试环境变量 scala -version
配置conf文件:
vi slaves
bigdata-2
bigdata-4
文件分发至其他节点
spark启动:
cd /hadoop/spark-0.9.0-incubating-bin-hadoop2/sbin
./start-all.sh
查看进程:
jps
22580 NameNode
25767 Master
27758 Jps
23024 ResourceManager
22812 SecondaryNameNode
节点进程:
70869 Worker
70150 NodeManager
71462 Jps
70023 DataNode
~安装完毕~安装完毕~安装完毕~安装完毕~安装完毕~
spark使用:
运行SparkPi: cd /hadoop/spark/bin
ll /hadoop/spark/bin
-rw-rw-r--. 1 hadoop hadoop 2601 2月 3 03:13 compute-classpath.cmd
-rwxrwxr-x. 1 hadoop hadoop 3330 2月 3 03:13 compute-classpath.sh
-rwxrwxr-x. 1 hadoop hadoop 2070 2月 3 03:13 pyspark
-rw-rw-r--. 1 hadoop hadoop 1827 2月 3 03:13 pyspark2.cmd
-rw-rw-r--. 1 hadoop hadoop 1000 2月 3 03:13 pyspark.cmd
-rwxrwxr-x. 1 hadoop hadoop 3055 2月 3 03:13 run-example
-rw-rw-r--. 1 hadoop hadoop 2047 2月 3 03:13 run-example2.cmd
-rw-rw-r--. 1 hadoop hadoop 1012 2月 3 03:13 run-example.cmd
-rwxrwxr-x. 1 hadoop hadoop 5151 2月 3 03:13 spark-class
-rwxrwxr-x. 1 hadoop hadoop 3212 2月 3 03:13 spark-class2.cmd
-rw-rw-r--. 1 hadoop hadoop 1010 2月 3 03:13 spark-class.cmd
-rwxrwxr-x. 1 hadoop hadoop 3038 2月 3 03:13 spark-shell
-rwxrwxr-x. 1 hadoop hadoop 941 2月 3 03:13 spark-shell.cmd