runSpark - juedaiyuer/researchNote GitHub Wiki

#spark运行#

##Interactive Python Shell##

Alternatively, if you prefer Python, you can use the Python shell:

./bin/pyspark

And run the following command, which should also return 1000:

>>> sc.parallelize(range(1000)).count()

##简略Spark输出##

Spark(和PySpark)的执行可以特别详细,很多INFO日志消息都会打印到屏幕。开发过程中,这些非常恼人,因为可能丢失Python栈跟踪或者print的输出。为了减少Spark输出 – 你可以设置$SPARK_HOME/conf下的log4j。首先,拷贝一份$SPARK_HOME/conf/log4j.properties.template文件,去掉“.template”扩展名。

cp $SPARK_HOME/conf/log4j.properties.template $SPARK_HOME/conf/log4j.properties

当然你也可以进入spark的配置文件etc下进行如下的操作

cp log4j.properties.template log4j.properties

编辑新文件,用WARN替换代码中出现的INFO

##source##