Skip to content

Instantly share code, notes, and snippets.

@juanpampliega
Last active October 3, 2015 05:38
Show Gist options
  • Save juanpampliega/9bd3a0533fe8825ac78f to your computer and use it in GitHub Desktop.
Save juanpampliega/9bd3a0533fe8825ac78f to your computer and use it in GitHub Desktop.
Download Twitter dependencies for Spark Streaming and execute spark-shell with them
#!/usr/bin/env bash
USER_NAME=hbd
USER_HOME="/home/$USER_NAME"
cd $USER_HOME
mkdir $USER_HOME/twitter4j
cd $USER_HOME/twitter4j
# Get the Spark Streaming JAR.
curl -O "http://central.maven.org/maven2/org/apache/spark/spark-streaming-twitter_2.10/1.5.0/spark-streaming-twitter_2.10-1.5.0.jar"
TWITTER4J_SOURCE=twitter4j-3.0.3.zip
wget "http://twitter4j.org/archive/$TWITTER4J_SOURCE"
unzip -j ./$TWITTER4J_SOURCE "lib/*.jar" -d $USER_HOME/twitter4j/
wget "http://central.maven.org/maven2/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar"
cd $USER_HOME
# Point the shell to these JARs and go!
TWITTER_DEPS_JARS=$(ls -m $USER_HOME/twitter4j/*.jar | tr -d '\n')
$USER_HOME/spark/bin/spark-shell --jars $TWITTER_DEPS_JARS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment