ColumnStore 1.4 / Enterprise Server 10.4.11-5 リリース

2020-01-06 に MariaDB Enterprise Server 10.4.11-5 がリリースされました。

Release Notes for MariaDB Enterprise Server 10.4.11-5

大きな変更点としましては,これまで別パッケージで提供されていた MariaDB ColumnStore が MariaDB Enterprise Server パッケージに含まれるようになりました。

今回は MariaDB Enterprise Server 10.4.11-5 / ColumnStore 1.4 のインストール手順の解説を行います。

テスト環境

  • CentOS 7.7.1908
  • MariaDB Enterprise Server 10.4.11-5 / ColumnStore 1.4.2

なお,CentOS 7 用シングルノード構成のインストール手順は以下のドキュメントに解説されています。

Single Server with ES 10.4 on CentOS 7

yum レポジトリ設定

MariaDB Enterprise Server 用のレポジトリ設定を行います。MariaDB Platform サブスクリプション契約をされていない場合,https://customers.mariadb.com/downloads/token/ から Customer Access Token が取得できませんので,インストールはできません。

sudo yum -y install wget
wget https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup
echo "958d55bbaeea88a21db04e3730442db3dd4cfc33e037abdd11c23682413ade85 mariadb_es_repo_setup" | \
sha256sum -c -
chmod +x mariadb_es_repo_setup
sudo ./mariadb_es_repo_setup --token="customer_access_token" --apply

customer_access_token は御社用に提供される Customer Download Token に置き換えてください。

ColumnStore 1.4 インストール

Enterprise Server 10.4.11-5 から新規に MariaDB-columnstore-* パッケージが追加されています。

sudo yum -y install \
MariaDB-server MariaDB-compat MariaDB-common MariaDB-shared MariaDB-client  \
galera-enterprise-4 \
MariaDB-columnstore-libs \
MariaDB-columnstore-platform \
MariaDB-columnstore-engine \
net-tools

RPM パッケージインストール完了後,rootユーザでcolumnstore-post-install を実行します。

# columnstore-post-install
The next step on the node that will become PM1:

postConfigure

postConfigure を実行するよう,促されますので 1.2以前のColumnStore同様,rootユーザでpostConfigure を実行します。(-qs オプションは quick single の意味です)

# postConfigure -qs

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

IMPORTANT: This tool requires to run on the Performance 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) > 

Performing the Single Server Install.

Enter System Name (columnstore-1) >

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

----- Setup Performance Module DBRoot Data Storage Mount Configuration -----

Columnstore supports the following storage options...
  1 - internal.  This uses the linux VFS to access files and does
      not manage the filesystem.
  2 - external *.  If you have other mountable filesystems you would
      like ColumnStore to use & manage, select this option.
  3 - GlusterFS *  Note: glusterd service must be running and enabled on
      all PMs.
  4 - S3-compatible cloud storage *.  Note: that should be configured
      before running postConfigure (see storagemanager.cnf)
  * - This option enables data replication and server failover in a
      multi-node configuration.

These options are available on this system: [1, 2, 4]
Select the type of data storage (1) >

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

===== Performing Configuration Setup and MariaDB ColumnStore Startup =====

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

Running the MariaDB ColumnStore setup scripts

post-mysqld-install Successfully Completed
post-mysql-install Successfully Completed

Starting module pm1 of MariaDB Columnstore Database Platform

Starting MariaDB ColumnStore Database Platform Starting, please wait ....... DONE

System Catalog Successfully Created

MariaDB ColumnStore Install Successfully Completed, System is Active

Enter the following command to define MariaDB ColumnStore Alias Commands

. /etc/profile.d/columnstoreAlias.sh

Enter 'mariadb' to access the MariaDB ColumnStore SQL console
Enter 'mcsadmin' to access the MariaDB ColumnStore Admin console

NOTE: The MariaDB ColumnStore Alias Commands are in /etc/profile.d/columnstoreAlias.sh

~/.bashrc 等に ColumnStore 用の alias を設定する /etc/profile.d/columnstoreAlias.sh を読み込むよう設定しておきます。

sudo su -
echo ". /etc/profile.d/columnstoreAlias.sh" >> ~/.bashrc
. ~/.bashrc

mcsadmin getSystemInfo によるシステム情報の確認

mcsadmin> getSystemInfo
getsysteminfo   Thu Jan  9 09:28:09 2020

System columnstore-1

System and Module statuses

Component     Status                       Last Status Change
------------  --------------------------   ------------------------
System        ACTIVE                       Thu Jan  9 07:56:32 2020
Module pm1    ACTIVE                       Thu Jan  9 08:04:17 2020

MariaDB ColumnStore Process statuses

Process             Module    Status            Last Status Change        Process ID
------------------  ------    ---------------   ------------------------  ----------
ProcessMonitor      pm1       ACTIVE            Thu Jan  9 07:55:52 2020        9747
ProcessManager      pm1       ACTIVE            Thu Jan  9 07:55:58 2020        9873
DBRMControllerNode  pm1       ACTIVE            Thu Jan  9 07:56:04 2020       10210
ServerMonitor       pm1       ACTIVE            Thu Jan  9 07:56:08 2020       10229
DBRMWorkerNode      pm1       ACTIVE            Thu Jan  9 07:56:08 2020       10249
PrimProc            pm1       ACTIVE            Thu Jan  9 07:56:11 2020       10300
ExeMgr              pm1       ACTIVE            Thu Jan  9 07:56:15 2020       10366
WriteEngineServer   pm1       ACTIVE            Thu Jan  9 07:56:19 2020       10431
DDLProc             pm1       ACTIVE            Thu Jan  9 07:56:23 2020       10497
DMLProc             pm1       ACTIVE            Thu Jan  9 07:56:31 2020       10532
mysqld              pm1       ACTIVE            Thu Jan  9 08:04:12 2020       10115

Active Alarm Counts: Critical = 0, Major = 0, Minor = 0, Warning = 0, Info = 0

Status がすべて ACTIVE となっていれば,問題なく ColumnStore システムは稼働しています。

getSoftwareInfo で ColumnStore のバージョンを確認することができます。

mcsadmin> getSoftwareInfo
getsoftwareinfo   Thu Jan  9 10:02:42 2020

SoftwareVersion = 1.4.2
SoftwareRelease = 1

flights サンプルデータのインポート,クエリ実行

GitHub で公開されている ColumnStore 用サンプルデータのうち,flights をインポート,クエリを実行してみます。
まずレポジトリをクローンします。

sudo yum -y install git
git clone https://github.com/mariadb-corporation/mariadb-columnstore-samples
cd mariadb-columnstore-samples/flights
sudo yum -y install curl unzip 

MariaDB Enterprise Server に統合されたことにより,ColumnStore 関連ファイルのディレクトリ構成などが変更されているため,create_flights_db.sh, load_flight_data.sh を以下のように変更します(get_flight_data.shは変更不要)。

create_flights_db.sh:

#!/bin/bash
SCHEMA_DIR=$(readlink -f ./schema)

# create flights database (dropping if exists) with 3 columnstore tables: flights, airports, airlines
mariadb -u root -vvv < $SCHEMA_DIR/schema.sql

# load data into dimension tables airports and airlines.
cpimport -m 2 -s ',' -E '"' flights airports -l $SCHEMA_DIR/airports.csv
cpimport -m 2 -s ',' -E '"' flights airlines -l $SCHEMA_DIR/airlines.csv

load_flight_data.sh:

#!/bin/bash
DATA_DIR=$(readlink -f ./data)

filematch="*"
if [ $# -eq 1 ]
then
  filematch="*$1*"
fi

for f in $DATA_DIR/$filematch.csv; do
  echo $f
  cpimport -m2 -s ',' -E '"' flights flights -l $f
done

以下の順番で rootユーザで各シェルスクリプトを実行します。

./get_flight_data.sh
./create_flights_db.sh
./load_flight_data.sh

./get_flight_data.sh は https://www.transtats.bts.gov/ からデータを取得するため,日本からダウンロードする場合かなり時間がかかります。

3つのシェルスクリプトがエラーなく実行できましたら,queries ディレクトリにある,サンプルクエリ(2018_airline_summary.sql)を実行します。

$ cd queries/
$ sudo mariadb flights
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.4.11-5-MariaDB-enterprise MariaDB Enterprise Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [flights]> SOURCE 2018_airline_summary.sql
+------------------------------+--------------+------------------+---------------+--------------+
| airline                      | flight_count | market_share_pct | cancelled_pct | diverted_pct |
+------------------------------+--------------+------------------+---------------+--------------+
| Southwest Airlines Co.       |      1352552 |            20.73 |          1.35 |         0.20 |
| Delta Air Lines Inc.         |       949283 |            14.55 |          0.37 |         0.20 |
| American Airlines Inc.       |       916818 |            14.05 |          1.63 |         0.26 |
| Skywest Airlines Inc.        |       774494 |            11.87 |          1.37 |         0.35 |
| United Air Lines Inc.        |       621565 |             9.53 |          0.79 |         0.28 |
| JetBlue Airways              |       305010 |             4.68 |          2.10 |         0.27 |
| American Eagle Airlines Inc. |       296165 |             4.54 |          3.60 |         0.29 |
| Endeavor Air                 |       246107 |             3.77 |          2.58 |         0.23 |
| Alaska Airlines Inc.         |       245761 |             3.77 |          0.90 |         0.23 |
| Mesa Airlines Inc            |       215156 |             3.30 |          2.57 |         0.24 |
| ExpressJet                   |       203006 |             3.11 |          2.79 |         0.31 |
| Spirit Air Lines             |       176178 |             2.70 |          0.99 |         0.18 |
| Frontier Airlines Inc.       |       120035 |             1.84 |          1.94 |         0.15 |
| Hawaiian Airlines Inc.       |        83723 |             1.28 |          0.30 |         0.12 |
| Virgin America               |        17670 |             0.27 |          2.45 |         0.48 |
+------------------------------+--------------+------------------+---------------+--------------+
15 rows in set (1.741 sec)

上記のような実行結果となれば正常にサンプルデータがインポートできています。

まとめ

バージョン 1.4 から MariaDB Enterprise Server 10.4 に統合された,ColumnStore のインストール手順について解説させて頂きました。よりシームレスに MariaDB Enterprise Server (InnoDB等) と ColumnStore の機能を利用できるようになっているかと存じます。

Enterprise Documentation サイト(英語)にシングル構成のインストール手順が掲載されていますので,こちらもご参考にして頂ければ幸いです。

Deploy a Single ColumnStore Instance