Scala + Apache Spark를 IntelliJ에서 개발하는 방법
htp : /// spark. 아파치. 오 rg / 두 cs / 아 st / 쿠이 ck-s rt. HTML
Apache Spark 준비
Spark 소스 코드 다운로드
git clone git://github.com/apache/spark.git -b branch-1.6
Spark 빌드
maven 설치
- 例えば,http://qiita.com/chosan211/items/1472198165442e93047e などを参照してインストールする
- 手元のmac環境の場合は,macports を使って下記のように簡単にインストールできた
- `$sudo port install maven3`
- `$sudo port select --set maven maven3`
- `$ mvn --version`
yk-tanigawa$ sudo port install maven3
---> Computing dependencies for maven3
---> Dependencies to be installed: maven_select
---> Fetching archive for maven_select
---> Attempting to fetch maven_select-0.3_1.darwin_14.noarch.tbz2 from https://packages.macports.org/maven_select
---> Attempting to fetch maven_select-0.3_1.darwin_14.noarch.tbz2.rmd160 from https://packages.macports.org/maven_select
---> Installing maven_select @0.3_1
---> Activating maven_select @0.3_1
---> Cleaning maven_select
---> Fetching archive for maven3
---> Attempting to fetch maven3-3.3.9_0.darwin_14.noarch.tbz2 from https://packages.macports.org/maven3
---> Attempting to fetch maven3-3.3.9_0.darwin_14.noarch.tbz2.rmd160 from https://packages.macports.org/maven3
---> Installing maven3 @3.3.9_0
---> Activating maven3 @3.3.9_0
To make maven 3.3.9 the default, please run
sudo port select --set maven maven3
---> Cleaning maven3
---> Updating database of binaries
---> Scanning binaries for linking errors
---> No broken files found.
yk-tanigawa$ sudo port select --set maven maven3
Selecting 'maven3' for 'maven' succeeded. 'maven3' is now active.
yk-tanigawa$ mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T01:41:47+09:00)
Maven home: /opt/local/share/java/maven3
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"
Spark 빌드
$ cd spark
$ build/mvn -Pyarn -Phadoop-2.4 -Dhadoop.version=2.4.0 -DskipTests clean package
IntelliJ 설정
다운로드 & 설치
IntelliJ로 새 프로젝트 만들기
build.sbt
에 spark의 Library를 사용한다는 것을 덧붙입니다.jar 파일로 결합
sbt package
명령을 실행하고 소스 코드를 jar 파일로 결합합니다.yk-tanigawa$ sbt package
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384m; support was removed in 8.0
[info] Loading project definition from /Users/yk-tanigawa/IdeaProjects/scala-spark-example01/project
[info] Set current project to scala-spark-example01 (in build file:/Users/yk-tanigawa/IdeaProjects/scala-spark-example01/)
[info] Updating {file:/Users/yk-tanigawa/IdeaProjects/scala-spark-example01/}scala-spark-example01...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/yk-tanigawa/IdeaProjects/scala-spark-example01/target/scala-2.11/classes...
[info] Packaging /Users/yk-tanigawa/IdeaProjects/scala-spark-example01/target/scala-2.11/scala-spark-example01_2.11-1.0.jar ...
[info] Done packaging.
[success] Total time: 27 s, completed May 6, 2016 2:20:21 PM
spark–submit을 사용하여 프로그램을 실행합니다.
$ ./bin/spark-submit --class "SimpleApp" --master local[2] ~/IdeaProjects/scala-spark-example01/target/scala-2.11/scala-spark-example01_2.11-1.0.jar
무사히 실행되었습니다.
Lines with a: 58, Lines with b: 26
Reference
이 문제에 관하여(Scala + Apache Spark를 IntelliJ에서 개발하는 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/yk-tanigawa/items/4fc86c7e0e529c3b2fa0텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)