微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

2.初始化spark

 

参考:  RDD programming guide http://spark.apache.org/docs/latest/rdd-programming-guide.html  SQL programming guide http://spark.apache.org/docs/latest/sql-programming-guide.html    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  

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐