apache flink mac에 install 해보기

이글에서는 개인 맥북에 apache flink를 설치하는 것을 다루려고 한다. hadoop 시스템과의 연동은 여기서 다루지 않는다.

Flink



1. 아래의 사이트에서 최신 or 사용할 버전의 플링크를 다운로드 받는다.

또는 
brew install apache-flink
와 같이 homebrew를 통해 설치가 가능하다.

2. 플링크를 적절한 폴더에 옮기고 bin폴더를 path에 등록 한다.
적절히 등록이 되었다면 flink --version 명령어가 잘 동작 한다.

3. bin 폴더의 start-cluster.sh 를 실행 한다.

(base) LM-SEL-16517004:bin mgim$ ./start-cluster.sh

Starting cluster.

Starting standalonesession daemon on host LM-SEL-16517004.

Starting taskexecutor daemon on host LM-SEL-16517004.

(base) LM-SEL-16517004:bin mgim$ 


4. 문제없이 실행될 경우 아래 URL에서 UI를 확인 할 수 있다.


http://localhost:8081/#/overview



예제 코드 돌려보기
flink ui를 올려보았으니 예제를 돌려보기로 한다.
예제 코드는 개인 깃허브에서 참고 할 수 있다. 

코드에서 mvn install을 하면 나오는 jar 파일을 아래와 같이 flink 명령어를 통해서 실행 시킬 수 있다.

(base) LM-SEL-16517004:Desktop mgim$ flink run -c WordCount wordcount-1.0-SNAPSHOT.jar 

Job has been submitted with JobID 4064689d15308387f381999c4923c9fc

Program execution finished

Job with JobID 4064689d15308387f381999c4923c9fc has finished.

Job Runtime: 71 ms

Accumulator Results: 

- 5d8021d833abff0dfa34b0e3d5469c7f (java.util.ArrayList) [26 elements]



(a,1)

(against,1)

(and,1)

(arms,1)

(arrows,1)

(be,2)

(fortune,1)

(in,1)

(is,1)

(mind,1)

(nobler,1)

(not,1)

(of,2)

(or,2)

(outrageous,1)

(question,1)

(sea,1)

(slings,1)

(suffer,1)

(take,1)

(that,1)

(the,3)

(tis,1)

(to,4)

(troubles,1)

(whether,1)


명령줄이 아닌 WEB UI를 통하여 하는 방법은 jar파일을 그대로 올린 다음 submit을 하면 된다. 안타까운 점은 위에서는 print한 것이 화면에 출력되었으나 UI를 통하여 업로드를 하면 로그상에는 print 결과값이 보이지 않는다는 점이다.



댓글

이 블로그의 인기 게시물

고려대학교 야간대학원 중간 후기

포켓몬 고 17셀 확인 포고맵 사용 방법

HTTP 오류 500.19 - Internal Server Error 에러 처리법