zoukankan      html  css  js  c++  java
  • 启动spark shell详解

    spark-shell是Spark自带的交互式Shell程序,方便用户进行交互式编程,用户可以在该命令行下用scala编写spark程序。

    启动spark shell:

    /usr/local/spark-2.1.0-bin-hadoop2.6/bin/spark-shell --master spark://L1:7077,L2:7077  --executor-memory 2g  --total-executor-cores 2
    
    • 1

    参数说明:

    --master spark://L1:7077,L2:7077     指定Master的地址
    --executor-memory 2g 指定每个worker可用内存为2G
    --total-executor-cores 2 指定整个集群使用的cup核数为2个
    
    • 1
    • 2
    • 3

    注意

    如果启动spark shell时没有指定master地址,但是也可以正常启动spark shell和执行spark shell中的程序,其实是启动了spark的local模式,该模式仅在本机启动一个进程,没有与集群建立联系。

    /usr/local/spark-2.1.0-bin-hadoop2.6/bin/spark-shell 
    --master spark://L1:7077,L2:7077  
    --executor-memory 2g  
    --total-executor-cores 2
    这样启动spark shell,指定了master的地址,那么就会将任务提交到集群,开始时sparkSubmit(客户端)
    要连接Master,并申请计算资源(内存和核数),Master进行资源调度(就是让那些Worker启动Executor),
    在准备工作时,这些进程都已经创建好了。
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    启动spark shell后,查看UI管理界面,会发现Application ID多了一个正在运行的spark shell进程。

    在这里插入图片描述

  • 相关阅读:
    wireShark 代码分析
    Flex Chart / Charting 图表参考
    Boost笔记
    mysql的常用开发工具【建模、维护、监控】
    DSL应用集成和Rhino 3
    元编程 Metaprogramming
    Coffeescript的使用简要
    Ruby基础[Programing ruby笔记]
    编程范式/范型参考 programming paradigm
    DSL语法、组成 2
  • 原文地址:https://www.cnblogs.com/ExMan/p/14308621.html
Copyright © 2011-2022 走看看