Skip to content

Commit 5ccab3f

Browse files
committed
specify spark.yarn.jar in favor of ENV SPARK_JAR, prettify README, setup empty metrics.properties
1 parent 0f24cee commit 5ccab3f

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ ADD yarn-remote-client $SPARK_HOME/yarn-remote-client
1111
RUN $BOOTSTRAP && $HADOOP_PREFIX/bin/hadoop dfsadmin -safemode leave && $HADOOP_PREFIX/bin/hdfs dfs -put $SPARK_HOME-1.4.0-bin-hadoop2.6/lib /spark
1212

1313
ENV YARN_CONF_DIR $HADOOP_PREFIX/etc/hadoop
14-
ENV SPARK_JAR hdfs:///spark/spark-assembly-1.4.0-hadoop2.6.0.jar
1514
ENV PATH $PATH:$SPARK_HOME/bin:$HADOOP_PREFIX/bin
1615
# update boot script
1716
COPY bootstrap.sh /etc/bootstrap.sh

README.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ docker build --rm -t sequenceiq/spark:1.4.0 .
1818

1919
* if using boot2docker make sure your VM has more than 2GB memory
2020
* in your /etc/hosts file add $(boot2docker ip) as host 'sandbox' to make it easier to access your sandbox UI
21-
* open UI ports when starting image
21+
* open yarn UI ports when running container
2222
```
23-
docker run -it -p 8088:8088 -p 8042:8042 -p 8080:8080 -p 7077:7077 -p 6066:6066 -h sandbox sequenceiq/spark:1.4.0 bash
23+
docker run -it -p 8088:8088 -p 8042:8042 -h sandbox sequenceiq/spark:1.4.0 bash
24+
```
25+
or
26+
```
27+
docker run -d -h sandbox sequenceiq/spark:1.3.1 -d
2428
```
2529

2630
## Versions
@@ -38,8 +42,11 @@ In yarn-client mode, the driver runs in the client process, and the application
3842

3943
```
4044
# run the spark shell
41-
# set memory limits appropriately or spark context will not be able to start
42-
spark-shell --master yarn-client --driver-memory 1g --executor-memory 1g --executor-cores 1
45+
spark-shell \
46+
--master yarn-client \
47+
--driver-memory 1g \
48+
--executor-memory 1g \
49+
--executor-cores 1
4350
4451
# execute the the following command which should return 1000
4552
scala> sc.parallelize(1 to 1000).count()
@@ -52,12 +59,26 @@ Estimating Pi (yarn-cluster mode):
5259

5360
```
5461
# execute the the following command which should write the "Pi is roughly 3.1418" into the logs
55-
spark-submit --class org.apache.spark.examples.SparkPi --master yarn-cluster --driver-memory 1g --executor-memory 1g --executor-cores 1 $SPARK_HOME/lib/spark-examples-1.4.0-hadoop2.6.0.jar
62+
# note you must specify --files argument in cluster mode to enable metrics
63+
spark-submit \
64+
--class org.apache.spark.examples.SparkPi \
65+
--files $SPARK_HOME/conf/metrics.properties \
66+
--master yarn-cluster \
67+
--driver-memory 1g \
68+
--executor-memory 1g \
69+
--executor-cores 1 \
70+
$SPARK_HOME/lib/spark-examples-1.4.0-hadoop2.6.0.jar
5671
```
5772

5873
Estimating Pi (yarn-client mode):
5974

6075
```
6176
# execute the the following command which should print the "Pi is roughly 3.1418" to the screen
62-
spark-submit --class org.apache.spark.examples.SparkPi --master yarn-client --driver-memory 1g --executor-memory 1g --executor-cores 1 $SPARK_HOME/lib/spark-examples-1.4.0-hadoop2.6.0.jar
77+
spark-submit \
78+
--class org.apache.spark.examples.SparkPi \
79+
--master yarn-client \
80+
--driver-memory 1g \
81+
--executor-memory 1g \
82+
--executor-cores 1 \
83+
$SPARK_HOME/lib/spark-examples-1.4.0-hadoop2.6.0.jar
6384
```

bootstrap.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ cd $HADOOP_PREFIX/share/hadoop/common ; for cp in ${ACP//,/ }; do echo == $cp;
1212
# altering the core-site configuration
1313
sed s/HOSTNAME/$HOSTNAME/ /usr/local/hadoop/etc/hadoop/core-site.xml.template > /usr/local/hadoop/etc/hadoop/core-site.xml
1414

15+
# setting spark defaults
16+
echo spark.yarn.jar hdfs:///spark/spark-assembly-1.4.0-hadoop2.6.0.jar > $SPARK_HOME/conf/spark-defaults.conf
17+
cp $SPARK_HOME/conf/metrics.properties.template $SPARK_HOME/conf/metrics.properties
1518

1619
service sshd start
1720
$HADOOP_PREFIX/sbin/start-dfs.sh

0 commit comments

Comments
 (0)