DIY

とりあえずやってみるのメモ。技術的なメモもありますが、独り言もあります。

Apache Flink インストールメモ

Apache Flinkを触りたくなったのでインストール

1. パッケージインストール

# wget http://ftp.meisei-u.ac.jp/mirror/apache/dist/flink/flink-0.8.1/flink-0.8.1-bin-hadoop1.tgz
# tar xvzf flink-0.8.1-bin-hadoop1.tgz
# mv flink-1.3.1 /usr/local/lib/flink 

2. 起動&動作確認

# cd /usr/local/lib/flink
# ./bin/start-local.sh
Starting jobmanager daemon on host localhost.localdomain.

ワードカウント用ファイルダウンロード
# wget -O hamlet.txt http://www.gutenberg.org/cache/epub/1787/pg1787.txt

実行
# ./bin/flink run examples/batch/WordCount.jar -input hamlet.txt -output wordcount-result.txt
Cluster configuration: Standalone cluster with JobManager at localhost/127.0.0.1:6123
Using address localhost:6123 to connect to JobManager.
JobManager web interface address http://localhost:8081
…
Job with JobID d5f7a38994f48e95a40c24c3a940e202 has finished.
Job Runtime: 11847 ms

結果確認
# cat wordcount-result.txt | sort -rnk2
the 1163
and 1039
to 806
of 763
i 631
you 590
a 587
my 520
in 460
it 432
that 427
is 412
ham 358
this 338
not 334
for 310
d 306
his 304
with 295
but 278
your 261

ハムレットで一番でてくる単語はtheでした。