Database JUNKY

MySQL,MariaDBを中心としたブログです

OSSなDWH Infobrightの話 ① インストール

以前、GreemPlumについて調べてみようかな?と書きましたが、セットアップが複雑すぎてにっちもさっちもいかないので、今回はinfobrightの 環境構築について、記載したいと思います。まず、DWHとは何か?データベース技術者としては、DWHって何のために存在するのが、すごく理解 に苦しみます。どこからが、DWHでどこからが、DBMSなんでしょうか?一般的な、DWHってどんなものをいうのか?調べてみました。

これかな? http://e-words.jp/w/DWH.html DWH  【Data WareHouse】 (データウェアハウス) 時系列に蓄積された大量の業務データの中から、各項目間の関連性を分析するシステム。単純な例をあげると、コンビニの売上データから 「月曜日に雑誌を買う30代の男性は一緒にコーヒーを買うことが多い」「肉まんは雨の日に最もよく売れる」など、従来の単純な集計では明らかにならなかった 各要素間の関連を洗い出してくれるのがデータウェアハウスシステムである。

これがgoogleの検索結果上位に君臨するのですが。。これ。。なんか違う気がします。 この話って、DWHではなくてデータマイニングとかテキストマイニングの話じゃなくて?個人的な感覚では、DWHだけあっても何もできないと思うのです。 じゃあ、何をもってDWHというのか?に関しては、wikipediaな適切なのかな?と思います。

DWH  【Data WareHouse】 (データウェアハウス) データウェアの提唱はビル・インモン(William H. Inmon)氏で、1990年の著作によれば、「データウェアハウスは、意志決定(Decision)のため、目的別(Purpose-oriented)に編成され、 統合(Integrate)された時系列で、削除(Delete)や更新(Update)しないデータの集合体」とされる。 複数の基幹系システム(メインフレーム)、スーパーマーケットのレジPOSシステム 、製造管理システム、販売管理システム、会計システムなど)から、トランザクション(取引)を抽出して、 再構成(Re-structure)・再蓄積(Re-store)したシステムを指すことが多い。単純に直訳すると、データの倉庫ですね。僕的な解釈では、何に活用できるかわからないけど、とにかく過去のデータを、放り込んでおくのに適したものであるという認識であってますかね。 削除や更新のないっていうのは、ここ最近ではできるもののほうが、多くなってきた気がしますが、基本ポリシーはきっととにかくぼこぼこデータを放り込んで利用するものなんでしょう。 ただ、ぼこぼこ放り込むだけであれば、DBMSでもできるわけで、じゃー何が違うの?なのですが、大きく違うところでは、「チューニング不要」と点ではないかと思います。 一般的な、データベースでは、ただ放り込むだけでは、満足のいくレスポンスは期待できないわけでパラメタのチューニングをしたり索引を設定したりするわけです。誰がどんな検索および集計を するのかわからないものを、どう最適化するのか?なんて考えると、一生チューニングしていけなければいけないのか?なんて考えますよね。正直それはいやです。普通。

話を、元にもどしますが、一昔前までのDWHって、TERADATAとか、REDBRICKとか果てしなく高価か製品がメインだったので、多数の企業様は躊躇する状態だったと思うのですが、 ここ最近では、OSSベースのDWH商品がではじめており、また、コアDBMSが、MySQL,PostgreSQLベースものものが、いくつかでてきたおかげで、DWHの導入を目標とする企業様が 復活してきた感じがしております。

前回、GreenPlumというPostgreSQLベースのインストール試そうと思いましたが、手順のが悪いのかうまく構築できなかったので、今回はInfoBrightという、MySQLベースのDWHについての 設定を説明していきたいと思います。以下に手順を記載します。

  1. infobrightのダウンロード 以下のコマンドを実行し、任意のディレクトリにダウンロードします。

    wget http://downloads.sourceforge.net/project/infobright/ICE%20v3.3.1%20for%20Linux/infobright-3.3.1-i686-ice.rpm?use_mirror=jaist

  2. インストール

    rpm -ivh infobright-3.3.1-i686-ice.rpm

    準備中…                ########################################### [100%] Installing infobright 3.3.1 i686 The installer will generate /tmp/ib3.3.1-install.log install trace log. 1:infobright             ########################################### [100%] Creating/Updating datadir and cachedir Creating user mysql and group mysql Installing default databases Installing MySQL system tables… OK Filling help tables… OKTo start mysqld at boot time you have to copy support-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/local/infobright/bin/mysqladmin -u root password 'new-password' /usr/local/infobright/bin/mysqladmin -u root -h neji.konoha.local password 'new-password' Alternatively you can run: /usr/local/infobright/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default.  This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr/local/infobright ; /usr/local/infobright/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/local/infobright/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/local/infobright/scripts/mysqlbug script! The latest information about MySQL is available at http://www.mysql.com/ Support MySQL by buying support/licenses from http://shop.mysql.com/ System Physical memory: 1010(MB) System memory too low! Infobright optimal ServerMainHeapSize is set to 400(MB) Infobright optimal ServerCompressedHeapSize is set to 200(MB) Infobright optimal LoaderMainHeapSize is set to 300(MB) Infobright server installed into folder /usr/local/infobright Installation log file /tmp/ib3.3.1-install.log

To activate infobright server, please run ./postconfig.sh script from /usr/local/infobright-3.3.1-i686. Example command: cd /usr/local/infobright-3.3.1-i686; ./postconfig.sh 3. 環境設定

cd /usr/local/infobright

sh postconfig.sh

Infobright post configuration

Infobright server activated.

Register your copy of ICE and receive a free copy of the User Manual (a $50 value) as well as a copy of the Bloor Research Spotlight Report "What's Cool About Columns" which explains the differences and benefits of a columnar versus row database. Registration will require opening an HTTP connection to Infobright, do you wish to register now? [Y/N]:N Register now http://www.infobright.org/Downloads/ICE/. 4. infobrightの起動

/etc/init.d/mysqld-ib start

Starting MySQL.                                            [  OK  ] 5. mysql-ib コンソールを立ち上げ、状態を確認する。

/usr/local/infobright/bin/mysql

Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.40-log build number (revision)=IB_3.3.1_r6997_7017(ice)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 6. 現在のステータスを確認する。(赤字の部分の設定では、日本語が文字化けする) mysql> STATUS;

/usr/local/infobright/bin/mysql  Ver 14.14 Distrib 5.1.40, for pc-linux-gnu (i686) using  EditLine wrapperConnection id:          2 SSL:                    Not in use Current pager:          stdout Using outfile:          ” Using delimiter:        ; Server version:         5.1.40-log build number (revision)=IB_3.3.1_r6997_7017(ice) Protocol version:       10 Connection:             Localhost via UNIX socket Client characterset:    latin1 Server characterset:    latin1 UNIX socket:            /tmp/mysql-ib.sock Uptime:                 6 min 17 sec

Threads: 1  Questions: 9  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second avg: 0.23

mysql> \q 7. 文字コードを、UTF-8に変更する。(以下の箇所を追記/変更)

vi /etc/my-ib.cnf

[client] default-character-set=utf8

[mysqld] default-character-set=utf8 skip-character-set-client-handshake 8. 上記で修正したら、再起動して設定が反映されていることを確認 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> STATUS;

/usr/local/infobright/bin/mysql  Ver 14.14 Distrib 5.1.40, for pc-linux-gnu (i686) using  EditLine wrapper Connection id:          1 SSL:                    Not in use Current pager:          stdout Using outfile:          ” Using delimiter:        ; Server version:         5.1.40-log build number (revision)=IB_3.3.1_r6997_7017(ice) Protocol version:       10 Connection:             Localhost via UNIX socket Client characterset:    utf8 Server characterset:    utf8 UNIX socket:            /tmp/mysql-ib.sock Uptime:                 11 sec Threads: 1  Questions: 4  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second avg: 0.363