text stringlengths 0 59.1k |
|---|
The Spark UI Proxy is taken from https://github.com/aseigneurin/spark-ui-proxy. |
The PySpark examples are taken from http://stackoverflow.com/questions/4114167/checking-if-a-number-is-a-prime-number-in-python/27946768#27946768 |
## Step Zero: Prerequisites |
This example assumes |
- You have a Kubernetes cluster installed and running. |
- That you have the ```kubectl``` command line tool installed in your path and configured to talk to your Kubernetes cluster |
- That your Kubernetes cluster is running [kube-dns](https://github.com/kubernetes/dns) or an equivalent integration. |
Optionally, your Kubernetes cluster should be configured with a Loadbalancer integration (automatically configured via kube-up or GKE) |
## Step One: Create namespace |
Create the namespace by executing the following command using `kubectl`: |
```sh |
kubectl create -f examples/staging/spark/namespace-spark-cluster.yaml |
``` |
Now list all namespaces: |
```sh |
$ kubectl get namespaces |
NAME LABELS STATUS |
default <none> Active |
spark-cluster name=spark-cluster Active |
``` |
To configure kubectl to work with our namespace, we will create a new context using our current context as a base with the following commands: |
```sh |
CURRENT_CONTEXT=$(kubectl config view -o jsonpath='{.current-context}') |
USER_NAME=$(kubectl config view -o jsonpath='{.contexts[?(@.name == "'"${CURRENT_CONTEXT}"'")].context.user}') |
CLUSTER_NAME=$(kubectl config view -o jsonpath='{.contexts[?(@.name == "'"${CURRENT_CONTEXT}"'")].context.cluster}') |
kubectl config set-context spark --namespace=spark-cluster --cluster=${CLUSTER_NAME} --user=${USER_NAME} |
kubectl config use-context spark |
``` |
## Step Two: Start your Master service |
The Master [service](https://kubernetes.io/docs/concepts/services-networking/service/) is the master service |
for a Spark cluster. |
Use the |
[`examples/staging/spark/spark-master-controller.yaml`](spark-master-controller.yaml) |
file to create a |
[replication controller](https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/) |
running the Spark Master service. |
```console |
$ kubectl create -f examples/staging/spark/spark-master-controller.yaml |
replicationcontroller "spark-master-controller" created |
``` |
Then, use the |
[`examples/staging/spark/spark-master-service.yaml`](spark-master-service.yaml) file to |
create a logical service endpoint that Spark workers can use to access the |
Master pod: |
```console |
$ kubectl create -f examples/staging/spark/spark-master-service.yaml |
service "spark-master" created |
``` |
### Check to see if Master is running and accessible |
```console |
$ kubectl get pods |
NAME READY STATUS RESTARTS AGE |
spark-master-controller-5u0q5 1/1 Running 0 8m |
``` |
Check logs to see the status of the master. (Use the pod retrieved from the previous output.) |
```sh |
$ kubectl logs spark-master-controller-5u0q5 |
starting org.apache.spark.deploy.master.Master, logging to /opt/spark-1.5.1-bin-hadoop2.6/sbin/../logs/spark--org.apache.spark.deploy.master.Master-1-spark-master-controller-g0oao.out |
Spark Command: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -cp /opt/spark-1.5.1-bin-hadoop2.6/sbin/../conf/:/opt/spark-1.5.1-bin-hadoop2.6/lib/spark-assembly-1.5.1-hadoop2.6.0.jar:/opt/spark-1.5.1-bin-hadoop2.6/lib/datanucleus-rdbms-3.2.9.jar:/opt/spark-1.5.1-bin-hadoop2.6/lib/datanucleus-core-3.2.10.jar:/opt/spark-... |
======================================== |
15/10/27 21:25:05 INFO Master: Registered signal handlers for [TERM, HUP, INT] |
15/10/27 21:25:05 INFO SecurityManager: Changing view acls to: root |
15/10/27 21:25:05 INFO SecurityManager: Changing modify acls to: root |
15/10/27 21:25:05 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); users with modify permissions: Set(root) |
15/10/27 21:25:06 INFO Slf4jLogger: Slf4jLogger started |
15/10/27 21:25:06 INFO Remoting: Starting remoting |
15/10/27 21:25:06 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkMaster@spark-master:7077] |
15/10/27 21:25:06 INFO Utils: Successfully started service 'sparkMaster' on port 7077. |
15/10/27 21:25:07 INFO Master: Starting Spark master at spark://spark-master:7077 |
15/10/27 21:25:07 INFO Master: Running Spark version 1.5.1 |
15/10/27 21:25:07 INFO Utils: Successfully started service 'MasterUI' on port 8080. |
15/10/27 21:25:07 INFO MasterWebUI: Started MasterWebUI at http://spark-master:8080 |
15/10/27 21:25:07 INFO Utils: Successfully started service on port 6066. |
15/10/27 21:25:07 INFO StandaloneRestServer: Started REST server for submitting applications on port 6066 |
15/10/27 21:25:07 INFO Master: I have been elected leader! New state: ALIVE |
``` |
Once the master is started, we'll want to check the Spark WebUI. In order to access the Spark WebUI, we will deploy a [specialized proxy](https://github.com/aseigneurin/spark-ui-proxy). This proxy is necessary to access worker logs from the Spark UI. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.