$ bin/spark-shell --master spark://localhost:7077
Spark Shell
Connect to spark cluster
Assuming that spark cluster is running on localhost machine. The default port of spark master is 7077.
Add additional jars to classpath
If you have additional jars necessary to run HDFS operations like additional codecs LZO codec.
$ bin/spark-shell --master spark://localhost:7077 --jars $HADOOP_INSTALL/lib/hadoop-lzo.jar