Implementation:Apache Spark Stop All
| Field | Value |
|---|---|
| Source | Repo Apache Spark |
| Domains | Deployment |
| Type | API Doc |
| Related | Principle:Apache_Spark_Cluster_Lifecycle_Shutdown |
Overview
Shell scripts that stop all Spark standalone cluster daemons in the correct dependency order.
Description
sbin/stop-all.sh orchestrates full cluster shutdown by:
- Calling stop-workers.sh first to terminate all worker daemons
- Then calling stop-master.sh to terminate the master daemon
- Supporting the --wait flag to block until all workers have fully terminated
Individual scripts can be used independently for partial shutdowns:
- sbin/stop-master.sh -- stops only the master daemon
- sbin/stop-workers.sh -- stops only the worker daemons across all hosts
- sbin/decommission-worker.sh -- sends SIGPWR to allow graceful task completion before worker shutdown
Usage
Run on the master node to shut down the entire cluster. For rolling maintenance, use decommission-worker.sh on individual workers to allow in-flight tasks to complete before the worker exits.
Code Reference
Source: sbin/stop-all.sh (L1-49), sbin/stop-master.sh (L1-29), sbin/stop-workers.sh (L1-29), sbin/decommission-worker.sh (L1-58)
Signatures:
# Stop all daemons (workers first, then master)
sbin/stop-all.sh [--wait]
# Gracefully decommission a worker (drain tasks first)
sbin/decommission-worker.sh [--block-until-exit]
I/O
| Direction | Description |
|---|---|
| Inputs | PID files from daemon startup, --wait flag (optional) |
| Outputs | All daemons stopped, PID files cleaned up |
Examples
Stop all cluster daemons:
./sbin/stop-all.sh
Stop all and wait for full termination:
./sbin/stop-all.sh --wait
Gracefully decommission a single worker:
./sbin/decommission-worker.sh --block-until-exit
Stop only the master daemon:
./sbin/stop-master.sh