Presto インストール方法
Prestoの速さ、便利さに驚愕しているにいやんです。
こんばんわ。
Prestoとは簡単に言うと、HiveやCassandra,Mysqlなどにつなぐことが出来る高速なSQLクエリエンジンです。
Prestoについての概要などは以下の資料がわかりやすいと思います。
てなわけで、Prestoのインストール方法です。
基本的にはprestoの公式ページ参照にしていただければ、よいと思います。
https://prestodb.io/docs/current/installation/deployment.html
今回インストールしたprestoのバージョンは0.100です。
Coodinator1台 Woker3台で作ってみました
0.100ではJava 8,python2.4以上が必要になるので、事前に入れておきましょう。
wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
wgetしたら適当なディレクトリに解凍してPATHを通しておきましょう
次にprestoの取得です。
# prestoをインストールする適当なディレクトリに移動
wget --no-check-certificate https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.100/presto-server-0.100.tar.gz
tar zxvf presto-server-0.100.tar.gz
cd presto-server-0.100
# etc ディレクトリ作成
mkdir etc
# presto data用ディレクトリ作成
# 場所はどこでも良いが,上記でインストールしたpresto-server内にするとバージョンUPが
# 大変になるので、そこには作るなと公式が言っている
mkdir -p /var/presto/data
各種設定ファイル作成
# node設定ファイル作成
# node.idはcoodinator,workerでそれぞれ違う任意の値に 値はなんでもよい
vi etc/node.properties
# node.environment=production
# node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
# node.data-dir=/var/presto/data
# jvm設定ファイル作成
vi etc/jvm.config
# -server
# -Xmx16G
# -XX:+UseConcMarkSweepGC
# -XX:+ExplicitGCInvokesConcurrent
# -XX:+AggressiveOpts
# -XX:+HeapDumpOnOutOfMemoryError
# -XX:OnOutOfMemoryError=kill -9 %p
# Coodinator用設定ファイル作成
# task.max-memoryの設定によって処理出来るデータ量が決まる
vi etc/config.properties
# coordinator=true
# node-scheduler.include-coordinator=false
# http-server.http.port=8080
# task.max-memory=1GB
# discovery-server.enabled=true
# discovery.uri=http://{coodinatorのサーバ名}:8080
# worker用設定ファイル作成
# task.max-memoryの設定によって処理出来るデータ量が決まる
vi etc/config.properties
# coordinator=false
# http-server.http.port=8080
# task.max-memory=1GB
# discovery.uri=http://{coodinatorのサーバ名}:8080
# log設定ファイル作成
vi etc/log.properties
# com.facebook.presto=INFO
今回はhiveにつなぐのでhive用の設定ファイル作成
mkdir etc/catalog
# hive設定ファイル作成
vi etc/catalog/hive.properties
# connector.name=hive-cdh5
# hive.metastore.uri=thrift://{hiveメタストアサーバ名}:9083
# hive.config.resources=/etc/hadoop/conf/core-site.xml,/etc/hadoop/conf/hdfs-site.xml
ここまで出来たらcoodinator,workerの順に起動
# まずフォアグラウンドで実行してみる
bin/launcher run
# エラーなど起きなかったらバックグラウンド実行
bin/launcher start
wget --no-check-certificate https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.100/presto-cli-0.100-executable.jar
mv presto-cli-0.100-executable.jar bin/presto
#実行権限付与
chmod +x bin/presto
bin/presto --server localhost:8080 --catalog hive
# 接続出来た!!
show tables;
# などで確認出来る。
次回はcliツールのさらなる使い方、複数のhiveやMysqlなどへのつなぎ方を書こうと思います。
mysqlとhiveのjoinなども出来ますよ!
参考にしたサイト