Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1065855
  • 博文数量: 239
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 3618
  • 用 户 组: 普通用户
  • 注册时间: 2012-11-12 13:17
文章分类

全部博文(239)

文章存档

2021年(1)

2016年(1)

2015年(30)

2014年(91)

2013年(116)

分类: 大数据

2015-10-26 15:51:17

解压scala-2.10.4.tgz到/usr/local/scala目录下
[root@Master scala]# pwd
/usr/local/scala
[root@Master scala]# ls
scala-2.10.4  scala-2.10.4.tgz

解压spark-1.5.0-bin-hadoop2.6.tgz到/usr/local/spark目录下
[root@Master spark]# pwd
/usr/local/spark
[root@Master spark]# ls
spark-1.5.0-bin-hadoop2.6  spark-1.5.0-bin-hadoop2.6.tgz

查看环境变量
[root@Master scala]# cat ~/.bash_profile 

点击(此处)折叠或打开

  1. # .bash_profile
  2. # Get the aliases and functions
  3. if [ -f ~/.bashrc ]; then
  4. . ~/.bashrc
  5. fi
  6. # User specific environment and startup programs
  7. HADOOP_HOME=/usr/local/hadoop/hadoop-2.6.0
  8. SCALA_HOME=/usr/local/scala/scala-2.10.4
  9. SPARK_HOME=/usr/local/spark/spark-1.5.0-bin-hadoop2.6
  10. JAVA_HOME=/opt/jdk1.7.0_79
  11. CLASS_PATH=.$JAVA_HOME/lib/tools.jar
  12. PATH=$PATH:$HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$SCALA_HOME/bin:$SPARK_HOME/bin:$JAVA_HOME/bin
  13. export PATH HADOOP_HOME SPARK_HOME JAVA_HOME CLASS_PATH

修改/usr/local/spark/spark-1.5.0-bin-hadoop2.6/conf下的slaves文件
[root@Master conf]# cat slaves

点击(此处)折叠或打开

  1. Slave1
  2. Slave2

修改/usr/local/spark/spark-1.5.0-bin-hadoop2.6/conf下的spark-env.sh文件
[root@Master conf]# cat spark-env.sh

点击(此处)折叠或打开

  1. #!/usr/bin/env bash

  2. # This file is sourced when running various Spark programs.
  3. # Copy it as spark-env.sh and edit that to configure Spark for your site.

  4. # Options read when launching programs locally with
  5. # ./bin/run-example or ./bin/spark-submit
  6. # - HADOOP_CONF_DIR, to point Spark towards Hadoop configuration files
  7. # - SPARK_LOCAL_IP, to set the IP address Spark binds to on this node
  8. # - SPARK_PUBLIC_DNS, to set the public dns name of the driver program
  9. # - SPARK_CLASSPATH, default classpath entries to append

  10. # Options read by executors and drivers running inside the cluster
  11. # - SPARK_LOCAL_IP, to set the IP address Spark binds to on this node
  12. # - SPARK_PUBLIC_DNS, to set the public DNS name of the driver program
  13. # - SPARK_CLASSPATH, default classpath entries to append
  14. # - SPARK_LOCAL_DIRS, storage directories to use on this node for shuffle and RDD data
  15. # - MESOS_NATIVE_JAVA_LIBRARY, to point to your libmesos.so if you use Mesos

  16. # Options read in YARN client mode
  17. # - HADOOP_CONF_DIR, to point Spark towards Hadoop configuration files
  18. # - SPARK_EXECUTOR_INSTANCES, Number of workers to start (Default: 2)
  19. # - SPARK_EXECUTOR_CORES, Number of cores for the workers (Default: 1).
  20. # - SPARK_EXECUTOR_MEMORY, Memory per Worker (e.g. 1000M, 2G) (Default: 1G)
  21. # - SPARK_DRIVER_MEMORY, Memory for Master (e.g. 1000M, 2G) (Default: 1G)
  22. # - SPARK_YARN_APP_NAME, The name of your application (Default: Spark)
  23. # - SPARK_YARN_QUEUE, The hadoop queue to use for allocation requests (Default: ?.efault?.
  24. # - SPARK_YARN_DIST_FILES, Comma separated list of files to be distributed with the job.
  25. # - SPARK_YARN_DIST_ARCHIVES, Comma separated list of archives to be distributed with the job.

  26. # Options for the daemons used in the standalone deploy mode
  27. # - SPARK_MASTER_IP, to bind the master to a different IP address or hostname
  28. # - SPARK_MASTER_PORT / SPARK_MASTER_WEBUI_PORT, to use non-default ports for the master
  29. # - SPARK_MASTER_OPTS, to set config properties only for the master (e.g. "-Dx=y")
  30. # - SPARK_WORKER_CORES, to set the number of cores to use on this machine
  31. # - SPARK_WORKER_MEMORY, to set how much total memory workers have to give executors (e.g. 1000m, 2g)
  32. # - SPARK_WORKER_PORT / SPARK_WORKER_WEBUI_PORT, to use non-default ports for the worker
  33. # - SPARK_WORKER_INSTANCES, to set the number of worker processes per node
  34. # - SPARK_WORKER_DIR, to set the working directory of worker processes
  35. # - SPARK_WORKER_OPTS, to set config properties only for the worker (e.g. "-Dx=y")
  36. # - SPARK_DAEMON_MEMORY, to allocate to the master, worker and history server themselves (default: 1g).
  37. # - SPARK_HISTORY_OPTS, to set config properties only for the history server (e.g. "-Dx=y")
  38. # - SPARK_SHUFFLE_OPTS, to set config properties only for the external shuffle service (e.g. "-Dx=y")
  39. # - SPARK_DAEMON_JAVA_OPTS, to set config properties for all daemons (e.g. "-Dx=y")
  40. # - SPARK_PUBLIC_DNS, to set the public dns name of the master or workers

  41. # Generic options for the daemons used in the standalone deploy mode
  42. # - SPARK_CONF_DIR Alternate conf dir. (Default: ${SPARK_HOME}/conf)
  43. # - SPARK_LOG_DIR Where log files are stored. (Default: ${SPARK_HOME}/logs)
  44. # - SPARK_PID_DIR Where the pid file is stored. (Default: /tmp)
  45. # - SPARK_IDENT_STRING A string representing this instance of spark. (Default: $USER)
  46. # - SPARK_NICENESS The scheduling priority for daemons. (Default: 0)
  47. export SPARK_HOME=/usr/local/scala/scala-2.10.4
    export JAVA_HOME=/opt/jdk1.7.0_79
    export HADOOP_HOME=/usr/local/hadoop/hadoop-2.6.0
    export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop
    export SPARK_JAR=/usr/local/spark/spark-1.5.0-bin-hadoop2.6/lib/spark-assembly-1.5.0-hadoop2.6.0.jar

将spark和scala文件夹远程拷贝到Slave1和Slave2节点
[root@Master local]# scp -r /usr/local/scala/ Slave1:/usr/local/
[root@Master local]# scp -r /usr/local/scala/ Slave2:/usr/local/
[root@Master local]# scp -r /usr/local/spark/ Slave1:/usr/local/
[root@Master local]# scp -r /usr/local/spark/ Slave2:/usr/local/

[root@Master sbin]# cd /usr/local/spark/spark-1.5.0-bin-hadoop2.6/sbin
[root@Master sbin]# ./start-all.sh 
starting org.apache.spark.deploy.master.Master, logging to /usr/local/spark/spark-1.5.0-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.master.Master-1-Master.out
Slave1: starting org.apache.spark.deploy.worker.Worker, logging to /usr/local/spark/spark-1.5.0-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.worker.Worker-1-Slave1.out
Slave2: starting org.apache.spark.deploy.worker.Worker, logging to /usr/local/spark/spark-1.5.0-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.worker.Worker-1-Slave2.out

执行命令查看状态
在Master节点执行命令
[root@Master sbin]# jps -l
9032 org.apache.hadoop.yarn.server.resourcemanager.ResourceManager
9353 org.apache.spark.deploy.master.Master
8792 org.apache.hadoop.hdfs.server.namenode.NameNode
9476 sun.tools.jps.Jps

在Slave1节点执行命令
[root@Slave1 hadoop]# jps -l
4575 org.apache.spark.deploy.worker.Worker
4643 sun.tools.jps.Jps
4394 org.apache.hadoop.yarn.server.nodemanager.NodeManager
4291 org.apache.hadoop.hdfs.server.datanode.DataNode

在Slave2节点执行命令
[root@Slave2 scala]# jps -l
27889 org.apache.hadoop.hdfs.server.datanode.DataNode
27992 org.apache.hadoop.yarn.server.nodemanager.NodeManager
28173 org.apache.spark.deploy.worker.Worker
28256 sun.tools.jps.Jps

访问spark





阅读(1250) | 评论(0) | 转发(0) |
0

上一篇:hadoop2.6集群环境安装

下一篇:Elk环境安装

给主人留下些什么吧!~~