BluemixのdashDBの兄弟?「dashDB Local」をLinux基盤でインストールしてみました


Bluemix等で利用できる、このQiitaにも幾つかメモしたdashDBですが「dashDB Local」というものがあるようで試してみました
https://www.ibm.com/analytics/jp/ja/technology/cloud-data-services/dashdb-local/

いわゆるマネージド・サービスではなくてソフトウェアのようにdashDBを使えるのがdashDB Localのようです(「ソフトウェアアプライアンス」と言うらしい)

操作にあたり、参考にしたページはこちらのマニュアル

ざっくり手順を紹介すると
- Free Trialの登録
- Linux準備(今回はCentOS)
- Dockerインストール
- dashDB Localインストール(Dockerコンテナをダウンロード&run)

これだけです

Free Trialの登録

ここを見る
加えて、 dokcer hubのIDも必要です。

CentOS 準備

ホスト名設定の確認

/etc/hostsでホスト名が設定されているかを確認。設定されてない場合は、適宜行追加。

$ cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
169.53.15.170 dashLocal

SELinuxの設定確認

以下のように、SELINUX=permissiveとなってることを確認

設定ファイルをviで編集
# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=permissive

IP転送がONになってることを確認する

1が帰ってくればOK。帰ってこなければ要設定。

# /sbin/sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

dashDB Local用にファイルシステムを作成する

fdiskで作成
# fdisk /dev/xvdc

〜中略〜

コマンド (m でヘルプ): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended

Select (default p): p
パーティション番号 (1-4, default 1): 1
最初 sector (2048-1048575999, 初期値 2048):
初期値 2048 を使います
Last sector, +sectors or +size{K,M,G} (2048-1048575999, 初期値 1048575999):
初期値 1048575999 を使います
Partition 1 of type Linux and of size 500 GiB is set

コマンド (m でヘルプ): w
パーティションテーブルは変更されました!

このあと、OS rebootして設定を反映させてからファイルシステム作成し、マウント

ファイルシステム作成
# mkfs.xfs -d su=256k,sw=4  /dev/xvdc1
meta-data=/dev/xvdc1             isize=512    agcount=16, agsize=8191936 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=131070976, imaxpct=25
         =                       sunit=64     swidth=256 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=64000, version=2
         =                       sectsz=512   sunit=64 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

マウント
# mkdir /mnt/clusterfs
# mount /dev/xvdc1 /mnt/clusterfs
# df -h
ファイルシス   サイズ  使用  残り 使用% マウント位置
/dev/xvda2        99G  1.4G   92G    2% /
devtmpfs         7.8G     0  7.8G    0% /dev
tmpfs            7.7G     0  7.7G    0% /dev/shm
tmpfs            7.7G  8.4M  7.7G    1% /run
tmpfs            7.7G     0  7.7G    0% /sys/fs/cgroup
/dev/xvda1       240M  159M   69M   70% /boot
tmpfs            1.6G     0  1.6G    0% /run/user/1000
/dev/xvdc1       500G   33M  500G    1% /mnt/clusterfs

最終行に、/mnt/clusterfsが出来ています。よしよし。

Dockerインストール

マニュアルに書いてある通り、インストール
...どうやらバージョンが指定のようです。

# yum-config-manager --add-repo https://docs.docker.com/v1.13/engine/installation/linux/repo_files/centos/docker.repo
# yum makecache fast
# yum -y install docker-engine-1.12.6-1.el7.centos
# systemctl start docker
# systemctl enable docker

以上で、OS側のセットアップ完了です。ではいよいよ、dashDB Local側にはいっていきます。

dashDB Local インストール

Docker HUBにログインします。冒頭で登録したTrialのユーザです。

#docker login -u=docker_hub_id -p='password'

dashDBのコンテナを落として、インストールします。
その様子をlogs --followで追ってみます。どんな設定をしたりとか、エラーが出た場合は何でエラーがでているかなどがわかって便利です(ところどころ中略しています)

# docker run -d -it --privileged=true --net=host --name=dashDB -v /mnt/clusterfs:/mnt/bludata0 -v /mnt/clusterfs:/mnt/blumeta0 ibmdashdb/local:latest-linux

# docker logs --follow dashDB
systemd 219 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
Detected virtualization docker.
Detected architecture x86-64.

Welcome to dashDB Local!

Set hostname to <ynats0602010319.demos.demoibm.com>.
Initializing machine ID from random generator.
Cannot add dependency job for unit systemd-tmpfiles-clean.timer, ignoring: Unit is masked.
[  OK  ] Reached target Local File Systems.
[  OK  ] Reached target Timers.
[  OK  ] Reached target Swap.
[  OK  ] Reached target Paths.
[  OK  ] Created slice Root Slice.

[  505.879243] start_dashDB_local.sh[148]: Container Tests Summary
[  505.881775] start_dashDB_local.sh[148]: +--------------------------------+----------------------+
[  505.882033] start_dashDB_local.sh[148]: |              Test              |        Result        |
[  505.882229] start_dashDB_local.sh[148]: +--------------------------------+----------------------+
[  505.882417] start_dashDB_local.sh[148]: | Minimum data volume free-space |         PASS         |
[  505.882604] start_dashDB_local.sh[148]: |         Minimum memory         |         PASS         |
[  505.882790] start_dashDB_local.sh[148]: |  Minimum number of CPU cores   |         PASS         |
[  505.882980] start_dashDB_local.sh[148]: |       Port availability        |         PASS         |
[  505.883191] start_dashDB_local.sh[148]: |       Port accessibility       |         PASS         |
[  505.883375] start_dashDB_local.sh[148]: |     Data volume direct I/O     |         PASS         |
[  505.883559] start_dashDB_local.sh[148]: |  Data volume read/write speed  | 68.5 MB/s, 10.9 MB/s |
[  505.883741] start_dashDB_local.sh[148]: +--------------------------------+----------------------+
[  509.492217] start_dashDB_local.sh[148]: Creating dashDB directories and dashDB instance

[ 1545.408941] start_dashDB_local.sh[148]: ################################################################################
[ 1545.409242] start_dashDB_local.sh[148]: ###              Starting all the services in the dashDB stack               ###
[ 1545.409443] start_dashDB_local.sh[148]: ################################################################################
[ 1545.409633] start_dashDB_local.sh[148]: * If this is a new deployment, the dashDB stack is initialized, which might
[ 1545.409827] start_dashDB_local.sh[148]: take a while.
[ 1545.410037] start_dashDB_local.sh[148]: * If this is a container update, it might take a while to start the services,
[ 1545.410236] start_dashDB_local.sh[148]: depending on whether a dashDB engine or database update is required.
[ 1545.871495] start_dashDB_local.sh[148]: ********************** dashDB Local license information ************************
[ 1545.874837] start_dashDB_local.sh[148]: * License type             : Trial
[ 1545.878250] start_dashDB_local.sh[148]: * License expiry date      : 09/01/2017
[ 1545.881802] start_dashDB_local.sh[148]: * Number of days remaining : 89
[ 1545.885178] start_dashDB_local.sh[148]: * License status           : Active
[ 1545.888188] start_dashDB_local.sh[148]: ********************************************************************************
[ 1580.465106] start_dashDB_local.sh[148]: dashDB instance will use up to 70% of the total memory.
[ 1613.688066] start_dashDB_local.sh[148]: Running AUTOCONFIGURE to tune dashDB database ...
[ 1623.248191] start_dashDB_local.sh[148]: Spark memory will use up to 10% of the total memory.
[ 1699.525821] start_dashDB_local.sh[148]: Updating dashDB database log file configuration
[ 1731.728261] start_dashDB_local.sh[148]: Run hardware inventory collection
[ 1732.187798] start_dashDB_local.sh[148]: +----------------+------------+----------------+-------------+
[ 1732.188236] start_dashDB_local.sh[148]: |                | # of nodes | # of CPU cores | Memory (MB) |
[ 1732.188440] start_dashDB_local.sh[148]: +----------------+------------+----------------+-------------+
[ 1732.188636] start_dashDB_local.sh[148]: | Current        |     1      |       4        |    15629    |
[ 1732.188834] start_dashDB_local.sh[148]: | Max this month |     1      |       4        |    15629    |
[ 1732.189059] start_dashDB_local.sh[148]: | Max last month |     --     |       --       |      --     |
[ 1732.189250] start_dashDB_local.sh[148]: | Max all time   |     1      |       4        |    15629    |
[ 1732.189433] start_dashDB_local.sh[148]: +----------------+------------+----------------+-------------+


[ 1936.253072] start_dashDB_local.sh[148]: ###########################################################################
[ 1936.256215] start_dashDB_local.sh[148]: #####           --- dashDB stack service status summary ---           #####
[ 1936.259292] start_dashDB_local.sh[148]: ###########################################################################
[ 1940.421875] start_dashDB_local.sh[148]: Redirecting to /bin/systemctl status  slapd.service
[ 1940.422195] start_dashDB_local.sh[148]: SUMMARY
[ 1940.422431] start_dashDB_local.sh[148]: LDAPrunning                   : SUCCESS
[ 1940.422650] start_dashDB_local.sh[148]: dashDBtablesOnline            : SUCCESS
[ 1940.422847] start_dashDB_local.sh[148]: WebConsole                    : SUCCESS
[ 1940.423062] start_dashDB_local.sh[148]: dashDBconnectivity            : SUCCESS
[ 1940.423264] start_dashDB_local.sh[148]: dashDBrunning                 : SUCCESS
[ 1940.427368] start_dashDB_local.sh[148]: ***********************************************************
[ 1940.430783] start_dashDB_local.sh[148]: *******             Congratulations!             **********
[ 1940.433617] start_dashDB_local.sh[148]: **         You have successfully deployed dashDB         **
[ 1940.436857] start_dashDB_local.sh[148]: ***********************************************************
[ 1940.439505] start_dashDB_local.sh[148]: *
[ 1940.442282] start_dashDB_local.sh[148]: * Next steps:
[ 1940.445122] start_dashDB_local.sh[148]: *
[ 1940.598153] start_dashDB_local.sh[148]: * 1. If you were monitoring dashDB Local container startup progress using docker logs
[ 1940.601116] start_dashDB_local.sh[148]: command, use Ctrl+c key-sequence to detach from the Docker logs console.
[ 1940.604197] start_dashDB_local.sh[148]: * 2. Log in to the web console using the following information:
[ 1940.607043] start_dashDB_local.sh[148]: *        URL: https://169.53.15.170:8443
[ 1943.212686] start_dashDB_local.sh[148]: *        Default user ID    : bluadmin
[ 1943.213059] start_dashDB_local.sh[148]: *        Default password   : xxxxxxx
[ 1943.218720] start_dashDB_local.sh[148]: * 3. For improved security, change the default bluadmin password
[ 1943.221797] start_dashDB_local.sh[148]: *         by running "docker exec -it dashDB setpass <new password>". Other user management
[ 1943.224819] start_dashDB_local.sh[148]: *         should be done via the web console.
[ 1943.227895] start_dashDB_local.sh[148]: *
[ 1943.231064] start_dashDB_local.sh[148]: ***********************************************************

最後にURL、ユーザ名、パスワードが出ています。このままでも良いのですが、到底覚えられ無さそうなパスワードなので、せっっかくなので変更してみます。

# docker exec -it dashDB setpass xxxxxxx

では稼働確認!

稼働確認

できあがり!

おまけ

(MacとかWindowsでもDocker tools?使えばできるみたいなので、また今度試してみようかな..)