wittyResry / myIssue

My issue mark down^_^ 欢迎吐槽,讨论~~
https://github.com/wittyResry/myIssue/issues
The Unlicense
5 stars 1 forks source link

搭建Spark集群 #26

Open wittyResry opened 8 years ago

wittyResry commented 8 years ago

1. SSH配置

starting org.apache.spark.deploy.master.Master, logging to /Users/resry/sparkTest/spark-2.0.0-bin-hadoop2.3/logs/spark-resry-org.apache.spark.deploy.master.Master-1-resry-2.local.out
localhost: ssh: connect to host localhost port 22: Connection refused

2. Spark配置文件

$ cd conf
$ cp slaves.template slaves
$ cp spark-env.sh.template spark-env.sh

sparkwebstate

wittyResry commented 8 years ago

本地执行Spark计算Pi值

$ ./bin/run-example SparkPi 10

wittyResry commented 8 years ago

交互式Shell: pyspark

$ ./bin/pyspark
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel).
16/10/06 16:41:23 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
16/10/06 16:41:23 WARN SparkConf:
SPARK_WORKER_INSTANCES was detected (set to '1').
This is deprecated in Spark 1.0+.

Please instead use:
 - ./spark-submit with --num-executors to specify the number of executors
 - Or set SPARK_EXECUTOR_INSTANCES
 - spark.executor.instances to configure the number of instances in the spark config.

Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /__ / .__/\_,_/_/ /_/\_\   version 2.0.0
      /_/

Using Python version 2.7.10 (default, Oct 23 2015 19:19:21)
SparkSession available as 'spark'.
>>> lines = sc.textFile('/etc/passwd')
>>> lines.count()
96
wittyResry commented 8 years ago

本地提交scala jar任务

$ pwd
/Users/resry/sparkTest/sbtTest
$ sbt clean package
$ spark-submit --class LineCount --master local ./target/scala-2.11/line-count_2.11-1.0.jar
wittyResry commented 8 years ago

本地提交python任务

$ spark-submit --master local LineCount.py
Test/pythonSparkTest/LineCount.py:6, took 0.726458 s
96
16/10/06 18:32:49 INFO SparkContext: Invoking stop() from shutdown hook