利用 livy 远程提交 spark作业

利用 livy 远程提交 spark作业

1. 下载,安装 livy

下载 地址 :http://livy.io/quickstart.html
下载之后,解压即可运行

2. 配置环境变量

export SPARK_HOME=/usr/lib/spark 
export HADOOP_CONF_DIR=/etc/hadoop/conf


3.配置主机和端口(可跳过,直接用默认值)

# What host address to start the server on. By default, Livy will bind to all network interfaces. (主机)
 livy.server.host = 0.0.0.0

# What port to start the server on.(端口)
 livy.server.port = 8998
# Time in milliseconds on how long Livy will wait before timing out an idle session.(超时时长,即session多久未用之后,自动kill掉)
 livy.server.session.timeout = 1h


4. 开启livy服务

./bin/livy-server


5.REST Api (以下url均以host:port开头,默认为 localhost:8998)

1)GET   /sessions

Returns all the active interactive sessions. 返回所有活跃的session

2)POST  /sessions

Creates a new interative Scala, Python, or R shell in the cluster. 创建一个session,即新开一个shell

Request Body

name description type
kind The session kind (required) session kind
proxyUser User to impersonate when starting the session string
conf Spark configuration properties Map of key=val


3)GET /sessions/{sessionId}
Returns the session information. 返回相应session的信息

4)DELETE /sessions/{sessionId}

Kills the Session job.

5) GET /sessions/{sessionId}/statements

返回session的所有statement的信息

6)POST /sessions/{sessionId}/statements

Runs a statement in a session. 即提交一个语句,运行

7) GET /sessions/{sessionId}/statements/{statementId}

获取相应statement的信息





你可能感兴趣的:(大数据)