0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Spark環境構築

Last updated at Posted at 2019-02-11

Sparkのインストール

Sparkの最新版(2018/10までの最新バージョン)をダウンロードします。

$ cd /usr/local/opt 
$ wget https://dist.apache.org/repos/dist/release/spark/spark-2.4.0/spark-2.4.0-bin-hadoop2.7.tgz
$ tar -zxf spark-2.4.0-bin-hadoop2.7.tgz
ln -s spark-2.4.0-bin-hadoop2.7 spark

Sparkの環境変数

Sparkの環境変数は、個人の好む環境変数設定ファイルに設定すれば良いですが、こちらはユーザー自身のbash_profileに設定しておりました。
bash_profileとは、ログインシェルがbashの状態でログインしたときに読み込まれる設定ファイルです。

# 「~/.bash_profile」に以下を追加する
export SPARK_HOME="/usr/local/opt/spark"
export PATH="$SPARK_HOME/bin:$SPARK_HOME/sbin:$PATH"
# 有効にする
source ~/.bash_profile

Sparkを動かしてみる

spark-shellコマンドを実行して見て、Sparkの環境が正常に高築されているかどうかを確認しましょう。

$ spark-shell
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /___/ .__/\_,_/_/ /_/\_\   version 2.4.0
      /_/
Using Scala version 2.11.12 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_191)
Type in expressions to have them evaluated.
Type :help for more information.</font>
scala> println("hello spark!")
hello spark!
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?