InfiniDB のインストール on Linux

InfiniDB のインストールにちょこっとつまりかけたので、手順をメモしておく。


# 手順

## 1 InfiniDB + MySQL のダウンロード

github の InfiniDB より今日(2015/09/17)時点での最新版をダウンロード
- Branch: master infinidb-master.zip

同じく、github の InfiniDB/MySQL より最新版をダウンロード
- Branch: develop mysql-develop.zip


## ローカルユーザー作成

今回は、ローカルユーザー管理のもとに InfiniDB を設置するので、
新ユーザーを登録した

```
> useradd infinidb
```


## 3 MySQL の make

InfiniDB ユーザーの作業用ディレクトリに、ダウンロードしたファイルを展開

```
> cd /home/infinidb/work
> unzip mysql-develop.zip

> ls -l
...
drwxrwxr-x 32 infinidb infinidb     4096  9月 17 13:47 2015 mysql-develop
-rw-rw-r--  1 infinidb infinidb 28452038  9月 17 13:29 2015 mysql-develop.zip
...

configure

> cd /home/infinidb/work/mysql-develop
> ./configure --prefix=/home/infinidb/Calpont/mysql

※ MySQL の場合、make に CMAKE を使うものもあると思うけど、その場合は
　こんな感じ?

  > cmake -DCMAKE_INSTALL_PREFIX=/home/infinidb/Calpont/mysql .


make

> make

install

> make install
```

## 3 InfiniDB の make

```
> cd /home/infinidb/work
> unzip infinidb-master.zip

> ls -l
...
drwxrwxr-x 20 infinidb infinidb     4096  9月 17 14:28 2015 infinidb-master
-rw-rw-r--  1 infinidb infinidb 25127360  9月 17 13:28 2015 infinidb-master.zip

configure

> cd /home/infinidb/work/infinidb-master
> ./configure --prefix=/home/infinidb/Calpont

make

> make
```

...

ここで、エラー発生！

...

mkdir .libs
 g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/include/libxml2 -I../../../mysql/include -I../../../mysql/sql -I../../../mysql/regex -DMYSQL_DYNAMIC_PLUGIN -I/home/infinidb/Calpont/include -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/include/libxml2 -g0 -O3 -fno-strict-aliasing -Wall -Wno-unused-local-typedefs -Wno-unused-result -Wno-format -fno-rtti -fno-implicit-templates -MT libcalmysql_la-ha_calpont.lo -MD -MP -MF .deps/libcalmysql_la-ha_calpont.Tpo -c ha_calpont.cpp  -fPIC -DPIC -o .libs/libcalmysql_la-ha_calpont.o
In file included from ha_calpont.h:39,
                 from ha_calpont.cpp:109:
idb_mysql.h:50:24: error: mysql_priv.h: No such file or directory
idb_mysql.h:51:24: error: sql_select.h: No such file or directory
In file included from ha_calpont.h:39,
                 from ha_calpont.cpp:109:
idb_mysql.h:80: error: '<unnamed>::idb_mysql_query_str' declared as an 'inline' variable

(いやっちゅーほどメッセージが出たので割愛)

ha_calpont.cpp:1007: warning: no return statement in function returning non-void
ha_calpont.cpp: At global scope:
ha_calpont.cpp:1009: error: expected initializer before '*' token
ha_calpont.cpp:1016: error: variable 'st_mysql_storage_engine infinidb_storage_engine' has initializer but incomplete type
ha_calpont.cpp:1017: error: 'MYSQL_HANDLERTON_INTERFACE_VERSION' was not declared in this scope
ha_calpont.cpp:1063: error: expected constructor, destructor, or type conversion before '(' token
ha_calpont.cpp:1078: error: expected constructor, destructor, or type conversion before ';' token
ha_calpont.cpp:163: warning: 'int calpont_init_func(void*)' defined but not used
ha_calpont.cpp:197: warning: 'int calpont_done_func(void*)' defined but not used
ha_calpont.cpp:1057: warning: 'calpont_system_variables' defined but not used
idb_mysql.h:80: warning: '<unnamed>::idb_mysql_query_str' defined but not used
cc1plus: warning: unrecognized command line option "-Wno-unused-result"
cc1plus: warning: unrecognized command line option "-Wno-unused-local-typedefs"
make[3]: *** [libcalmysql_la-ha_calpont.lo] エラー 1
make[3]: ディレクトリ `/home/infinidb/work/infinidb-master/dbcon/mysql' から出ます
make[2]: *** [all-recursive] エラー 1
make[2]: ディレクトリ `/home/infinidb/work/infinidb-master/dbcon' から出ます
make[1]: *** [all-local] エラー 2
make[1]: ディレクトリ `/home/infinidb/work/infinidb-master' から出ます
make: *** [all] エラー 2


mysql hogehoge 的なファイルが見つからない！と怒られた。

さっき作った mysql のディレクトリを mysql 名でリンクを張った

```
> cd /home/infinidb/work
> ln -s mysql-develop mysql
> ls -l
...
lrwxrwxrwx  1 infinidb infinidb       13  9月 17 14:17 2015 mysql -> mysql-develop
...
```

で、再 make、で make 完了

```
install

> make install
```


## 4 InfiniDB の post install 処理

```
> /home/infinidb/Calpont/bin/postConfigure

This is the Calpont InfiniDB System Configuration and Installation tool.
It will Configure the Calpont InfiniDB System and will perform a Package
Installation of all of the Servers within the System that is being configured.

IMPORTANT: This tool should only be run on the Parent OAM Module
           which is a Performance Module, preferred Module #1

Prompting instructions:

        Press 'enter' to accept a value in (), if available or
        Enter one of the options within [], if available, or
        Enter a new value


===== Setup System Server Type Configuration =====

There are 2 options when configuring the System Server Type: single and multi

  'single'  - Single-Server install is used when there will only be 1 server configured
              on the system. It's a shorter install procedure used for POC testing, as an example.
              It can also be used for production systems, if the plan is to stay single-server.

  'multi'   - Multi-Server install is used when you want to configure multiple servers now or
              in the future. With Multi-Server install, you can still configure just 1 server
              now and add on addition servers/modules in the future. This is used more for
              production installs.

Select the type of System Server install [1=single, 2=multi] (2) > 1
<--- とりあえずお試しモードで動かしたいので、"single" を選択した

Performing the Single Server Install.
Enter System Name (calpont-1) >

===== Setup Storage Configuration =====

----- Setup High Availability Data Storage Mount Configuration -----

There are 2 options when configuring the storage: internal or external

  'internal' -    This is specified when a local disk is used for the dbroot storage
                  or the dbroot storage directories are manually mounted externally
                  but no High Availability Support is required.

  'external' -    This is specified when the dbroot directories are externally mounted
                  and High Availability Failover Support is required.

Select the type of Data Storage [1=internal, 2=external] (1) >

Enter the list (Nx,Ny,Nz) or range (Nx-Nz) of dbroot IDs assigned to module 'pm1' (1) >

===== InfiniDB SNMP-Trap Process Check  =====

InfiniDB is packaged with an SNMP-Trap process.
If the system where InfiniDB is being installed already has an SNMP-Trap process
running, then you have the option of disabling InfiniDB's SNMP-Trap process.
Not having the InfiniDB SNMP-Trap process will affect the
generation of InfiniDB alarms and associated SNMP traps.
Please reference the Calpont InfiniDB Installation Guide for
additional information.

InfiniDB SNMP-Trap process is disabled, would you like to enable it (y,n) [n] >

InfiniDB SNMP-Trap Process successfully disabled


===== Performing Configuration Setup and InfiniDB Startup =====

NOTE: Setting 'NumBlocksPct' to 50%
      Setting 'TotalUmMemory' to 25% of total memory (Combined Server Install maximum value is 16G). Value set to 2G

Running the Infinidb MySQL setup scripts

Starting MySQL.                                            [  OK  ]
Shutting down MySQL.                                       [  OK  ]
                                                           [  OK  ]

Starting InfiniDB Database Platform

InfiniDB Database Platform Starting, please wait ....... DONE

System Catalog Successfull Created

InfiniDB Install Successfully Completed, System is Active

Enter the following command to define InfiniDB Alias Commands

. /home/infinidb/Calpont/bin/calpontAlias

Enter 'idbmysql' to access the InfiniDB MySQL console
Enter 'cc' to access the InfiniDB OAM console
```


## 5 環境変数・エイリアス設定

~/.bash_profile に関連定義を追加した

```
export INFINIDB_INSTALL_DIR=/home/infinidb/Calpont
export PATH=$PATH:$INFINIDB_INSTALL_DIR/bin:$INFINIDB_INSTALL_DIR/mysql/bin:/usr/sbin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INFINIDB_INSTALL_DIR/lib:$INFINIDB_INSTALL_DIR/mysql/lib/mysql

alias idbmysql='/home/infinidb/Calpont/mysql/bin/mysql --defaults-file=/home/infinidb/Calpont/mysql/my.cnf -u root'
alias cmconsole=/home/infinidb/Calpont/bin/calpontConsole
```

## 6 状態確認

```
> idbmysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.73 InfiniDB 5.0 Alpha

Copyright (c) 2014, InfiniDB, Inc. and/or its affiliates. All rights reserved.
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

InfiniDB is a registered trademark of InfiniDB, Inc. and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> show engines;
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                   | Transactions | XA   | Savepoints |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
| CSV        | YES     | CSV storage engine                                        | NO           | NO   | NO         |
| InfiniDB   | YES     | InfiniDB storage engine                                   | YES          | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables | NO           | NO   | NO         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance    | NO           | NO   | NO         |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                     | NO           | NO   | NO         |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)
```

ちゃんと InfiniDB が認識されました。

細かいことは置いといて、とりあえず使ってみます！