Created
April 25, 2017 15:08
-
-
Save anthonynsimon/deaab3b714cc863449e8581404215665 to your computer and use it in GitHub Desktop.
Spark cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
networks: | |
default: | |
services: | |
master: | |
image: local/spark | |
ports: | |
- "8080:8080" | |
- "7077:7077" | |
- "6066:6066" | |
command: master | |
networks: | |
default: | |
deploy: | |
placement: | |
constraints: | |
- node.role == manager | |
slave: | |
image: local/spark | |
command: slave spark://master:7077 | |
networks: | |
default: | |
deploy: | |
mode: replicated | |
replicas: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
case "$1" in | |
master) | |
cd $SPARK_HOME && sbin/start-master.sh | |
tail -f /dev/null | |
;; | |
slave) | |
cd $SPARK_HOME && sbin/start-slave.sh $2 | |
tail -f /dev/null | |
;; | |
*) | |
/bin/bash -c "$*" | |
;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM openjdk:8 | |
RUN mkdir -p /usr/local/spark && \ | |
cd /usr/local/spark && \ | |
curl -O http://d3kbcqa49mib13.cloudfront.net/spark-2.1.0-bin-hadoop2.7.tgz && \ | |
tar -vxf spark-2.1.0-bin-hadoop2.7.tgz | |
ENV SPARK_HOME /usr/local/spark/spark-2.1.0-bin-hadoop2.7 | |
COPY ./docker-entrypoint.sh /etc/docker-entrypoint.sh | |
RUN chmod 700 /etc/docker-entrypoint.sh && \ | |
chown root.root /etc/docker-entrypoint.sh | |
EXPOSE 8080 7077 6066 | |
ENTRYPOINT ["/etc/docker-entrypoint.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment