LoginSignup
0
0

More than 5 years have passed since last update.

EMRのHiveServer2にpythonで接続したメモ

Last updated at Posted at 2014-12-14

試した環境

  • EMR AMI Version 3.3.1
    • Hive + Pig + Impala + Hue

hiveServe2

AMI3.3.1だと、クラスタの準備完了と同時に起動されている。

$ ps -ef | grep hiveserver2
hadoop   27009   539  0 02:03 pts/9    00:00:00 grep hiveserver2
root     31866     1  0 Dec08 pts/1    00:00:00 su - hadoop -c bash -c /home/hadoop/hive/bin/hive --service hiveserver2

ということでなんか起動している。

起動と終了方法は、スクリプトが用意されているので簡単に可能。

# 起動
$ sudo /etc/init.d/hive-serverd start
# 終了
$ sudo /etc/init.d/hive-serverd stop

ログは/mnt/var/log/hive-serveにあるので、一応確認する。

pyhs2のインストールと接続

python用のHiveServer2クライアントはpyhs2がある、
pipで簡単にインストール可能なんで早速やってみる。

$ sudo pip install pyhs2

がこける、のでこいつをインストールしてから実行する。

$ sudo yum install cyrus-sasl-devel.x86_64

これで無事入るはず。

ではいるんだけど、このpipは
/usr/bin/python2.7こっちで利用されていて
/usr/bin/pythonこっちじゃない。
これ、Hueインストール時にで追加されているんかもしれない。

あとはsampleを拝借して
user,passwordをhiveに書き換えてあげれば接続できる。

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