← Back to list

How to run Spark job on a CDH

To run a Spark job on a CDH (Cloudera Distribution of Hadoop) cluster, you have a few options, depending on your use case and preferences…

Vivek Pemawat · 2023-08-08 08:33 · 0 claps · 1.4 min read
#apache-spark #livy #oozie #cdh #cloudera
Open on Medium ↗

How to run Spark job on a CDH

To run a Spark job on a CDH (Cloudera Distribution of Hadoop) cluster, you have a few options, depending on your use case and preferences. Here are the common methods to run a Spark job on a CDH cluster:

  1. Using spark-submit: The most straightforward way to submit a Spark job to a CDH cluster is by using the spark-submit command-line tool. spark-submit allows you to specify your Spark application's JAR file or Python script along with various configuration options. Here's an example:
spark-submit \
  --class com.example.MySparkJob \
  --master yarn \
  --deploy-mode client \
  --executor-memory 2g \
  --num-executors 4 \
  /path/to/your/spark-application.jar

Replace com.example.MySparkJob with your Spark application's main class (if using Scala or Java) or the Python script name (if using PySpark). Adjust other options like memory, number of executors, and the path to your Spark application JAR file accordingly.

  1. Using Hue (Hadoop User Experience): If you have Hue installed on your CDH cluster, it provides a web-based interface that allows you to run Spark jobs interactively. You can navigate to the Hue Spark application and submit your Spark job by uploading the JAR file or Python script and setting the configurations through the web interface.
  2. Using Oozie Workflow: If you want to create more complex workflows that involve multiple Hadoop jobs, you can use Apache Oozie. Oozie is a workflow scheduler that allows you to define workflows in XML and submit them to run on the CDH cluster. You can create an Oozie workflow to run your Spark job as one of the steps in the workflow.
  3. Using Apache Livy: Apache Livy is a REST service that enables you to submit and manage interactive and batch Spark jobs programmatically. You can use Livy’s REST API to submit your Spark job to the CDH cluster, monitor its status, and get the results.

Remember to ensure that your CDH cluster has Spark installed and properly configured before attempting to run Spark jobs. Also, make sure your Spark application and CDH cluster’s Spark version are compatible.

Choose the method that best fits your needs and familiarity with the tools available in your CDH cluster environment.


메타데이터
post_id
c1a45f41cb17
slug
how-to-run-spark-job-on-a-cdh-c1a45f41cb17
url
https://medium.com/@vivekpemawat/how-to-run-spark-job-on-a-cdh-c1a45f41cb17
canonical_url
https://medium.com/@vivekpemawat/how-to-run-spark-job-on-a-cdh-c1a45f41cb17
author_url
https://medium.com/@vivekpemawat
status
ok
fetched_at
2026-06-10 15:53:41