Ubuntu18でApache Impalaをセットアップ。2019-09-11


概要

Ubuntu18で Apache Impala をセットアップします。
とりあえずなんか動いた!というのを確認するところまでやります。

環境

% cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"

VirtualBoxでUbuntuを立ち上げました。
けっこうメモリを使うようで4GだとImpalaをうまく起動できませんでした。
8Gだと起動できました、のでVirtualBoxなどで試す場合は8G程度割り当てると良さそうです。

メモリについて参考: https://qiita.com/kuni-nakaji/items/fb7f47b66ef7a1ba3050

準備

Javaのインストール

% sudo apt-get install openjdk-8-jdk
% java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

Apache Impalaのインストール

% git clone https://gitbox.apache.org/repos/asf/impala.git
% cd ./impala/
% source ./bin/impala-config.sh
% ./bin/bootstrap_development.sh
This script will clobber some system settings. Are you sure you want to
continue? [yes/no]
...(以下略。表示される通りなので実行にはご注意ください))

もりもり構築してる風のログが流れるので終わるまで待ちます。

start-impala-cluster

% source ./bin/impala-config.sh
% ./bin/start-impala-cluster.py

インストールが終わったものへのPATHを通したりするので再度 source したあとで、startするコマンドで起動

確認

% ./bin/impala-shell.sh -q "select version()"
Starting Impala Shell without Kerberos authentication
Opened TCP connection to localhost:21000
Connected to localhost:21000
Server version: impalad version 3.4.0-SNAPSHOT DEBUG (build 4327cc351317878de51003c2dcf4a71c9183eb44)
Query: select version()
Query submitted at: 2019-09-11 03:43:49 (Coordinator: http://ubuntu-bionic:25000)
Query progress can be monitored at: http://ubuntu-bionic:25000/query_plan?query_id=6d4f6ef5b8647892:aae3f67700000000
+---------------------------------------------------------------------------------------+
| version()                                                                             |
+---------------------------------------------------------------------------------------+
| impalad version 3.4.0-SNAPSHOT DEBUG (build 4327cc351317878de51003c2dcf4a71c9183eb44) |
| Built on Wed Sep 11 00:12:07 UTC 2019                                                 |
+---------------------------------------------------------------------------------------+
Fetched 1 row(s) in 0.64

バージョンが表示されて起動したっぽい

インタラクティブシェルを立ち上げると以下の通り

% ./bin/impala-shell.sh
Starting Impala Shell without Kerberos authentication
Opened TCP connection to localhost:21000
Connected to localhost:21000
Server version: impalad version 3.4.0-SNAPSHOT DEBUG (build 4327cc351317878de51003c2dcf4a71c9183eb44)
***********************************************************************************
Welcome to the Impala shell.
(Impala Shell v3.4.0-SNAPSHOT (4327cc3) built on Wed Sep 11 00:12:07 UTC 2019)

You can change the Impala daemon that you're connected to by using the CONNECT
command.To see how Impala will plan to run your query without actually executing
it, use the EXPLAIN command. You can change the level of detail in the EXPLAIN
output by setting the EXPLAIN_LEVEL query option.
***********************************************************************************
[localhost:21000] default>

まとめ

とりあえずApache Impalaが立ち上がったところまででした

補足

./bin/bootstrap_development.sh した後は hdfs など必要なプロセスが立ち上がっているので ./bin/start-impala-cluster.py でimpalaを起動できます。
しかしサーバを再起動したりすると必要なプロセスが立ち上がっていないので、 ./bin/start-impala-cluster.py が失敗します。

その場合は

% sudo systemctl start ntp.service
% ./testdata/bin/run-all.sh

で必要なプロセスを立ち上げると ./bin/start-impala-cluster.py が成功してimpalaが試せる状態になります。

ntpd が起動していないと ./testdata/bin/run-all.sh が失敗するので実行前にstartしています)

パス名から察するにtestdataなので、ちゃんとしたのをinstallした方が良さそう