Scroll indicator done
728x90

virtual box 다운로드 https://www.virtualbox.org/wiki/Downloads

가상머신 만들기 이름 스파크2 리눅스, 우분투로 설정 - 메모리 4096 -  새 가상 디스크 만들기 - VDI - 동적 할당 - 하드 20 

 

Ubuntu 18.04.5 LTS (Bionic Beaver)

Select an image Ubuntu is distributed on three types of images described below. Desktop image The desktop image allows you to try Ubuntu without changing your computer at all, and at your option to install it permanently later. This type of image is what m

releases.ubuntu.com

ubuntu 이미지 다운받은 경로로 설정 - welcome에서 언어 english로 (한국어로 하면 오류날 수도 있어서) install Ubuntu - english/english - install third-party~ 체크 - erase 된 채로 install now - continue - seoul - 이름이랑 컴퓨터 이름 동일하게 설정, name: master/pw: 9407740 Log in automatically 선택하고 continue 

 

 

목표: 바이너리 파일 통해 스파크..?

LTS Upgrade don't Upgrade 선택 - 우분투 Upgrade도 cancel - update software remind

 

게스트 확장 CD이미지 삽입 - run - pw입력 - 완료

Restart 후 - activities/terminal 

 

#spark홈페이지에서 다운 안 받고 편하게 사용하기

pip3 install 

sudo apt install open 

sudo apt install openjdk-8-jdk -y 

java -version => openjdk version "1.8.0_292"

which java => /usr/bin/java

sudo update-alternatives --config java => Nothing to configure

sudo update-alternatives -config python => 파이썬 아직 안깔아서 x

sudo apt install scala -y

scala -version => scala code runner version 2.11.12

sudo apt install python3 -y (알아서 버전에 맞게 다운받아짐)

which python3 => /usr/bin/python3

nano ~/.bashrc

export SPARK_HOME=/home/master/spark-2.4.8-bin-hadoop2.7

export PATH=$PATH:$SPARK_HOME/bin:$SPARK_HOME/sbin

export PYSPARK_PYTHON=/usr/bin/python3

ctrl x  

y

enter

source ~/.bashrc

$SPARK_HOME => 아무것도 없다고 뜸 다운 안받았기 때문에

https://www.apache.org/dyn/closer.lua/spark/spark-2.4.8/spark-2.4.8-bin-hadoop2.7.tgz

 

Apache Download Mirrors

We suggest the following mirror site for your download: https://mirror.navercorp.com/apache/spark/spark-2.4.8/spark-2.4.8-bin-hadoop2.7.tgz Other mirror sites are suggested below. It is essential that you verify the integrity of the downloaded file using t

www.apache.org

pwd => /home/master

cd $SPARK_HOME/bin

pyspark

sc. 하고 Ctrl+tab 키 (=자동완성)

res = sc.textFile("/home/master/spark-2.4.8-bin-hadoop2.7/README.md")

res.first() => 'Apache Spark'

exit()

 

python3

sc. tab => 안됨

from pyspark import SparkContext, SparkConf

exit()

pip3 install pyspark

sudo apt install python3-pip

intellij 다운, extract

cd ~/

cd idea-IC-211.7442.40/bin/

ls

./idea.sh => intellij 켜진다fro

pip3 install pyspark==2.4.8 => 파이썬 pyspark 다운 완료

python3

from pyspark import SparkContext, SparkConf

 

master 창에서 ./spark-submit 

코드를 밖에서 작성할 때 써야함 . 왜? 외부에서 작성한 파일 넘겨줄 때?

cd idea-IC-211.7442.40/bin/ (idea 후 tab하면 자동완성) 후에 ./idea.sh

 

install 후 restart 두 번 클릭

(+++ 장치/클립보드 공유/양방향 하면 편함)

new Project - empty project 

 

 

###숙제

python3

스파크강의2

tranformation 에 있는 모든 코드 ch2

storageLevel 파티션? 빼내오기?

예제실행 방법 주석 제거하고 실행해보기

슬라이드의 코드 설명 기반 직접 코드 돌려보기 

intellij에서 파이썬 3.6.9로 설정하면 사용 가능

map부터 sample까지 하나하나 실행해보기 RDDOpSample.py spark submit ? 으로 제출할 수 있음 뭘?

코드가 어떤 의도인지만 써놓음

spark.apache.org/docs/2.4.8/api/python에서 검색해보면서 코드 안 인자 공부

 

2장 Sample까지

함수 코딩해보기

트랜스포메이션 - 액션 - sql - 머신러닝 라이브러리까지

 

우분투 18.0

728x90