GithubHelp home page GithubHelp logo

quick-spark-process's Introduction

quick-spark-process

学习spark的相关示例

word-count

最简单也是最经典的例子 后面搭了spark集群 并使用了hdfs来存储文件,有几点需要注意

文件的调用方式

context.textFile("D:\\data\\spark\\blsmy.txt");  -- 用于idea测试
context.textFile("file:///mnt/data/blsmy.txt"); -- 用于集群运行(前提,运行的各节点都需要有此文件)
context.textFile("hdfs://spark-master:9000/wordcount/blsmy.txt"); -- 使用hdfs调用文件

日志输出的位置

在页面中,输出的日志有sterr和stdout两种,在stdout可以查看程序中输出的内容。如果你在程序中使用了println(....)输出语句,这些信息会在stdout文件里面显示;其余的Spark运行日志会在stderr文件里面显示。 也可以直接进行日志文件进行查看,如:

/spark/software/spark/work/app-20180428142302-0003/0/stdout
/spark/software/spark/work/app-20180428142302-0003/0/stderr

启动的方式

bin/spark-submit \ 
    --master spark://spark-master:7077 \
    --driver-memory 1g \
    --executor-cores 1 \
    --class com.spark.WordCount \
    simple/word-count-1.0-SNAPSHOT.jar

spark-pi

也是一个比较经典的栗子

spark-sql

使用sparksql做的简单操作

quick-spark-process's People

Contributors

vw2019 avatar vector4wang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.