首页 > 其他 > 详细

2.初始化spark

时间:2019-05-27 11:01:59      阅读:217      评论:0      收藏:0      [点我收藏+]

 

参考:
 
 we highly recommend you to switch to use Dataset, which has better performance than RDD
 
第一要务:创建 SparkContext
    连接到Spark"集群":local,standalone,yarn,mesos
    通过SparkContext来创建RDD、广播变量到集群
    
    在创建SparkContext之前需要创建一个SparkConf对象
    
    进入spark的bin目录下
    ./pyspark
    
技术分享图片
    
    In the PySpark shell, a special interpreter-aware SparkContext is already created for you, in the variable called sc.
    
    
    appName
技术分享图片
    ./pyspark --help  查看帮助
技术分享图片
    
    
RDD创建方式
    Parallelized Collections
        data = [1, 2, 3, 4, 5]       distData = sc.parallelize(data)
    External Datasets
        distFile = sc.textFile("file:////root/app/test/hello.txt")
 
 
    If using a path on the local filesystem, the file must also be accessible at the same path on worker nodes
 

2.初始化spark

原文:https://www.cnblogs.com/huangguoming/p/10929385.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!