Configure Livy with Spark Modes
This topic describes how to configure Livy with different Spark modes.
Use these steps to configure Livy:
- Modify the
livy.conf
file (/opt/mapr/livy/livy-<version>/conf/livy.conf
):- If Spark jobs run in local mode, set the
livy.spark.master
property:... # What spark master Livy sessions should use. livy.spark.master = local[*] ...
- If Spark jobs run in YARN mode, set the
livy.spark.master
andlivy.spark.deployMode
properties (client or cluster). For example:... # What spark master Livy sessions should use. livy.spark.master = yarn # What spark deploy mode Livy sessions should use. livy.spark.deployMode = client ...
or... # What spark master Livy sessions should use. livy.spark.master = yarn # What spark deploy mode Livy sessions should use. livy.spark.deployMode = cluster ...
- If Spark jobs run in Standalone mode, set the
livy.spark.master
andlivy.spark.deployMode
properties (client or cluster). For example:… # What spark master Livy sessions should use. livy.spark.master = spark://node:7077 # What spark deploy mode Livy sessions should use. livy.spark.deployMode = client …
or… # What spark master Livy sessions should use. livy.spark.master = spark://node:7077 # What spark deploy mode Livy sessions should use. livy.spark.deployMode = cluster …
- If Spark jobs run in Mesos mode, set the
livy.spark.master
property. For example:# What spark master Livy sessions should use. livy.spark.master = mesos://<mesos-master-node-ip>:5050
- If Spark jobs run in local mode, set the
- To you want to use impersonation with Livy, set
livy.impersonation.enabled
totrue
inlivy.conf
. For example:# If livy should impersonate the requesting users when creating a new session. livy.impersonation.enabled = true
- If you want to be able to access Hive through Spark for Livy, you should configure Spark
with Hive, and set
livy.repl.enableHiveContext
totrue
inlivy.conf
. For example:... # Whether to enable HiveContext in livy interpreter, if it is true hive-site.xml will be detected # on user request and then livy server classpath automatically. livy.repl.enableHiveContext = true ...
NOTEIf Hive is installed on a cluster and if Spark is configured on Hive, this property is set to true by default:livy.repl.enableHiveContext = true
. - To apply the needed changes, restart the Livy
service:
maprcli node services -name livy -action restart -nodes <livy node>