Not logged in. Login

Compute Cluster

We have a relatively modest Hadoop cluster for this course: 4 nodes, 60 cores, 128GB memory, 16TB storage.

Connecting Remotely

The goal here is to connect to by SSH.

From On-Campus

[This will work if you are within the campus network (or have the SFU VPN).]

You will be connecting to the cluster a lot: you may want to get things set up more nicely to make your life easier later. But, this should at least work.

You generally just need to SSH to (substituting whatever SSH method you use on your computer):

[yourcomputer]$ ssh -p24 <USERID> 

Once you're connected to the cluster gateway, you can start running spark-submit (and hdfs) commands.

If you need access to the web frontends in the cluster, you can do the initial SSH with a longer command including some port forwards:

ssh -p24 -L 9870:controller.local:9870 -L 8088:controller.local:8088 <USERID>

From On-Campus With SSH Keys

Once you have confirmed that you can connect, get things set up properly

Create an SSH key (if you don't have one already) so you can log in without a password. Then copy your public key into .ssh/authorized_keys on the server (with ssh-copy-id or by appending to ~/.ssh/authorized_keys).

Create (or add to) the ~/.ssh/config file on your computer. With this config, you can simply ssh to connect. (bonus: tab-completion)

  User <USERID>
  Port 24
  LocalForward 8088 controller.local:8088
  LocalForward 9870 controller.local:9870

With this configuration, port forwards will let you connect (in a limited unauthenticated way) to the web interfaces:

Copying Files

You will also frequently need to copy files to the cluster:

[yourcomputer]$ scp <USERID>

Or whatever your preferred SCP/SFTP method is.

From Off-Campus

From off-campus networks, you need an extra hop to get to the cluster. The most reliable is probably to ssh to (port 24). We need to do a two-step port forward. On a Linux-like system, you can add this to your ~/.ssh/config to forward from your computer to the gateway:

  User <USERID>
  Port 24
  LocalForward 8088 localhost:8088
  LocalForward 9870 localhost:9870
  ServerAliveInterval 120

Then on gateway.csil, you can set up an SSH key and config so connecting is easy in the future:

ssh-keygen -t ed25519
echo -e "Host\n Port 24\n ServerAliveInterval 120\n LocalForward 8088 controller.local:8088\n LocalForward 9870 controller.local:9870" >> ~/.ssh/config

Then to connect:


Copying Files

Copying files will also be a two-step process: to gateway.csil, and then from there:


Spark Applications

Once you have the code there, you can start jobs as usual with spark-submit, and they will be sent to the cluster:

spark-submit ...

Cleaning Up

If you have unnecessary files sitting around (especially large files created as part of an assignment), please clean them up with a command like this:

hdfs dfs -rm -r output*

It is possible that you have jobs running and consuming resources without knowing: maybe you created an infinite loop or otherwise have a job burning memory or CPU. You can list jobs running on the cluster like this:

yarn application -list

And kill a specific job:

yarn application -kill <APPLICATION_ID>
Updated Fri July 16 2021, 13:11 by ggbaker.