By default, Spark will store its logs from executions, as well as the associated JAR file, in its <spark>/work directory (e.g. /opt/interset/spark/work). This can build up to use large amounts of disk space over time, as the JAR file is roughly 40MB and will be replicated at least once per day.
This behaviour can be changed by modifying the /opt/interset/spark/conf/spark-env.sh file as follows:
- Create a backup of the spark-env.sh file.
- Open the file in a text editor (e.g. vi) and locate "SPARK_WORKER_OPTS"
- Immediately below this line, add:
This should enable work logs cleanup, and will retain logs for no longer than 48 hours, with a default check time of every 30 minutes.
- Restart Spark by running /opt/interset/spark/sbin/stop-all.sh, and then /opt/interset/spark/sbin/start-all.sh
If you wish the change the actual location of the work directory, this can be done with the use of the "SPARK_WORKER_DIR" environment variable.
More information on both of these topics can be found at https://spark.apache.org/docs/1.3.1/spark-standalone.html.