Open wittyResry opened 8 years ago
$ ./bin/run-example SparkPi 10
$ ./bin/run-example SparkPi 10000
$ ./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
$ sbt clean package
打出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
$ 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
1. SSH配置
2. Spark配置文件
export JAVA_HOME=$(/usr/libexec/java_home -v "1.8*")
3. 复制Spark目录
/Users/resry/sparkTest/spark-2.0.0-bin-hadoop2.3
4. 启动spark集群
5. 运行一个用例
$ ./bin/spark-submit --master spark://resry-2.local:7077 examples/src/main/python/pi.py
6. 查看运行结果