Advertisement
Guest User

spark setup

a guest
Jan 22nd, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ### paste this file to user data field as text
  4.  
  5. ### make sure to replace <master-private-ip> and <worker-private-ip1> with your own IP addresses. Replace <id_rsa.pub> with your own as well
  6.  
  7. ### it works best when you launch a master first and configure it and then launch 1 slave with the id_rsa of the master. You can create an image of the slave and apply that image to as many slaves as needed. make sure to add slave private IPs to spark configuration
  8.  
  9. apt-get update
  10.  
  11. #apt-get install nano
  12.  
  13. apt-get -y install apt install openjdk-8-jre-headless
  14.  
  15. apt-get -y install scala
  16.  
  17. apt-get -y install python3-pip
  18.  
  19. apt-get -y install openssh-server openssh-client
  20.  
  21. apt install curl
  22.  
  23. curl -O http://www.gtlib.gatech.edu/pub/apache/spark/spark-3.0.0-preview2/spark-3.0.0-preview2-bin-hadoop2.7.tgz
  24.  
  25. tar xvf spark-3.0.0-preview2-bin-hadoop2.7.tgz
  26.  
  27. mv "/spark-3.0.0-preview2-bin-hadoop2.7/" /usr/local/spark
  28.  
  29. ###master: uncomment below when setting up master
  30.  
  31. #echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/" | sudo tee /usr/local/spark/conf/spark-env.sh
  32.  
  33.  
  34. ###slaves: uncomment below when setting up slave
  35. echo '<id_rsa.pub>' | sudo tee -a ~/.ssh/authorized_keys
  36.  
  37.  
  38.  
  39. ###########################################################################################################
  40.  
  41.  
  42. ###Do this manually after EC2 instance is finished installing
  43.  
  44. echo 'export PATH=/usr/local/spark/bin:$PATH' >> ~/.bash_profile
  45.  
  46. source ~/.bash_profile
  47.  
  48. ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
  49.  
  50. ###Master only:
  51. ###copy and paste the output to a text doc and save for slaves
  52. cat ~/.ssh/id_rsa.pub
  53. sudo chmod -R a+rwx /usr/local/spark
  54. echo 'export SPARK_MASTER_HOST=<master-private-ip>' | sudo tee -a /usr/local/spark/conf/spark-env.sh
  55. ###Master only:duplicate this line with as many slaves as needed
  56. echo '<worker-private-ip1>'' | sudo tee -a /usr/local/spark/conf/slaves
  57.  
  58.  
  59.  
  60. ###########################################################################################################
  61. ###Checks on master
  62.  
  63. ### be able to connect to slaves
  64. #ssh -i ~/.ssh/id_rsa ubuntu@<worker-private-ip1>
  65.  
  66. ### launch spark
  67. ### sudo sh /usr/local/spark/sbin/start-all.sh
  68.  
  69. ### get the port for your security settings
  70. #ps aux|grep -i spark
  71.  
  72. ### spark UI
  73. #publicDNS (IPv4):8080
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement