Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Spark applications must be configured with a set of Kafka topics that are either shared between multiple applications or dedicated to specific applications. The assigned topics must be created before you submit an application to the Spark cluster. Before you can create the topics you must start Zookeeper and Kafka. 

Prerequisites:

Starting Clusters

To start a cluster follow the steps:

...

Code Block
languagetext
$ ./bin/kafka-topics.sh --create --topic <input topic> --bootstrap-server \
localhost:9092 --partitions <number of partitions> --replication-factor <number of replicas>
$ ./bin/kafka-topics.sh --create --topic <output topic> --bootstrap-server \
localhost:9092 --partitions <number of partitions> --replication-factor <number of replicas>
$ ./bin/kafka-topics.sh --create --topic <alarm topic> --bootstrap-server \
localhost:9092 --partitions <number of partitions> --replication-factor <number of replicas>

Example - Creating Kafka Topics

Code Block
./bin/kafka-topics.sh --create --topic kpi-output --partitions 6 --replication-factor 1
./bin/kafka-topics.sh --create --topic kpi-input --partitions 6 --replication-factor 1
./bin/kafka-topics.sh --create --topic kpi-alarm --partitions 6 --replication-factor 1

Example - Creating Kafka topics, overriding retention settings

Code Block
./bin/kafka-topics.sh --create --topic kpi-output --partitions 6 --replication-factor 1 --config retention.ms=86400000
./bin/kafka-topics.sh --create --topic kpi-input --partitions 6 --replication-factor 1 --config retention.ms=86400000
./bin/kafka-topics.sh --create --topic kpi-alarm --partitions 6 --replication-factor 1 --config retention.ms=86400000

...

  1. Run the following command to start Spark:
    $ start_master_workers.sh ...
    To submit the app to the Spark cluster

    .  Submit the app:
        $ submit.sh kpiapp ...

  2. You can now confirm the status of the Spark cluster. Open a browser and go to http://<master host>:8080.

...

 
Spark UI 

Scroll ignore
scroll-viewportfalse
scroll-pdftrue
scroll-officefalse
scroll-chmtrue
scroll-htmlfalse
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue

4.3.4 Using Multiple Service Models