会话管理
使用交互式查询前必须先有一个会话。会话接收交互式查询提交过来的代码、SQL,运行并返回结果。
入口:https://hbase.console.aliyun.com/hbase/cn-shanghai/workspace/session
创建会话
创建会话时,需要先选择一个可运行的集群。
会话内容编写
会话内容跟作业内容很像,因为会话本质上也是一个spark-submit提交的作业。跟作业不同的是,我们无需也不能指定class、file参数。
- 参数
Options (参数) | 说明 |
---|---|
—jars JARS | Comma-separated list of jars to include on the driver and executor classpaths. |
—py-files PY_FILES | Comma-separated list of .zip, .egg, or .py files to place on the PYTHONPATH for Python apps. |
—files FILES | Comma-separated list of files to be placed in the working directory of each executor. File paths of these files in executors can be accessed via SparkFiles.get(fileName). |
—driver-memory MEM | Memory for driver (e.g. 1000M, 2G) (Default: 1024M). |
—driver-cores NUM | Number of cores used by the driver, only in cluster mode (Default: 1). |
—executor-cores NUM | Number of cores per executor. (Default: 1). |
—executor-memory MEM | Memory per executor (e.g. 1000M, 2G) (Default: 1G). |
—num-executors NUM | Number of executors to launch (Default: 2). |
—name NAME | A name of your application. |
—conf PROP=VALUE | Arbitrary Spark configuration property. |
例子:最简单的会话可以什么参数都不指定,或者就是指定个名字,方便在yarn管理页面查找。
--name simple_session
例子:复杂些的,比如需要使用到jar包、python whl包:(下面的jar包whl包只是示例,具体场景需要使用真实的jar包或whl包)
--name session_demo
--driver-memory 1G
--driver-cores 1
--executor-memory 1G
--executor-cores 1
--num-executors 1
--files /pi.py
--jars /tmp-1.0.0-SNAPSHOT.jar
--py-files /python_wheel/Unidecode-1.0.23-py2.py3-none-any.whl
运行会话
点击“运行”按钮后将启动会话。可以通过以下方式来刷新、查看会话的状态详情,会话启动正常的话会进入到Idle
的稳定状态。
- 可以点击刷新按钮,获取会话最新状态。
- 点击“日志”可以查看会话的运行信息,特别是当提交会话失败时,可以方便定位问题。
- 当会话成功提交到后端开始运行后,也可以点击“SparkUI”进入Spark UI页面,也可以点击“YarnUI”进入yarn管理页面,来查看会话运行详情。具体如何使用账号密码访问UI页面,可以查看通用的帮助文档:https://help.aliyun.com/document_detail/50510.html
停止会话
注意:停止会话时,如果该会话下有运行的查询任务将会被强制停止。
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。
评论