InfiniDB のインストール on Linux (2)

*前に InfiniDB をソースからビルドしてインストールした。今回、新しいバージョンでインストールをしたので、その時の作業内容を記録として残しておく。*

* 基本的には、InfiniDB の README に書いてあるが、やはりそのままではうまくいかないところがでてきた。


## InfiniDB バージョン

>
4.6.6 Enterprise 版
InfiniDB-Ent-4.6.6.source.tar.gz


## tar ファイル, zip ファイルの解凍

```
shell> cd ~/work/InfiniDB

shell> ll
-rw-r----- dhill/dhill   120778 2015-07-27 23:16 InfiniDB-Enterprise-4.6.6.zip

shell> tar xvf InfiniDB-Ent-4.6.6.source.tar.gz
InfiniDB-4.6.6.zip
InfiniDB-Enterprise-4.6.6.zip
InfiniDB-MySQL-4.6.6.zip
README

shell> unzip InfiniDB-MySQL-4.6.6.zip
shell> unzip InfiniDB-4.6.6.zip
shell> unzip InfiniDB-Enterprise-4.6.6.zip
```

## MySQL のインストール

```
shell> ln -s InfiniDB-MySQL-4.6.6 mysql

shell> cd mysql
```

### configure

```
shell> ./configure --prefix=/home/testuser/Calpont/mysql
checking build system type... x86_64-redhat-linux-gnu
checking host system type... x86_64-redhat-linux-gnu
...
```

難なく終了


### make

```
shell> make
Making all in .
make[1]: ディレクトリ `/home/testuser/work/InfiniDB/mysql' に入ります
make abi_headers="include/mysql/plugin.h include/mysql.h" do_abi_check
...
```

難なく終了

### make install

```
shell> make install
Making install in .
make[1]: ディレクトリ `/home/testuser/work/InfiniDB/mysql' に入ります
make abi_headers="include/mysql/plugin.h include/mysql.h" do_abi_check
...
```

難なく終了


## InfiniDB のインストール

```
shell> cd ..

shell> ln -s InfiniDB-Enterprise-4.6.6 infinidb

shell> cd infinidb
```

### configure

```
shell> ./configure --prefix=/home/testuser/Calpont
checking for a BSD-compatible install... /usr/bin/install -p
checking whether build environment is sane... yes
...
checking for flex... no
checking for lex... no
checking for yywrap in -lfl... no
checking for yywrap in -ll... no
configure: error: Could not find a usable lex program!
```

エラー発生！

lex とかが無いって怒られた。

### flex を yum インストール

```
shell> su -
shell(root) > yum install flex
OL6.5                                                                                            | 3.7 kB     00:00 ... 
file:///mnt/ol65x86/repodata/repomd.xml: [Errno 14] Could not open/read file:///mnt/ol65x86/repodata/repomd.xml
Trying other mirror.
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package flex.x86_64 0:2.5.35-8.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                  Arch                       Version                            Repository                 Size
========================================================================================================================
Installing:
 flex                     x86_64                     2.5.35-8.el6                       OL6.5                     285 k

Transaction Summary
========================================================================================================================
Install       1 Package(s)

Total download size: 285 k
Installed size: 724 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : flex-2.5.35-8.el6.x86_64 [#####                                                                    ] 1/1  Installing : flex-2.5.35-8.el6.x86_64 
...
[#####################################################################    ] 1/1  Installing : flex-2.5.35-8.el6.x86_64 [######################################################################## ] 1/1  Installing : flex-2.5.35-8.el6.x86_64                                                                             1/1 
  Verifying  : flex-2.5.35-8.el6.x86_64                                                                             1/1 

Installed:
  flex.x86_64 0:2.5.35-8.el6                                                                                            

Complete!
```


### 再 configure

```
shell(root)> exit
shell> ./configure --prefix=/home/testuser/Calpont
checking for a BSD-compatible install... /usr/bin/install -p
checking whether build environment is sane... yes
...
checking for flex... flex
checking for yywrap in -lfl... yes
checking lex output file root... lex.yy
checking whether yytext is a pointer... no
checking for bison... no
checking for byacc... no
configure: error: Could not find a usable yacc program!
```

またエラー発生！

今度は yacc とかが無いって怒られた。


### bison を yum インストール (bison は yacc の上位互換)

```
shell> su -
shell(root) > yum install bison
file:///mnt/ol65x86/repodata/repomd.xml: [Errno 14] Could not open/read file:///mnt/ol65x86/repodata/repomd.xml
Trying other mirror.
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package bison.x86_64 0:2.4.1-5.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                   Arch                       Version                           Repository                 Size
========================================================================================================================
Installing:
 bison                     x86_64                     2.4.1-5.el6                       OL6.5                     636 k

Transaction Summary
========================================================================================================================
Install       1 Package(s)

Total download size: 636 k
Installed size: 2.0 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : bison-2.4.1-5.el6.x86_64 [##                                                                       ] 1/1  Installing : bison-2.4.1-5.el6.x86_64 
...
[######################################################################## ] 1/1  Installing : bison-2.4.1-5.el6.x86_64                                                                             1/1 
  Verifying  : bison-2.4.1-5.el6.x86_64                                                                             1/1 

Installed:
  bison.x86_64 0:2.4.1-5.el6                                                                                            

Complete!
```


### 再々 configure

```
shell(root)> exit
shell> ./configure --prefix=/home/testuser/Calpont
checking for a BSD-compatible install... /usr/bin/install -p
checking whether build environment is sane... yes
...
checking for libxml - version >= 2.6.26... no
*** The xml2-config script installed by LIBXML could not be found
*** If libxml was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the XML2_CONFIG environment variable to the
*** full path to xml2-config.
configure: error: Could not find a usable libxml2 development environment!
```

oops! 今度は、libxml2 が無いと。。

これは確かに README.md に書いてある。

>
Along with a working C++ compiler and GNU software development tools you will need the following extra packages:
>
  * expect
  * zlib-devel
  * ncurses-devel
  * libxml2-devel
  * readline-devel


### libxml2 を rpm インストール

```
shell> su -
shell(root) > rpm -ivh /mnt/Packages/libxml2-devel-2.7.6-14.0.1.el6.x86_64.rpm
   1:libxml2-devel                                                      (  1%)#                                           (  3%)
...
########################################### [100%]
```


### 再々々 configure

```
shell(root)> exit
shell> ./configure --prefix=/home/testuser/Calpont
checking for a BSD-compatible install... /usr/bin/install -p
checking whether build environment is sane... yes
...
```


おーっ、終わった


### make

```
shell> make
make  all-am
make[1]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6' に入ります
...
make[2]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6/net-snmp' に入ります
cd net-snmp-5.2.1.2; \
	./CalpontConfigure.sh --prefix=/home/testuser/insight/Calpont
make[3]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6/net-snmp/net-snmp-5.2.1.2' に入ります
running config.status because configure changed
/bin/sh: line 2: ./config.status: そのようなファイルやディレクトリはありません
make[3]: *** [config.status] エラー 127
make[3]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6/net-snmp/net-snmp-5.2.1.2' から出ます
make[3]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6/net-snmp/net-snmp-5.2.1.2' に入ります
running config.status because configure changed
/bin/sh: line 2: ./config.status: そのようなファイルやディレクトリはありません
make[3]: *** [config.status] エラー 127
make[3]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6/net-snmp/net-snmp-5.2.1.2' から出ます
make[2]: *** [bootstrap] エラー 2
make[2]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6/net-snmp' から出ます
make[1]: *** [bootstrap] エラー 2
make[1]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6' から出ます
make: *** [all] エラー 2
```

net-snmp で、configure.status が無いと。。。

InfiniDB configure してるのに。。。

ls で見て確かにないので、これだけ個別に configure する。


### net-snmp configure

```
shell> cd net-snmp/net-snmp-5.2.1.2
shell> ./configure --prefix=/home/testuser/Calpont/net-snmp
checking what to build and install...  agent apps man local mibs
using default "enterprise.net-snmp"
...
```

ここで、何か入力を求められた。

```
checking if you have run configure before... 
	 ************** Configuration Section **************

	You are about to be prompted with a series of questions.  Answer
them carefully, as they determine how the SNMP agent and related
applications are to function.

	After the configure script finishes, you can browse the newly
created config.h file for further - less important - parameters to
modify.  Be careful if you re-run configure though, since config.h will
be overwritten.

-Press return to continue-

disabling above prompt for future runs...  yes
checking Default version of SNMP to use... 


*** Default SNMP Version:

	Starting with Net-SNMP 5.0, you can choose the default version of
the SNMP protocol to use when no version is given explicitly on the
command line, or via an 'snmp.conf' file.  In the past this was set to
SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
will provide a more secure management environment (and thus you're
encouraged to switch to SNMPv3), but may break existing scripts that
rely on the old behaviour.  (Though such scripts will probably need to
be changed to use the '-c' community flag anyway, as the SNMPv1
command line usage has changed as well.).
   At this prompt you can select "1", "2" (for SNMPv2c), or "3" as
the default version for the command tools (snmpget, ...) to use.  This
can always be overridden at runtime using the -v flag to the tools, or
by using the "defVersion" token in your snmp.conf file.
   Providing the --with-default-snmp-version="x" parameter to ./configure
will avoid this prompt.

Default version of SNMP to use (3): 
setting Default version of SNMP to use to...  3
checking System Contact Information... 


*** System Contact Information:

	Describes who should be contacted about the host the agent is
running on.  This information is available in the MIB-II tree.  This
can also be over-ridden using the "syscontact" syntax in the agent's
configuration files.
  Providing the --with-sys-contact="contact" parameter to ./configure
will avoid this prompt.

System Contact Information (testuser@): 
setting System Contact Information to...  testuser@
checking System Location... 


*** System Location:

	Describes the location of the system.  This information is
available in the MIB-II tree.  this can also be over-ridden using the
"syslocation" syntax in the agent's configuration files.
  Providing the --with-sys-location="location" parameter to ./configure
will avoid this prompt.

System Location (Unknown): 
setting System Location to...  Unknown
checking Location to write logfile... 


*** Logfile location:

	Enter the default location for the snmpd agent to dump
information & errors to.  If not defined (enter the keyword "none"
at the prompt below) the agent will use stdout and stderr instead.
(Note: This value can be over-ridden using command line options.)
  Providing the --with-logfile="path" parameter to ./configure
will avoid this prompt.

Location to write logfile (/var/log/snmpd.log): /home/testuser/Calpont/net-snmp/var/log/snmpd.log
setting Location to write logfile to...  /home/testuser/Calpont/net-snmp/var/log/snmpd.log
checking Location to write persistent information... 


*** snmpd persistent storage location:

	Enter a directory for the SNMP library to store persistent
data in the form of a configuration file.  This default location is
different than the old default location (which was for ucd-snmp).  If
you stay with the new path, I'll ask you in a second if you wish to
copy your files over to the new location (once only).  If you pick
some other path than the default, you'll have to copy them yourself.
There is nothing wrong with picking the old path (/var/ucd-snmp) if
you'd rather.
  Providing the --with-persistent-directory="path" parameter to
./configure will avoid this prompt.

Location to write persistent information (/var/net-snmp): /home/testuser/Calpont/net-snmp
setting Location to write persistent information to...  /home/testuser/Calpont/net-snmp
configure: creating ./config.status
...
```

終わった。元に戻って make を続ける

```
shell> cd ../..
shell> make
make  all-am
make[1]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6' に入ります
...
make[3]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6/oamapps/traphandler' から出ます
Making all in sendtrap
make[3]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6/oamapps/sendtrap' に入ります
if g++ -DHAVE_CONFIG_H -I. -I. -I../..  -I/home/testuser/insight/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  -MT sendtrap-sendtrap.o -MD -MP -MF ".deps/sendtrap-sendtrap.Tpo" -c -o sendtrap-sendtrap.o `test -f 'sendtrap.cpp' || echo './'`sendtrap.cpp; \
	then mv -f ".deps/sendtrap-sendtrap.Tpo" ".deps/sendtrap-sendtrap.Po"; else rm -f ".deps/sendtrap-sendtrap.Tpo"; exit 1; fi
sendtrap.cpp: In function 'int main(int, char**)':
sendtrap.cpp:86: error: invalid conversion from 'const char*' to 'char*'
sendtrap.cpp:86: error:   initializing argument 1 of 'int create_trap_session(char*, u_short, char*, int, int)'
sendtrap.cpp:86: 警告: deprecated conversion from string constant to 'char*'
/home/testuser/insight/Calpont/include/boost/system/error_code.hpp: At global scope:
/home/testuser/insight/Calpont/include/boost/system/error_code.hpp:222: 警告: 'boost::system::posix_category' defined but not used
/home/testuser/insight/Calpont/include/boost/system/error_code.hpp:223: 警告: 'boost::system::errno_ecat' defined but not used
/home/testuser/insight/Calpont/include/boost/system/error_code.hpp:224: 警告: 'boost::system::native_ecat' defined but not used
cc1plus: 警告: unrecognized command line option "-Wno-unused-result"
cc1plus: 警告: unrecognized command line option "-Wno-unused-local-typedefs"
make[3]: *** [sendtrap-sendtrap.o] エラー 1
make[3]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6/oamapps/sendtrap' から出ます
make[2]: *** [all-recursive] エラー 1
make[2]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6/oamapps' から出ます
make[1]: *** [all-local] エラー 2
make[1]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6' から出ます
make: *** [all] エラー 2
```

もう嫌です。
今度は、sendtrap で cast 云々を言われてるっぽい。。

強引にソース修正

```lang:~/work/InfiniDB/infinidb/oamapps/sendtrap/sendtrap.cpp
    82  /*
    83                  create_trap_session(ipAdd.c_str(),
    84                                                          SNMP_TRAP_PORT,
    85                                                          "public",
    86                                                          SNMP_VERSION_1,
    87                                                          SNMP_MSG_TRAP);
    88  */
    89  char *s_string;
    90  s_string = (char*)ipAdd.c_str();
    91                  create_trap_session(s_string,
    92                                                          SNMP_TRAP_PORT,
    93                                                          "public",
    94                                                          SNMP_VERSION_1,
    95                                                          SNMP_MSG_TRAP);
```


### 再 make

```
shell> make
make  all-am
make[1]: ディレクトリ `/home/testuser/work/InfiniDB/InfiniDB-4.6.6' に入ります
./build/genVersion.sh --prefix=/home/testuser/insight/Calpont
...
```

ようやく終わった。

* とりあえず最後まで通ったけど、ログを見てみると、いろんなところでワーニング、エラーは出ているっぽい。ちょっと後回しにしておく。


### make install

```
shell> make install
./build/genVersion.sh --prefix=/home/testuser/Calpont
for subdir in dbcon ddlproc dmlproc exemgr mysql net-snmp oam \
...
```

とりあえず完了。


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

~/.bash_profile に環境変数・エイリアスを追加


```lang:~/.bash_profile
export INFINIDB_INSTALL_DIR=/home/testuser/Calpont
export PATH=$INFINIDB_INSTALL_DIR/bin:$INFINIDB_INSTALL_DIR/mysql/bin:$PATH
export LD_LIBRARY_PATH=$INFINIDB_INSTALL_DIR/lib:$INFINIDB_INSTALL_DIR/mysql/lib/mysql:$LD_LIBRARY_PATH

#alias cc=$INFINIDB_INSTALL_DIR/bin/calpontConsole
alias cmconsole=$INFINIDB_INSTALL_DIR/bin/calpontConsole
alias idbmysql='$INFINIDB_INSTALL_DIR/mysql/bin/mysql --defaults-file=$INFINIDB_INSTALL_DIR/mysql/my.cnf -u root'
```


## post configure

```
shell> /home/testuser/Calpont/bin/postConfigure

This is the InfiniDB System Configuration and Installation tool.
It will Configure the 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 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.

Select the type of System Server install [1=single, 2=multi] (2) > 


===== Setup System Module Type Configuration =====

There are 2 options when configuring the System Module Type: separate and combined

  'separate' - User and Performance functionality on separate servers.

  'combined' - User and Performance functionality on the same server

Select the type of System Module Install [1=separate, 2=combined] (2) > 

Combined Server Installation will be performed.
The Server will be configured as a Performance Module.
All InfiniDB Processes will run on the Performance Modules.

Enable MySQL Replication feature? [y,n] (n) > 

Installing on Amazon System (EC2 or VPC services) [y,n] (n) > 

Enter System Name (calpont-1) > 

Enter the Local Module Name or exit [pmx,exit] (pm1) > 

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

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

There are 3 options when configuring the storage: internal, external, or hdfs

  'internal' -    This is specified when a local disk is used for the dbroot storage.
                  High Availability Server Failover is not Supported in this mode

  'external' -    This is specified when the dbroot directories are mounted.
                  High Availability Server Failover is Supported in this mode.

  'hdfs' -        This is specified when hadoop is installed and you want the dbroot
                  directories to be controlled by the Hadoop Distributed File System (HDFS).
                  High Availability Server Failover is Supported in this mode.

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

===== Setup Memory Configuration =====


NOTE: Setting 'NumBlocksPct' to 50
      Setting 'TotalUmMemory' to 25% of total memory

===== Setup the Module Configuration =====

----- Performance Module Configuration -----

Enter number of Performance Modules [1,1024] (1) > 
Enter Starting Module ID for Performance Module [1,1024] (1) > 

*** Parent OAM Module Performance Module #1 Configuration ***

Enter Nic Interface #1 Host Name (localhost) > hogehoge

Enter Nic Interface #1 IP Address of hogehoge (xxx.xxx.xxx.xxx) > 192.168.xxx.xxx

Enter Nic Interface #2 Host Name (unassigned) > 

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 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

===== Setup the External Device Configuration =====

External Devices are devices like a storage array or a Ethernet Switch that can
be setup to be monitored by InfiniDB with a ping test. If device fails, InfiniDB
will report a failure alarm.

Would you like to add an External Device? [y,n] (n) > 

===== Running the InfiniDB MySQL setup scripts =====


chown: グループ指定が不正: `testuser:testuser'
chown: グループ指定が不正: `testuser:testuser'
chown: ユーザ指定が不正: `testuser.testuser'
Starting MySQL. SUCCESS! 
Shutting down MySQL. SUCCESS! 
 SUCCESS! 

===== Checking InfiniDB System Logging Functionality =====

The InfiniDB system logging is setup and working on local server

InfiniDB System Configuration and Installation is Completed

===== InfiniDB System Startup =====

System Installation is complete.
If an error occurred while running the InfiniDB MySQL setup scripts,
this will need to be corrected and postConfigure will need to be re-run.

Would you like to startup the InfiniDB System? [y,n] (y) > 

----- Starting InfiniDB on local Server 'pm1' -----


InfiniDB successfully started

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

System Catalog Successfully Created

InfiniDB Install Successfully Completed, System is Active

Enter the following command to define InfiniDB Alias Commands

. /home/testuser/Calpont/bin/calpontAlias

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


## 入り直して InfiniDB にログインできるか確認

```
shell> idbmysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.73-log InfiniDB 4.6.6-1

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>
```

ログインできるまではこぎつけた。
後は使ってみるのみ。