2014年11月22日土曜日

Hiveのcollect_list

以前はプリミティブなタイプしかつかえなかったが、
0.13からstructやarrayのも使えるようになった。

https://issues.apache.org/jira/browse/HIVE-5294

2014年11月8日土曜日

Hiveのチューニング


少し古いけどオススメ
http://www.slideshare.net/ye.mikez/hive-tuning
2013年7月 (Hive 0.11頃?)
ORCフォーマット(非圧縮)、Tez、パーティション(とバーチャルカラム?)の利用
ソートされたデータを入れる
short circuit read (HDFS-2246)
その他プロパティーの確認項目あり
現在のプロパティーの確認方法
hive>set;

クエリーのパフォーマンス比較 (2014年2月)
https://amplab.cs.berkeley.edu/benchmark/
RedShift, Impala, Shark(SparkSQL), Hive, Tez を比較
(HiveのORCFile, ImpalaのParquetは利用してない)
これを見るとMapReduceからTezに変更するだけで3~4割は早くなる感じ。
すごいのはSparkSQL。Hiveとどの程度互換性があるのか早く確認したい。
Tezも既にHiveに取り込まれて、簡単に利用できるので魅力的。


■ Tezの利用は簡単で効果大。とりあえずTezを利用すべし。
個人的な関心はSparkSQLへ。

Hive on Tez
https://cwiki.apache.org/confluence/display/Hive/Hive+on+Tez

0.13からにHiveに組み込まれている
https://issues.apache.org/jira/browse/HIVE-4660
https://issues.apache.org/jira/browse/HIVE-6098

Tez (Hive Configuration Properties)
https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties#ConfigurationProperties-Tez

Chapter 10. Installing and Configuring Apache Tez
http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.1.5/bk_installing_manually_book/content/rpm-chap-tez.html

■ tezを有効にする(mapredueからtezへ)
set hive.execution.engine=tez;
mapreduceへ戻す
set hive.execution.engine=mr;

2014年10月30日木曜日

Hue Hue だよ

Hueはかっこいい。しかもDjango(ver1.4だけど)でできてる。
(tomcatじゃないよ!!!)
画面はBootstrap, Knockout.js, jQuery

GitHub
https://github.com/cloudera/hue

Hue
http://gethue.com/

Hadoopの標準GUI HUEの最新情報
http://www.slideshare.net/Cloudera_jp/hadoopgui-hue

Hue SDK
http://cloudera.github.io/hue/docs-3.6.0/sdk/sdk.html

Hue関連のニュース
http://gethue-jp.tumblr.com/


インストール、設定
Install Hue without Cloudera
http://stackoverflow.com/questions/20579357/install-hue-without-cloudera

config
http://docs.hortonworks.com/HDPDocuments/HDP1/HDP-1.3.3/bk_installing_manually_book/content/rpm-chap-hue-5.html


2014年10月24日金曜日

hdfsで利用できる列指向フォーマット


現状ではRCFile だけが現実的。
 ORCはHive専用状態。
 Parquet は利用できるデータ型が中途半端。
(たぶん、半年後にはparquetがくるぞー)

Parquet,ORCFile  についてのまとめページ
しかも日本語。
http://ozalog.blogspot.jp/2013/03/rcfileparquetorcfile.html

2014年10月23日木曜日

rails のSECRET_KEY_BASE でエラー


railsをproductionモードで起動したらエラー

Internal Server Error 
Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`

config/secrets.yml
productionモード以外は固定値が入っている。
rails4.1から?

とりあえずこれで動く。
# export SECRET_KEY_BASE=`bundle exec rake secret`
# rails s -e production

実際の運用ではどう設定しようか?

2014年10月21日火曜日

シリアライズ

これらのシリアライズ、デシリアライズは、どの分野でも使える汎用的な物だけど
hadoop (hive)で使うことに絞って書いてます。

JSON (テキスト)
avro, protocol buffer, thrift (バイナリ)
msgpackも良さげだけど、あまり使われていない感じ。

avroなどバイナリ系の規格は、データサイズを押さえる以外にも
データ型を指定できる点が便利。
特に、hive, javaなどとの利用を考えると。

JSONは便利なようで不便な気がする。
(hadoopの世界では)
5 Reasons to Use Protocol Buffers Instead of JSON For Your Next Service

thriftはRPCの機能でもhadoopで便利に使われているので、もっと調べる。
avroはjsonでスキーマ定義できる(テキストエディターでは見れないけど扱いはJSONと同じ感じか?)。

Hive で利用できるSerDe
JSON SerDe
https://github.com/rcongiu/Hive-JSON-Serde
protocol buffer
https://github.com/twitter/elephant-bird

パフォーマンス比較
https://gist.github.com/joshsz/11299196

2014年10月9日木曜日

rbenv のちりぬるを


本家
https://github.com/sstephenson/rbenv
https://github.com/sstephenson/ruby-build
https://github.com/sstephenson/rbenv-default-gems

インストール

# rbenv
$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

# ruby-build
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

# default gems
$ git clone https://github.com/sstephenson/rbenv-default-gems.git ~/.rbenv/plugins/rbenv-default-gems
# すべてのバージョンでbundler を自動インストール
$ echo 'bundler' > ~/.rbenv/default-gems

コマンド

rbenv install --list
rbenv install 2.1.2

# 利用可能なversion (未インストールも含めて)
$ rbenv install --list

# インストールされているversion
$ rbenv versions


■ Todo
user 用とsystem全体
rbenv local と .ruby-version