ROKSへのDb2 11.5.9-cn1導入 / 構成情報確認 (タイムゾーン：東京)

## はじめに
 * IBM Cloud上のマネージドOpenShift環境である ROKS に、Db2を導入した時の導入手順を備忘録として記録します
     * タイムゾーン、Db2テリトリーコードとして日本(東京)を指定
 * OpenShift/Kubernetes環境でDb2を動かすには、マイクロサービスとして開発された専用のDb2を導入する必要があります
     * [Db2 for Red Hat OpenShift and Kubernetes](https://www.ibm.com/docs/en/db2/11.5?topic=deployments-db2-rhos-k8s)、別名Db2Uとも呼ばれます
     * Db2として公式の Kubernetes Operator が提供されます

## 11.5.9.0-cn1 変更点
以下環境がサポートされるようになった点が目玉です。
 * Azure AKS cluster
 * Amazon Web Services EKS cluster

(今回はIBM Cloudにデプロイするのであんまり影響ありません。。)

## Db2uCluster or Db2uInstance
マニュアルを見ると、ODFなどSoftware-Defined Storageの性能を引き出したければDb2uCluster、クラウドプラットフォームにより適するのはDb2uInstance..と読めなくないのですが、Db2u OperatorのReadmeを見るとDb2uClusterは将来的に非推奨とされる可能性ありと書かれているので、特段事情がなければDb2uInstanceを選んでおきます。

[マニュアル](https://www.ibm.com/docs/en/db2/11.5?topic=db2-deploying)）
> **The Db2uCluster CR and Db2uInstance CR**
The Db2uCluster CR provides comparatively better performance on software-defined storage types, such as OpenShift Data Foundation (ODF) and Portworx. The Db2uInstance CR provides a significant performance increase on cloud platforms such as Amazon Web Services (AWS) and Azure.

Db2uOperator Readme）
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/ade6aed5-125b-3ed4-a08a-bf9acab15831.png)


## 環境 / 構成
### 前提
 * [Db2 for Red Hat OpenShift and Kubernetes](https://www.ibm.com/docs/en/db2/11.5?topic=deployments-db2-rhos-k8s)
     * k8sバージョン, OperatorとDb2エンジンの組み合わせなど
 * [Deploying Db2 on your OpenShift cluster](https://www.ibm.com/docs/en/db2/11.5?topic=db2-deploying)
     * 前提条件、ライセンス要件、ストレージ構成　など
 * [Configuring database storage for Db2 on OpenShift](https://www.ibm.com/docs/en/db2/11.5?topic=db2-configuring-database-storage)
     * 選択可能なストレージ、PVC構成
     * [Certified storage options for Db2](https://www.ibm.com/docs/en/db2/11.5?topic=storage-certified-options)



### 構成

 * OpenShift Container Platform 4.14.24
 * Db2 Operator 110509.0.1
 * Db2 for OpenShift and Kubernetes (Db2U) s11.5.9.0-cn1
 * Persistent Volume Claim(PVC)構成 : 

ストレージクラスは、今回の環境にて利用可能なもので[Db2がサポートするクラス](https://www.ibm.com/docs/en/db2/11.5?topic=storage-certified-options)を指定します。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/c4720fcb-bae6-49f1-ef8b-9c5f64962c26.png)


上の図は[マニュアル](https://www.ibm.com/docs/en/db2/11.5?topic=db2-configuring-database-storage)から引用しています。
グレーの網掛けを重ねている部分は今回構成しなかったコンポーネントです。

|PVC  | PVC作成の必要性 | アクセスモード |ストレージクラス  |
|:-|:-|:-|:-|
|SHARED META   |必須   |RWX   |ocs-storagecluster-cephfs |
|DATA   | 必須  |RWO   |ocs-storagecluster-ceph-rbd|
|アクティブログ   |オプション(*1)   |RWO   |ocs-storagecluster-ceph-rbd|
|アーカイブログ   |オプション(*1)   |RWX    |ocs-storagecluster-cephfs|
|バックアップ   |オプション(*1)   | RWX   |ocs-storagecluster-cephfs |
|一時表スペース  | オプション(*1)  |RWO   |ocs-storagecluster-ceph-rbd|

(*1)必要最低限のPVCはSHARED METAとDATAの2つのみで、他を分割する必要はありませんが、[Db2マニュアルのサンプルYaml](https://www.ibm.com/docs/en/db2/11.5?topic=resource-deploying-db2-using-db2uinstance-custom), Webコンソールの新規デプロイ初期画面とも用途別にPVCを分割するサンプルが掲載されるため、その流れに従います。

参考：
[Deploying Db2 on your OpenShift cluster](https://www.ibm.com/docs/en/db2/11.5?topic=db2-deploying)
[Configuring database storage for Db2](https://www.ibm.com/docs/en/db2/11.5?topic=db2-configuring-database-storage)


## 導入手順(概要)

オンプレミスで使われるDb2インストールイメージ(db2setupやdb2_install)の利用はOpenShift / Kubernetes 環境ではサポートされず、マイクロサービスとして実装される [Db2 for Red Hat OpenShift and Kubernetes(Db2U)(※)](https://www.ibm.com/docs/en/db2/11.5?topic=deployments-db2-rhos-k8s) を利用する必要があります。
　※ かつては Db2 on Red Hat OpenShift という名前でした。

以下の流れでデプロイを進めます。

Step1. OpenShift プロジェクト作成
Step2. Db2 Operator導入
Step3. Security Context Constraint 設定
Step4. Db2 エンジン導入

Step1-3までの手順は、通常のOLTP用Db2を利用する場合もDb2 Warehouseを利用する場合も共通です。

## 導入手順 (ログ)
IBM ROKS環境へ Db2U を導入した際の手順、スクリーンショットを記録として残します。

### Step1. プロジェクト作成
Db2デプロイ用のネームスペースを作成します。

```
root@myhost:~# oc new-project db2-1
Now using project "db2-1" on server "https://c115-e.jp-tok.containers.cloud.ibm.com:30769".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app rails-postgresql-example

to build a new example application in Ruby. Or use kubectl to deploy a simple Kubernetes application:

    kubectl create deployment hello-node --image=k8s.gcr.io/serve_hostname

root@myhost:~#
```

### Step2. Db2 Operator導入

#### Step2-1. IBM Operator Catalog 導入

IBM Operator CatalogをOCP環境に導入します。
[Db2マニュアル](https://www.ibm.com/docs/en/db2-warehouse?topic=operator-installing-from-catalog)に提供されるYaml定義を利用して、IBM Operator Catalog の CatalogSourceリソースを作成します。

```yaml: (IBM Operator Catalog)
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: ibm-operator-catalog
  namespace: openshift-marketplace
spec:
  displayName: "IBM Operator Catalog" 
  publisher: IBM
  sourceType: grpc
  image: icr.io/cpopen/ibm-operator-catalog
  updateStrategy:
    registryPoll:
      interval: 45m
```

OpenShift Webコンソール上で「＋」を押下します
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/1af3946a-9c2a-3685-5cde-ddf11a957baf.png)

YAMLのインポート画面が開くので、エディタ部分に上記Yaml定義を貼付して「作成」を押下します

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/edefe6f9-29eb-4041-cd36-b914179cbc4e.png)


即時に作成完了し、カタログソースの詳細画面に遷移します
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/65f951fe-d241-d192-860e-67c607276ca0.png)


コマンドラインからも、CatalogSource およびパッケージマニフェストが正常に作成されていることを確認します

```
root@myhost:~# oc get CatalogSource -n openshift-marketplace
NAME                   DISPLAY                TYPE   PUBLISHER   AGE
certified-operators    Certified Operators    grpc   Red Hat     30d
community-operators    Community Operators    grpc   Red Hat     30d
ibm-operator-catalog   IBM Operator Catalog   grpc   IBM         17d
redhat-marketplace     Red Hat Marketplace    grpc   Red Hat     30d
redhat-operators       Red Hat Operators      grpc   Red Hat     30d
```

"ibm-operator-catalog" が作成されていることが確認されます



#### Step2-2. Db2 Operator 導入

OpenShift Webコンソールを開き、メニューバーの [Operator] -> [OperatorHub] を選択します。
画面上部のテキストボックスに「Db2」と入力すると、Db2関連のオペレータに表示が絞られます。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/53ada2df-8b9b-090a-0155-a9cfaa79ba8e.png)


「IBM Db2」を選択すると、Db2U Operator Readmeが表示されます。(画面右半分)
Db2U Opearator 導入後～Db2エンジンのDeployまでに実行する必要のある作業や前提条件が記載されていますので必ず目を通します。
※ Operatorインストール後も同じReadmeを参照可能です

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/b165271d-bab4-7524-9f1a-71f636a09ac2.png)


Operator Readme 画面左上の「インストール」を押下し、Db2U Operator を導入します。
インストールモード、インストール対象となるNamespaceなど必要な項目を選択し、「インストール」を押下するとDb2U Operatorの導入が始まります。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/1c2e54f2-ba18-7abd-fbf8-0ffcbab615e9.png)


「更新の承認」を「手動」にしている場合は、承認が要求されます
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/6db3f7d0-92fd-a40c-04b5-24647b6d14f0.png)


数分もかからず完了します
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/293e0d77-d0a1-f60a-1d13-2e431fc5928d.png)


「Operatorの表示」を押下すると、Db2U Operator の詳細画面に遷移します
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/92fa42d4-c576-4a4b-0fad-0f5eea3f28f1.png)


これでDb2U Operatorのセットアップが完了しました。

### Step3. セキュリティ構成

#### Step3-1. Secret 構成
後のDb2U Cluster(Db2インスタンス本体)の導入時に必要となる Entitlement key を取得し、この key を含む Secret を作成しておきます。 
Db2U Cluster導入時には、この Entitlement key を保持する Secret の名前を指定します。

##### ①Entitlement key の取得
MyIBM のサイトにアクセスし、ライセンスが付与されているソフトウェアに関連付けられた IBMid とパスワードを入力しログインします。
https://myibm.ibm.com/products-services/containerlibrary

「Container software library」ページに表示されるライセンスを確認します。
この例では「IBM SOFTWARE ACCESS 1 YEAR : all」と表示されています。(※この画面の表示は一例です)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/a3985c6f-b3e2-e984-b817-384cb1db9637.png)


続いて「Entitlement keys」に移動してキーを取得します
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/e31e5c83-3e6e-bbeb-2996-cd81a4e17b2c.png)

[Copy key]ボタンを押下し、Entitlement key をコピーします(→後ほど利用するため、テキストファイル等に一時保管しておく)



##### ②Image Pull Secret の作成
①で取得したENTITLEDKEY、 EMAILアドレス、プロジェクト(ネームスペース)名を環境に応じて設定し、oc create secret コマンドを実行します。


OS環境変数の設定：
```
root@myhost:~# ENTITLEDKEY="①で取得したEntitlement key"
root@myhost:~# EMAIL="xxx@yyy.com"
root@myhost:~# NAMESPACE="db2u-1"
```


Secret作成：
```
root@myhost:~# oc create secret docker-registry ibm-registry   \
      --docker-server=cp.icr.io                   \
      --docker-username=cp                        \
      --docker-password=${ENTITLEDKEY}            \
      --docker-email=${EMAIL}                     \
      --namespace=${NAMESPACE}
secret/ibm-registry created
```

Secretが作成されました
```
root@myhost:~# oc get secret | grep ibm-registry
ibm-registry               kubernetes.io/dockerconfigjson        1      97s
root@myhost:~#
```

#### Step3-2. Security Context Constraints 構成

[Db2マニュアル](https://www.ibm.com/docs/en/db2-warehouse?topic=idw-deploying-db2) または Db2 Operator Readme に記載されるyaml定義をコピー＆ペーストし、SecurityContextConstraints定義を作成します。

※マニュアルとDb2U Operator Readmeに記載されるSecurity Context Constraintsのyaml文は同一です

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/c8bfc1f5-b9d4-9015-10c2-f3e0c43f59e9.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/46224452-c0a6-74d6-a28b-51647598c07a.png)


db2u-sccが作成されていることを確認します
```
root@myhost:~/db2u# oc get scc | grep -i db2u-scc
db2u-scc                       true    ["SYS_RESOURCE","IPC_OWNER","SYS_NICE","CHOWN","DAC_OVERRIDE","FSETID","FOWNER","SETGID","SETUID","SETFCAP","SETPCAP","SYS_CHROOT","KILL","AUDIT_WRITE"]   MustRunAs   RunAsAny           RunAsAny    RunAsAny    10           false            ["awsElasticBlockStore","azureDisk","azureFile","cephFS","cinder","configMap","csi","downwardAPI","emptyDir","ephemeral","fc","flexVolume","flocker","gcePersistentDisk","gitRepo","glusterfs","iscsi","nfs","persistentVolumeClaim","photonPersistentDisk","portworxVolume","projected","quobyte","rbd","scaleIO","secret","storageOS","vsphere"]

```


### Step4. Db2エンジンのDeploy
Db2エンジンのデプロイは、OCP Webコンソールでもコマンドラインでも実行可能です。

 * OCP Webコンソール
     * フォームビューとYamlビューが提供され、GUI/YamlベースどちらでもDeploy可
     * 入力必須項目の多くがフォームビュー(Dropdownメニュー、Textbox)で設定可能
         * フォームビューでカバーできない項目はYamlビューで直接Yamlを記述
 * コマンドライン
     * Yamlファイルを作成
     * oc apply(create)コマンドでDeploy

今回はWebコンソールからデプロイします。

こういったユースケースごとのYamlサンプルは[Db2マニュアル](https://www.ibm.com/docs/en/db2/11.5?topic=resource-deploying-db2-using-db2uinstance-custom)に豊富に提供されているので、フォームビューで基本構成を行った後、最後に変更したい部分のYamlサンプルをマニュアルから引用し、組み合わせて活用します。

Webコンソールのフォームビュー、Yamlビューはラジオボタンで切替できます。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/fccf0818-cbfc-da7c-b055-9e301d139fac.png)



##### Step4-1. 設定項目の整理
以下の設定を反映します。

 * 名前：db2uinstance-2
 * Version: s11.5.9.0-cn1
 * Account > Image Pull Secrets
     * Step2-2で作成したsecret「ibm-registry」をドロップダウンリストから選択
 * License > License
     * Acceptにチェック
 * Environment
     * Database
         * Database Type : db2oltp
         * Name : sampledb 
             * 任意に指定可、デフォルトは「BLUDB」
         * Setting
             * Codeset : UTF-8
             * Collation：IDENTITY
             * Teritorry : JP
         * dbConfig　　※Yamlビューで構成
             * LOGARCHMETH1 : "DISK:/mnt/logs/archive"
         * storage　　 ※Yamlビューで構成
             * data,activelogs,temptsはDatabase配下に定義する必要あり
     * Instance
         * Password : (db2inst1ユーザのパスワードを任意に指定)
         * registry　※Yamlビューで構成
                DB2_ATS_ENABLE: 'NO'
                DB2_DISPATCHER_PEEKTIMEOUT: '2'
                DB2_OBJECT_STORAGE_SETTINGS: 'OFF'
 * Instance
     * Password : (db2inst1ユーザのパスワードを任意に指定)
 * Storage
     * meta, archivelog, backup
 * advOpts
     * timezone: "Asia/Tokyo"  ← タイムゾーン設定

編集後のyamlはこちらです。

```yaml:Db2(db2oltp)デプロイ用Yaml
apiVersion: db2u.databases.ibm.com/v1
kind: Db2uInstance
metadata:
  name: db2uinstance-2
  namespace: db2-1
spec:
  account:
    imagePullSecrets:
      - ibm-registry
    securityConfig:
      privilegedSysctlInit: true
  environment:
    databases:
      - name: SAMPLEDB
        settings:
          codeset: UTF-8
          collation: IDENTITY
          territory: JP
        dbConfig:
          LOGARCHMETH1: "DISK:/mnt/logs/archive"
        storage:
          - name: data
            spec:
              accessModes:
                - ReadWriteOnce
              resources:
                requests:
                  storage: 5Gi
              storageClassName: ocs-storagecluster-ceph-rbd
            type: template
          - name: activelogs
            spec:
              accessModes:
                - ReadWriteOnce
              resources:
                requests:
                  storage: 5Gi
              storageClassName: ocs-storagecluster-ceph-rbd
            type: template
          - name: tempts
            spec:
              accessModes:
                - ReadWriteOnce
              resources:
                requests:
                  storage: 5Gi
              storageClassName: ocs-storagecluster-ceph-rbd
            type: template
    dbType: db2oltp
    instance:
      password:
        value: xxxxxxxx
      registry:
        DB2_ATS_ENABLE: 'NO'
        DB2_DISPATCHER_PEEKTIMEOUT: '2'
        DB2_OBJECT_STORAGE_SETTINGS: 'OFF'
    partitionConfig:
      dataOnMln0: true
      total: 1
      volumePerPartition: true
  license:
    accept: true
  nodes: 1
  podTemplate:
    db2u:
      resource:
        db2u:
          limits:
            cpu: 4
            memory: 16Gi
  storage:
    - name: meta
      spec:
        accessModes:
          - ReadWriteMany
        resources:
          requests:
            storage: 5Gi
        storageClassName: ocs-storagecluster-cephfs
      type: create
    - name: backup
      spec:
        accessModes:
          - ReadWriteMany
        resources:
          requests:
            storage: 5Gi
        storageClassName: ocs-storagecluster-cephfs
      type: create
    - name: archivelogs
      spec:
        accessModes:
          - ReadWriteMany
        resources:
          requests:
            storage: 5Gi
        storageClassName: ocs-storagecluster-cephfs
      type: create
  version: s11.5.9.0-cn1
  advOpts:
    timezone: "Asia/Tokyo"
```

##### Step4-2. フォームビューでの編集 (基本構成)

Webコンソール左側のメニューバーより
「Operator」＞「インストール済みのOperator」＞「IBM Db2」を選択します。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/0cbe87ca-d838-6002-0b27-8bdf0e47a51e.png)

表示された「Db2u Instance」パネル下の「インスタンスの作成」の文字をクリックします。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/64e91622-1ada-71ec-9ec3-16b641f59ddd.png)

デフォルトではフォームビューが表示されます。
名前、バージョン、データベースタイプ等基本的な設定項目をドロップダウンリスト、テキストボックス等のUIから設定できます。(Yamlビューでも編集可能)
 
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/d5f8a1e0-cca3-04a8-9bc6-e4b3054147f0.png)
(画面イメージは一部のみ)
<br>

なお、Db2のパラメータ、タイムゾーン設定やストレージの構成等についてはフォームビューでは編集することができないため、Yamlビューで編集します。

:::note

Webコンソールで作成する際、ストレージサイズが決め打ちで一律指定(※)されるため、必ずYamlビューでの確認・編集を行います。
(※)自動ストレージパスに利用されるパスは100GB など

:::

##### Step4-2. Yamlビューでの編集 (PV構成のカスタマイズ)

Yamlビューに切り替えます。
フォームビューでの入力内容が反映されていることがわかります。

ストレージ定義については、Webコンソールでの初期状態では末尾に一括して定義が記述されます。

Db2 Warehouse(db2wh)を利用する場合はこの構成方法では問題ありませんが、OLTP用データベース構成においてはこの状態ではエラーとなりデプロイされないため、storage定義部分はDb2マニュアル「[Deploying Db2 using the Db2uInstance custom resource](https://www.ibm.com/docs/en/db2/11.5?topic=resource-deploying-db2-using-db2uinstance-custom)」を参考に記述し直す必要があります。

これ以外にも、Db2のパラメータ(レジストリ、DB構成パラメータ等)やタイムゾーンの設定を行う必要があればYamlを直接編集します。(yamlの内容は[こちら](#Step4-1.-設定項目の整理))

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/ced321fc-5c93-aba5-43e4-06a26face472.png)


Yamlの編集が終わったら、このままデプロイに進みます。

【補足】
再度同じ構成でデプロイを行う場合は、デプロイ前にYamlビューにて、Yaml全文をテキストファイルに保管しておくと便利です。


##### Step4-3. デプロイ(作成)
「作成」ボタンを押して、デプロイを開始します。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/bc9deb30-3d54-9902-aa0b-8933d352bb77.png)



##### Step4-4. デプロイの進行状況確認

デプロイ中、Webコンソール上、ステータスは「NotReady」と表示されます。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/afd91fff-344a-29ba-64b9-6f6f0b7c5fbc.png)


デプロイ完了後は、ステータス「Ready」に変わります。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/468682/93021b4a-2725-c612-f044-07ed2c8236a3.png)



コマンドラインでは、より詳細な状況が把握できます。
oc get pod(または oc get allなど)にて確認し、以下の状態になっていればDeploy完了です。

| Pod名 | ステータス | 備考 |
|:-|:-|:-|
|c-db2uinstance-2-2-db2u-0   |Running   |Db2エンジンのPod<br> * db2syscが稼働   |
|c-db2uinstance-2-1-restore-morph-xxxxx   |Completed   |Db2セットアップの最後の処理(Restore)を行うJobに属するPod |


```
# oc get all -o wide | grep -i db2uinstance-2
W0619 22:37:58.023329    3594 warnings.go:70] apps.openshift.io/v1 DeploymentConfig is deprecated in v4.14+, unavailable in v4.10000+
pod/c-db2uinstance-2-db2u-0                             1/1     Running     0               10m     172.17.62.170   10.244.64.15   <none>           <none>
pod/c-db2uinstance-2-etcd-0                             1/1     Running     0               10m     172.17.62.154   10.244.64.15   <none>           <none>
pod/c-db2uinstance-2-ldap-d9994d6fc-bbkpn               1/1     Running     1 (10m ago)     10m     172.17.62.165   10.244.64.15   <none>           <none>
pod/c-db2uinstance-2-restore-morph-wxkdq                0/1     Completed   0               86s     172.17.62.10    10.244.64.14   <none>           <none>
service/c-db2uinstance-2-db2u                              ClusterIP   172.21.191.24    <none>        50000/TCP,50001/TCP,25000/TCP,25001/TCP,25002/TCP,25003/TCP,25004/TCP,25005/TCP   10m     app=db2uinstance-2,component=db2oltp,formation_id=db2uinstance-2,role=db,type=engine
service/c-db2uinstance-2-db2u-engn-svc                     NodePort    172.21.8.253     <none>        50001:30321/TCP,50000:32491/TCP
                        10m     app=db2uinstance-2,component=db2oltp,formation_id=db2uinstance-2,role=db,type=engine
service/c-db2uinstance-2-db2u-head-engn-svc                NodePort    172.21.242.71    <none>        50001:30100/TCP,50000:31105/TCP
                        10m     app=db2uinstance-2,component=db2oltp,formation_id=db2uinstance-2,name=dashmpp-head-0,role=db,type=engine
service/c-db2uinstance-2-db2u-internal                     ClusterIP   None             <none>        50000/TCP,9443/TCP,50052/TCP
                        10m     app=db2uinstance-2,component=db2oltp,formation_id=db2uinstance-2,role=db,type=engine
service/c-db2uinstance-2-etcd                              ClusterIP   None             <none>        2379/TCP,2380/TCP
                        10m     app=db2uinstance-2,component=etcd,formation_id=db2uinstance-2
service/c-db2uinstance-2-ldap                              ClusterIP   172.21.33.82     <none>        50389/TCP
                        10m     app=db2uinstance-2,formation_id=db2uinstance-2,role=ldap
deployment.apps/c-db2uinstance-2-ldap              1/1     1            1           10m     ldap         icr.io/db2u/db2u.auxiliary.auth@sha256:90d80d10fa6573ea466512a3fc88c9f80ccb67f4d188206fa515b15993c56a96    app=db2uinstance-2,formation_id=db2uinstance-2,role=ldap
replicaset.apps/c-db2uinstance-2-ldap-d9994d6fc               1         1         1       10m     ldap         icr.io/db2u/db2u.auxiliary.auth@sha256:90d80d10fa6573ea466512a3fc88c9f80ccb67f4d188206fa515b15993c56a96    app=db2uinstance-2,formation_id=db2uinstance-2,pod-template-hash=d9994d6fc,role=ldap
statefulset.apps/c-db2uinstance-2-etcd     1/1     10m     etcd         icr.io/db2u/etcd@sha256:d1dd2eae940427ff7bcd40506cc2181f3fc7826d48dbbb3a4bc3349a2d8c2f93
job.batch/c-db2uinstance-2-restore-morph     1/1           10s        86s     restore-morph   icr.io/db2u/db2u.tools@sha256:290532cb23d45a246dad7bca1aa761407480a3423f645800f5aa6ca1dedd863d   batch.kubernetes.io/controller-uid=f9406cd6-0ee4-4630-bbd8-789a322587e1

```



### Step4-5. 動作検証(DBとしての動作)
Podにログインするとカレントユーザーdb2uadmとなっています。
db2inst1にスイッチユーザし、データベースに接続して簡単な参照/更新操作ができることを確認します。

```
root@IBM-PF44EEMY:/work/202406_db2u/db2oltp2/home_inst1# oc rsh c-db2uinstance-2-db2u-0 bash
Defaulted container "db2u" out of: db2u, instdb (init), init-labels (init), init-kernel (init)
[db2uadm@c-db2uinstance-2-db2u-0 /]$ su - db2inst1
Last login: Mon Jun 24 14:17:00 JST 2024
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 list node directory
SQL1027N  The node directory cannot be found.
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 list db directory

 System Database Directory

 Number of entries in the directory = 1

Database 1 entry:

 Database alias                       = SAMPLEDB
 Database name                        = SAMPLEDB
 Local database directory             = /mnt/blumeta0/db2/databases
 Database release level               = 15.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 connect to sampledb

   Database Connection Information

 Database server        = DB2/LINUXX8664 11.5.9.0
 SQL authorization ID   = DB2INST1
 Local database alias   = SAMPLEDB

[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 list tables

Table/View                      Schema          Type  Creation time
------------------------------- --------------- ----- --------------------------

  0 record(s) selected.

[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 "create table t1
> (c
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 "create table t1 (c1 integer, c2 varchar(32))"
DB20000I  The SQL command completed successfully.
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 "insert into t1 values (1,'A'),(2,'B')"
DB20000I  The SQL command completed successfully.
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 "select * from t1"

C1          C2
----------- --------------------------------
          1 A
          2 B

  2 record(s) selected.

[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 terminate
```

### Step4-6. タイムゾーン確認
今回はタイムゾーンとしてAsia/Tokyoを設定しています。
この設定が反映されていることを確認するため、タイムゾーン無指定の環境と、Asia/Tokyoで構成した環境で思いつく項目を比較しました。

#### (1) タイムゾーン(TZ, TIMEZONE値)確認
Db2インスタンスオーナーである db2inst1 ユーザーのOS環境変数を確認します
```text:デフォルト構成の環境
[db2inst1@c-db2uinstance-1-db2u-0 - Db2U db2inst1]$ echo $TZ
UTC
[db2inst1@c-db2uinstance-1-db2u-0 - Db2U db2inst1]$ echo $TIMEZONE
UTC
```

```text:Asia/Tokyoの環境
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ echo $TZ
Asia/Tokyo
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U NODE0000]$ echo $TIMEZONE
Asia/Tokyo
```

#### (2) dateコマンド表示確認
UTCからJSTに変わったことを確認します。
```text:デフォルト構成の環境
[db2inst1@c-db2uinstance-1-db2u-0 - Db2U db2inst1]$ date
Tue Jun 25 08:09:31 UTC 2024

```

```text:Asia/Tokyoの環境
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ date
Tue Jun 25 19:19:05 JST 2024
```
#### (3) Db2製品ログのタイムスタンプ確認
Db2製品ログ(db2diag.log)
```text:デフォルト構成の環境
[db2inst1@c-db2uinstance-1-db2u-0 - Db2U NODE0000]$ date ; db2 archive log for database sampledb
Tue Jun 25 08:11:09 UTC 2024
DB20000I  The ARCHIVE LOG command completed successfully.

----- 以下、db2diag.log抜粋 -----
2024-06-25-08.11.09.253050+000 E517393E598           LEVEL: Info
PID     : 24082                TID : 139869812680448 PROC : db2sysc 0
INSTANCE: db2inst1             NODE : 000            DB   : SAMPLEDB
HOSTNAME: c-db2uinstance-1-db2u-0
EDUID   : 27                   EDUNAME: db2logmgr (SAMPLEDB) 0
FUNCTION: DB2 UDB, data protection services, sqlpgArchiveLogFile, probe:3175
MESSAGE : ADM1846I  Completed archive for log file "S0000003.LOG" to
          "/mnt/logs/archive/db2inst1/SAMPLEDB/NODE0000/LOGSTREAM0000/C0000000/
          " from "/mnt/logs/active/SAMPLEDB/NODE0000/LOGSTREAM0000/".

```

```text:Asia/Tokyoの環境
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ date ; db2 archive log for database sampledb
Tue Jun 25 19:19:34 JST 2024
DB20000I  The ARCHIVE LOG command completed successfully.

----- 以下、db2diag.log抜粋 -----
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U NODE0000]$ tail -10 db2diag.0.log

2024-06-25-19.19.36.232083+540 E512082E598           LEVEL: Info
PID     : 28598                TID : 139707816077056 PROC : db2sysc 0
INSTANCE: db2inst1             NODE : 000            DB   : SAMPLEDB
HOSTNAME: c-db2uinstance-2-db2u-0
EDUID   : 27                   EDUNAME: db2logmgr (SAMPLEDB) 0
FUNCTION: DB2 UDB, data protection services, sqlpgArchiveLogFile, probe:3175
MESSAGE : ADM1846I  Completed archive for log file "S0000001.LOG" to
          "/mnt/logs/archive/db2inst1/SAMPLEDB/NODE0000/LOGSTREAM0000/C0000000/
          " from "/mnt/logs/active/SAMPLEDB/NODE0000/LOGSTREAM0000/".
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U NODE0000]$
```


## 補足
今回デプロイしたDb2(db2oltp)環境の構成情報を取得。

### (1) Db2バージョン
```
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2level
DB21085I  This instance or install (instance name, where applicable:
"db2inst1") uses "64" bits and DB2 code release "SQL11059" with level
identifier "060A010F".
Informational tokens are "DB2 v11.5.9.0", "special_39066",
"DYN2402010800AMD64_39066", and Fix Pack "0".
Product is installed at "/opt/ibm/db2/V11.5.0.0".

[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$
```

### (2) Deploy完了時のpsコマンド出力

```
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ ps auxwww
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
db2uadm       1  0.0  0.0  15000  3388 ?        Ss   Jun24   0:00 /bin/sh -x /etc/runit/entrypoint.sh
db2uadm       7  0.0  0.0   4428   908 ?        S    Jun24   0:01 runsvdir -P /etc/service log: ...................................................................................................................................................................................................................................................................................................+ exec .................................................................................................
db2uadm       8  0.0  0.0   4272   860 ?        Ss   Jun24   0:00 runsv sshd
db2uadm       9  0.0  0.0   4272   956 ?        Ss   Jun24   0:00 runsv db2u
db2uadm      10  0.0  0.0   4272   936 ?        Ss   Jun24   0:00 runsv db2uapi
db2uadm      11  0.0  0.0   4272   860 ?        Ss   Jun24   0:00 runsv wolverine
db2uadm      12  0.2  0.1 1659004 52160 ?       Sl   Jun24   3:16 db2u-apiserver --type control
db2uadm      13  0.0  0.0   4416   888 ?        S    Jun24   0:00 svlogd -tt ./main
db2uadm      14  0.0  0.0   4416   980 ?        S    Jun24   0:00 svlogd -tt ./main
db2uadm      15  0.0  0.0  26012  1496 ?        S    Jun24   0:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep infinity
db2uadm      16  0.0  0.0  15000  3396 ?        S    Jun24   0:00 /bin/sh -e ./run
root        103  0.0  0.0 112908  7412 ?        S    Jun24   0:00 sudo -E /usr/sbin/sshd -D -p 50022 -e
root        110  0.0  0.0  76668  7544 ?        S    Jun24   0:00 /usr/sbin/sshd -D -p 50022 -e
db2uadm     518  0.0  0.0   4272   856 ?        Ss   Jun24   0:00 runsv sssd
db2uadm     520  0.0  0.0  15000  3236 ?        S    Jun24   0:00 /bin/sh -e ./run
root        521  0.0  0.0 123252  7724 ?        S    Jun24   0:00 sudo -E /usr/sbin/sssd -i --logger=files
root        522  0.0  0.0 171640 11124 ?        S    Jun24   0:00 /usr/sbin/sssd -i --logger=files
root        523  0.0  0.0 207040 16344 ?        S    Jun24   0:01 /usr/libexec/sssd/sssd_be --domain local --uid 0 --gid 0 --logger=files
root        524  0.0  0.1 197780 45044 ?        S    Jun24   0:07 /usr/libexec/sssd/sssd_nss --uid 0 --gid 0 --logger=files
root        525  0.0  0.0 170368 11288 ?        S    Jun24   0:07 /usr/libexec/sssd/sssd_pam --uid 0 --gid 0 --logger=files
db2uadm   15998  0.0  0.0  15264  4004 pts/0    Ss   13:12   0:00 bash
root      16024  0.0  0.0 135460  6196 pts/0    S    13:12   0:00 su - db2inst1
db2inst1  16025  0.1  0.0  17004  3880 pts/0    S    13:12   0:00 -ksh
db2inst1  18659  0.0  0.0  47636  3736 pts/0    R+   13:14   0:00 ps auxwww
root      28596  0.0  0.6 1402396 219324 ?      Sl   Jun24   0:00 db2wdog 0 [db2inst1]
db2inst1  28598  0.2 34.5 18162212 11373364 ?   Sl   Jun24   4:17 db2sysc 0
root      28609  0.0  0.4 1401960 163220 ?      S    Jun24   0:15 db2ckpwd 0
root      28610  0.0  0.4 1401960 163236 ?      S    Jun24   0:15 db2ckpwd 0
root      28611  0.0  0.4 1401960 163236 ?      S    Jun24   0:15 db2ckpwd 0
db2inst1  28613  0.0  0.2 784612 83724 ?        S    Jun24   0:00 db2vend (PD Vendor Process - 1) 0
db2inst1  28623  0.0  0.2 1276356 65952 ?       Sl   Jun24   0:23 db2acd 0 ,0,0,0,1,0,0,00000000,0,0,0000000000000000,0000000000000000,00000000,00000000,00000000,00000000,00000000,00000000,0000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,000000039bcba000,0000000000000000,0000000000000000,1,0,0,,,,,a89f94,14,1e014,2,0,1,0000000000041fc0,0x240000000,0x240000000,1600000,8029,2,4003d
root      28705  0.0  0.0 135460  6076 ?        S    Jun24   0:00 su - db2uhausr -l --session-command=/db2uhausr/service/wolverine/run
db2uhau+  28752  0.0  0.0  13672  3984 ?        S    Jun24   0:00 /bin/bash -x /db2uhausr/service/wolverine/run
db2uhau+  28878  0.5  0.3 344948 123612 ?       S    Jun24   8:40 /usr/bin/python3 -m wolverine.ha.service --pid-file /db2u/tmp/ha.pid
db2fenc1  37259  0.0  0.1 955140 55992 ?        Sl   Jun24   0:00 db2fmp ( ,1,0,0,0,0,0,00000000,0,0,0000000000000000,0000000000000000,00000000,00000000,00000000,00000000,00000000,00000000,0000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,000000039bcba000,0000000000000000,0000000000000000,1,0,0,,,,,a89f94,14,1e014,2,0,1,0000000000061fc0,0x240000000,0x240000000,1600000,8029,2,5002c
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$
```

### (3) Db2 Pod内部のディレクトリ構成


| PVC | ディレクトリ名 | 用途 |
|:-|:-|:-|
|SHARED META   | /mnt/blumeta0  | ・ Db2インスタンスホーム<br> ・ DBディレクトリ<br> ・ 自動ストレージパス<br> ・ db2diag.log<br> ・ ssh関連ファイル  |
|DATA   | /mnt/bludata0/db2/databases/db2inst1/NODE0000  | ・ 外部表ファイル配置用ディレクトリ   |
|アクティブログ   | /mnt/logs/active  |   |
|アーカイブログ   | /mnt/logs/archive  |   |
|一時表スペース   | /mnt/tempts/c-db2uinstance-2-db2u  | ・ TEMPSPACE1<br> ・ USERTEMPSPACE1  |
|バックアップ   | /mnt/backup  |   |



| PVC | マウントポイント | ファイルシステム | 
|:-|:-|:-|
|SHARED META   |/mnt/blumeta0   |172.21.115.130:3300,172.21.16.82:3300,172.21.188.155:3300:/volumes/csi/csi-vol-c56d5d23-0def-41bf-8818-bd3dd33897b9/de8d4033-b31a-4f71-8551-11cde072cbd9   |
|DATA   |/mnt/bludata0/db2/databases/db2inst1/NODE0000   | /dev/rbd0 |
|アクティブログ   |/mnt/logs/active/SAMPLEDB/NODE0000   | /dev/rbd2|
|アーカイブログ   |/mnt/logs/archive   | 172.21.115.130:3300,172.21.16.82:3300,172.21.188.155:3300:/volumes/csi/csi-vol-169bfa47-d9df-4aae-ae1a-8ba01baa3bc7/6760bbe2-00c0-42fd-a502-afe70968a3a2  |
|一時表スペース   |/mnt/tempts/c-db2uinstance-2-db2u   | /dev/rbd1  |
|バックアップ  |/mnt/backup   | 172.21.115.130:3300,172.21.16.82:3300,172.21.188.155:3300:/volumes/csi/csi-vol-c96e6029-538c-4a6d-9e73-d1c3feaa651b/7a778b33-00d5-4c25-8617-f977b4e989be |

```
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ df -m
Filesystem
                                 1M-blocks  Used Available Use% Mounted on
overlay
                                     99720 66761     27875  71% /
tmpfs
                                        64     0        64   0% /dev
tmpfs
                                     16067     0     16067   0% /sys/fs/cgroup
/dev/vda2
                                     99720 66761     27875  71% /etc/hostname
/dev/vda2
                                     99720 66761     27875  71% /etc/hosts
tmpfs
                                       200     1       200   1% /run
172.21.115.130:3300,172.21.16.82:3300,172.21.188.155:3300:/volumes/csi/csi-vol-c96e6029-538c-4a6d-9e73-d1c3feaa651b/7a778b33-00d5-4c25-8617-f977b4e989be      5120     0      5120   0% /mnt/backup
tmpfs
                                      1024     1      1024   1% /dev/shm
tmpfs
                                     16384     1     16384   1% /secrets/hivepwd
tmpfs
                                     16384     1     16384   1% /secrets/kp
tmpfs
                                     16384     1     16384   1% /secrets/user-mgmt-keypwd
tmpfs
                                     16384     1     16384   1% /db2u/license
tmpfs
                                     16384     1     16384   1% /secrets/db2instancepwd
172.21.115.130:3300,172.21.16.82:3300,172.21.188.155:3300:/volumes/csi/csi-vol-c56d5d23-0def-41bf-8818-bd3dd33897b9/de8d4033-b31a-4f71-8551-11cde072cbd9      5120   380      4740   8% /mnt/blumeta0
tmpfs
                                     16384     1     16384   1% /secrets/certs/wv-rest
/dev/rbd1
                                      4956     1      4940   1% /mnt/tempts/c-db2uinstance-2-db2u
tmpfs
                                     16384     1     16384   1% /secrets/sshkeys/db2uhausr
tmpfs
                                     16384     1     16384   1% /secrets/certs/db2u-api
172.21.115.130:3300,172.21.16.82:3300,172.21.188.155:3300:/volumes/csi/csi-vol-169bfa47-d9df-4aae-ae1a-8ba01baa3bc7/6760bbe2-00c0-42fd-a502-afe70968a3a2      5120     0      5120   0% /mnt/logs/archive
tmpfs
                                     16384     1     16384   1% /secrets/sshkeys/db2uadm
tmpfs
                                     16384     1     16384   1% /secrets/sshkeys/db2instusr
tmpfs
                                     16384     1     16384   1% /run/secrets/kubernetes.io/serviceaccount
/dev/rbd2
                                      4956    98      4842   2% /mnt/logs/active/SAMPLEDB/NODE0000
/dev/rbd0
                                      4956   260      4681   6% /mnt/bludata0/db2/databases/db2inst1/NODE0000
tmpfs
                                     16067     0     16067   0% /proc/acpi
tmpfs
                                     16067     0     16067   0% /proc/scsi
tmpfs
                                     16067     0     16067   0% /sys/firmware
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$
```

### (4) Db2の構成パラメータ

#### レジストリー変数
```
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2set -all
[i] DB2_REMOTE_EXTTAB_PIPE_PATH=/db2u/tmp
[i] DB2_FMP_RUN_AS_CONNECTED_USER=YES
[i] DB2_OBJECT_STORAGE_SETTINGS=OFF
[i] DB2_OVERRIDE_THREADING_DEGREE=2
[i] DB2_OVERRIDE_NUM_CPUS=4
[i] DB2_RESTORE_GRANT_ADMIN_AUTHORITIES=ON
[i] DB2_ATS_ENABLE=NO
[i] DB2_DISPATCHER_PEEKTIMEOUT=2
[i] DB2RSHCMD=/bin/ssh
[i] DB2AUTH=OSAUTHDB
[i] DB2_LOAD_COPY_NO_OVERRIDE=COPY YES TO /mnt/bludata0/scratch/db2/copy
[i] DB2CHECKCLIENTINTERVAL=100
[i] DB2COMM=TCPIP,SSL
[g] DB2RSHCMD=/bin/ssh
[g] DB2SYSTEM=c-db2uinstance-2-db2u-0
[g] DB2INSTDEF=db2inst1
[g] DB2COMM=TCPIP
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$
```

#### DBマネージャー構成パラメータ
```
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 get dbm cfg

          Database Manager Configuration

     Node type = Enterprise Server Edition with local and remote clients

 Database manager configuration release level            = 0x1500

 CPU speed (millisec/instruction)             (CPUSPEED) = 9.053266e-08
 Communications bandwidth (MB/sec)      (COMM_BANDWIDTH) = 1.000000e+02

 Max number of concurrently active databases     (NUMDB) = 8
 Federated Database System Support           (FEDERATED) = YES
 Transaction processor monitor name        (TP_MON_NAME) =

 Default charge-back account           (DFT_ACCOUNT_STR) =

 Java Development Kit installation path       (JDK_PATH) = /mnt/blumeta0/home/db2inst1/sqllib/java/jdk64

 Diagnostic error capture level              (DIAGLEVEL) = 3
 Notify Level                              (NOTIFYLEVEL) = 3
 Diagnostic data directory path               (DIAGPATH) = /mnt/blumeta0/db2/log/ $N
 Current member resolved DIAGPATH                        = /mnt/blumeta0/db2/log/NODE0000/
 Alternate diagnostic data directory path (ALT_DIAGPATH) =
 Current member resolved ALT_DIAGPATH                    =
 Size of rotating db2diag & notify logs (MB)  (DIAGSIZE) = 300

 Default database monitor switches
   Buffer pool                         (DFT_MON_BUFPOOL) = OFF
   Lock                                   (DFT_MON_LOCK) = OFF
   Sort                                   (DFT_MON_SORT) = OFF
   Statement                              (DFT_MON_STMT) = OFF
   Table                                 (DFT_MON_TABLE) = OFF
   Timestamp                         (DFT_MON_TIMESTAMP) = ON
   Unit of work                            (DFT_MON_UOW) = OFF
 Monitor health of instance and databases   (HEALTH_MON) = OFF

 SYSADM group name                        (SYSADM_GROUP) = DB2IADM1
 SYSCTRL group name                      (SYSCTRL_GROUP) = BLUADMIN
 SYSMAINT group name                    (SYSMAINT_GROUP) = BLUADMIN
 SYSMON group name                        (SYSMON_GROUP) = BLUADMIN

 Client Userid-Password Plugin          (CLNT_PW_PLUGIN) =
 Client Kerberos Plugin                (CLNT_KRB_PLUGIN) =
 Group Plugin                             (GROUP_PLUGIN) =
 GSS Plugin for Local Authorization    (LOCAL_GSSPLUGIN) =
 Server Plugin Mode                    (SRV_PLUGIN_MODE) = UNFENCED
 Server List of GSS Plugins      (SRVCON_GSSPLUGIN_LIST) =
 Server Userid-Password Plugin        (SRVCON_PW_PLUGIN) =
 Server Connection Authentication          (SRVCON_AUTH) = NOT_SPECIFIED
 Cluster manager                                         =

 Database manager authentication        (AUTHENTICATION) = SERVER_ENCRYPT
 Alternate authentication           (ALTERNATE_AUTH_ENC) = NOT_SPECIFIED
 Cataloging allowed without authority   (CATALOG_NOAUTH) = NO
 Trust all clients                      (TRUST_ALLCLNTS) = YES
 Trusted client authentication          (TRUST_CLNTAUTH) = CLIENT
 Bypass federated authentication            (FED_NOAUTH) = NO

 Default database path                       (DFTDBPATH) = /mnt/blumeta0/db2/databases

 Database monitor heap size (4KB)          (MON_HEAP_SZ) = AUTOMATIC(90)
 Java Virtual Machine heap size (4KB)     (JAVA_HEAP_SZ) = 65536
 Audit buffer size (4KB)                  (AUDIT_BUF_SZ) = 0
 Global instance memory (% or 4KB)     (INSTANCE_MEMORY) = 46
 Member instance memory (% or 4KB)                       = GLOBAL
 Agent stack size                       (AGENT_STACK_SZ) = 1024
 Sort heap threshold (4KB)                  (SHEAPTHRES) = 0

 Directory cache support                     (DIR_CACHE) = YES

 Application support layer heap size (4KB)   (ASLHEAPSZ) = 15
 Max requester I/O block size (bytes)         (RQRIOBLK) = 65535
 Workload impact by throttled utilities(UTIL_IMPACT_LIM) = 10

 Priority of agents                           (AGENTPRI) = SYSTEM
 Agent pool size                        (NUM_POOLAGENTS) = AUTOMATIC(100)
 Initial number of agents in pool       (NUM_INITAGENTS) = 0
 Max number of coordinating agents     (MAX_COORDAGENTS) = AUTOMATIC(200)
 Max number of client connections      (MAX_CONNECTIONS) = AUTOMATIC(MAX_COORDAGENTS)

 Keep fenced process                        (KEEPFENCED) = YES
 Number of pooled fenced processes         (FENCED_POOL) = AUTOMATIC(MAX_COORDAGENTS)
 Initial number of fenced processes     (NUM_INITFENCED) = 0

 Index re-creation time and redo index build  (INDEXREC) = RESTART

 Transaction manager database name         (TM_DATABASE) = 1ST_CONN
 Transaction resync interval (sec)     (RESYNC_INTERVAL) = 180

 SPM name                                     (SPM_NAME) = db9bbf3d
 SPM log size                          (SPM_LOG_FILE_SZ) = 256
 SPM resync agent limit                 (SPM_MAX_RESYNC) = 20
 SPM log path                             (SPM_LOG_PATH) =

 TCP/IP Service name                          (SVCENAME) = db2c_db2inst1
 Discovery mode                               (DISCOVER) = SEARCH
 Discover server instance                (DISCOVER_INST) = ENABLE

 SSL server keydb file                   (SSL_SVR_KEYDB) = /mnt/blumeta0/db2/ssl_keystore/bludb_ssl.kdb
 SSL server stash file                   (SSL_SVR_STASH) = /mnt/blumeta0/db2/ssl_keystore/bludb_ssl.sth
 SSL server certificate label            (SSL_SVR_LABEL) = CA-signed
 SSL service name                         (SSL_SVCENAME) = 50001
 SSL cipher specs                      (SSL_CIPHERSPECS) =
 SSL versions                             (SSL_VERSIONS) = TLSV13,TLSV12
 SSL client keydb file                  (SSL_CLNT_KEYDB) =
 SSL client stash file                  (SSL_CLNT_STASH) =

 Maximum query degree of parallelism   (MAX_QUERYDEGREE) = 4
 Enable intra-partition parallelism     (INTRA_PARALLEL) = NO

 Maximum Asynchronous TQs per query    (FEDERATED_ASYNC) = 0

 Number of FCM buffers                 (FCM_NUM_BUFFERS) = AUTOMATIC(4096)
 FCM buffer size                       (FCM_BUFFER_SIZE) = 32768
 Number of FCM channels               (FCM_NUM_CHANNELS) = AUTOMATIC(2048)
 FCM parallelism                       (FCM_PARALLELISM) = AUTOMATIC(2)
 Node connection elapse time (sec)         (CONN_ELAPSE) = 10
 Max number of node connection retries (MAX_CONNRETRIES) = 5
 Max time difference between nodes (min) (MAX_TIME_DIFF) = 60

 db2start/db2stop timeout (min)        (START_STOP_TIME) = 10

 WLM dispatcher enabled                 (WLM_DISPATCHER) = NO
 WLM dispatcher concurrency            (WLM_DISP_CONCUR) = COMPUTED
 WLM dispatcher CPU shares enabled (WLM_DISP_CPU_SHARES) = NO
 WLM dispatcher min. utilization (%) (WLM_DISP_MIN_UTIL) = 5

 Communication buffer exit library list (COMM_EXIT_LIST) =
 Current effective arch level         (CUR_EFF_ARCH_LVL) = V:11 R:5 M:9 F:0 I:0 SB:0
 Current effective code level         (CUR_EFF_CODE_LVL) = V:11 R:5 M:9 F:0 I:0 SB:39066

 Keystore type                           (KEYSTORE_TYPE) = PKCS12
 Keystore location                   (KEYSTORE_LOCATION) = /mnt/blumeta0/db2/keystore/keystore.p12

 Path to python runtime                    (PYTHON_PATH) = /usr/bin/python
 Path to R runtime                              (R_PATH) =

 Multipart upload part size            (MULTIPARTSIZEMB) = 100

[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$
```


#### DB構成パラメータ
```
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2 get db cfg for sampledb

       Database Configuration for Database sampledb

 Database configuration release level                    = 0x1500
 Database release level                                  = 0x1500

 Update to database level pending                        = NO (0x0)
 Database territory                                      = JP
 Database code page                                      = 1208
 Database code set                                       = UTF-8
 Database country/region code                            = 81
 Database collating sequence                             = IDENTITY
 Alternate collating sequence              (ALT_COLLATE) =
 Number compatibility                                    = OFF
 Varchar2 compatibility                                  = OFF
 Date compatibility                                      = OFF
 Database page size                                      = 16384

 Statement concentrator                      (STMT_CONC) = OFF

 Discovery support for this database       (DISCOVER_DB) = DISABLE

 Restrict access                                         = NO
 Default query optimization class         (DFT_QUERYOPT) = 5
 Degree of parallelism                      (DFT_DEGREE) = 1
 Continue upon arithmetic exceptions   (DFT_SQLMATHWARN) = NO
 Default refresh age                   (DFT_REFRESH_AGE) = 0
 Default maintained table types for opt (DFT_MTTB_TYPES) = SYSTEM
 Number of frequent values retained     (NUM_FREQVALUES) = 10
 Number of quantiles retained            (NUM_QUANTILES) = 20

 Decimal floating point rounding mode  (DECFLT_ROUNDING) = ROUND_HALF_EVEN

 DECIMAL arithmetic mode                (DEC_ARITHMETIC) =
 Large aggregation                   (LARGE_AGGREGATION) = NO

 Backup pending                                          = NO

 All committed transactions have been written to disk    = NO
 Rollforward pending                                     = NO
 Restore pending                                         = NO

 Upgrade pending                                         = NO

 Multi-page file allocation enabled                      = YES

 Log retain for recovery status                          = NO
 User exit for logging status                            = YES

 Self tuning memory                    (SELF_TUNING_MEM) = ON
 Size of database shared memory (4KB)  (DATABASE_MEMORY) = AUTOMATIC(3471075)
 Database memory threshold               (DB_MEM_THRESH) = 100
 Max storage for lock list (4KB)              (LOCKLIST) = AUTOMATIC(15360)
 Percent. of lock lists per application       (MAXLOCKS) = AUTOMATIC(98)
 Package cache size (4KB)                   (PCKCACHESZ) = AUTOMATIC(8192)
 Sort heap thres for shared sorts (4KB) (SHEAPTHRES_SHR) = AUTOMATIC(119197)
 Sort list heap (4KB)                         (SORTHEAP) = AUTOMATIC(5959)

 Database heap (4KB)                            (DBHEAP) = AUTOMATIC(6360)
 Catalog cache size (4KB)              (CATALOGCACHE_SZ) = 383
 Log buffer size (4KB)                        (LOGBUFSZ) = 2152
 Utilities heap size (4KB)                (UTIL_HEAP_SZ) = AUTOMATIC(260473)
 SQL statement heap (4KB)                     (STMTHEAP) = AUTOMATIC(8192)
 Default application heap (4KB)             (APPLHEAPSZ) = AUTOMATIC(256)
 Application Memory Size (4KB)             (APPL_MEMORY) = AUTOMATIC(40000)
 Statistics heap size (4KB)               (STAT_HEAP_SZ) = AUTOMATIC(4384)

 Interval for checking deadlock (ms)         (DLCHKTIME) = 10000
 Lock timeout (sec)                        (LOCKTIMEOUT) = 240

 Changed pages threshold                (CHNGPGS_THRESH) = 80
 Number of asynchronous page cleaners   (NUM_IOCLEANERS) = AUTOMATIC(2)
 Number of I/O servers                   (NUM_IOSERVERS) = AUTOMATIC(4)
 Sequential detect flag                      (SEQDETECT) = YES
 Default prefetch size (pages)         (DFT_PREFETCH_SZ) = AUTOMATIC

 Track modified pages                         (TRACKMOD) = NO

 Default number of containers                            = 1
 Default tablespace extentsize (pages)   (DFT_EXTENT_SZ) = 32

 Max number of active applications            (MAXAPPLS) = AUTOMATIC(40)
 Average number of active applications       (AVG_APPLS) = AUTOMATIC(1)
 Lifetime of cached credentials   (AUTHN_CACHE_DURATION) = 3
 Max number of users in the cache    (AUTHN_CACHE_USERS) = 0
 Max DB files open per database               (MAXFILOP) = 61440

 Active log space disk capacity (MB)      (LOG_DISK_CAP) = 0
 Log file size (4KB)                         (LOGFILSIZ) = 5000
 Number of primary log files                (LOGPRIMARY) = 5
 Number of secondary log files               (LOGSECOND) = 20
 Changed path to log files                  (NEWLOGPATH) =
 Path to log files                                       = /mnt/logs/active/SAMPLEDB/NODE0000/LOGSTREAM0000/
 Overflow log path                     (OVERFLOWLOGPATH) =
 Mirror log path                         (MIRRORLOGPATH) =
 First active log file                                   = S0000001.LOG
 Block log on disk full                (BLK_LOG_DSK_FUL) = NO
 Block non logged operations            (BLOCKNONLOGGED) = NO
 Percent max primary log space by transaction  (MAX_LOG) = 0
 Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0

 Percent log file reclaimed before soft chckpt (SOFTMAX) = 0
 Target for oldest page in LBP       (PAGE_AGE_TRGT_MCR) = 240

 HADR database role                                      = STANDARD
 HADR local host name                  (HADR_LOCAL_HOST) =
 HADR local service name                (HADR_LOCAL_SVC) =
 HADR remote host name                (HADR_REMOTE_HOST) =
 HADR remote service name              (HADR_REMOTE_SVC) =
 HADR instance name of remote server  (HADR_REMOTE_INST) =
 HADR timeout value                       (HADR_TIMEOUT) = 120
 HADR target list                     (HADR_TARGET_LIST) =
 HADR log write synchronization mode     (HADR_SYNCMODE) = NEARSYNC
 HADR spool log data limit (4KB)      (HADR_SPOOL_LIMIT) = AUTOMATIC(0)
 HADR log replay delay (seconds)     (HADR_REPLAY_DELAY) = 0
 HADR peer window duration (seconds)  (HADR_PEER_WINDOW) = 0

 First log archive method                 (LOGARCHMETH1) = DISK:/mnt/logs/archive/
 Archive compression for logarchmeth1    (LOGARCHCOMPR1) = OFF
 Options for logarchmeth1                  (LOGARCHOPT1) =
 Second log archive method                (LOGARCHMETH2) = OFF
 Archive compression for logarchmeth2    (LOGARCHCOMPR2) = OFF
 Options for logarchmeth2                  (LOGARCHOPT2) =
 Failover log archive path                (FAILARCHPATH) =
 Number of log archive retries on error   (NUMARCHRETRY) = 5
 Log archive retry Delay (secs)         (ARCHRETRYDELAY) = 20
 Vendor options                              (VENDOROPT) =

 Auto restart enabled                      (AUTORESTART) = ON
 Index re-creation time and redo index build  (INDEXREC) = SYSTEM (RESTART)
 Log pages during index build            (LOGINDEXBUILD) = OFF
 Default number of loadrec sessions    (DFT_LOADREC_SES) = 1
 Number of database backups to retain   (NUM_DB_BACKUPS) = 2
 Recovery history retention (days)     (REC_HIS_RETENTN) = 7
 Auto deletion of recovery objects    (AUTO_DEL_REC_OBJ) = ON

 TSM management class                    (TSM_MGMTCLASS) =
 TSM node name                            (TSM_NODENAME) =
 TSM owner                                   (TSM_OWNER) =
 TSM password                             (TSM_PASSWORD) =

 Automatic maintenance                      (AUTO_MAINT) = ON
   Automatic database backup            (AUTO_DB_BACKUP) = OFF
   Automatic table maintenance          (AUTO_TBL_MAINT) = ON
     Automatic runstats                  (AUTO_RUNSTATS) = ON
       Real-time statistics            (AUTO_STMT_STATS) = ON
       Statistical views              (AUTO_STATS_VIEWS) = OFF
       Automatic sampling                (AUTO_SAMPLING) = ON
       Automatic column group statistics (AUTO_CG_STATS) = OFF
     Automatic reorganization               (AUTO_REORG) = OFF

 Auto-Revalidation                          (AUTO_REVAL) = DEFERRED

 Currently Committed                        (CUR_COMMIT) = ON
 CHAR output with DECIMAL input        (DEC_TO_CHAR_FMT) = NEW
 Enable XML Character operations        (ENABLE_XMLCHAR) = YES
 Enforce Constraint                  (DDL_CONSTRAINT_DEF) = YES
 Enable row compression by default  (DDL_COMPRESSION_DEF) = NO
 Replication site ID                      (REPL_SITE_ID) = 0
 Monitor Collect Settings
 Request metrics                       (MON_REQ_METRICS) = BASE
 Activity metrics                      (MON_ACT_METRICS) = BASE
 Object metrics                        (MON_OBJ_METRICS) = EXTENDED
 Routine data                             (MON_RTN_DATA) = NONE
   Routine executable list            (MON_RTN_EXECLIST) = OFF
 Unit of work events                      (MON_UOW_DATA) = NONE
   UOW events with package list        (MON_UOW_PKGLIST) = OFF
   UOW events with executable list    (MON_UOW_EXECLIST) = OFF
 Lock timeout events                   (MON_LOCKTIMEOUT) = NONE
 Deadlock events                          (MON_DEADLOCK) = WITHOUT_HIST
 Lock wait events                         (MON_LOCKWAIT) = NONE
 Lock wait event threshold               (MON_LW_THRESH) = 5000000
 Number of package list entries         (MON_PKGLIST_SZ) = 32
 Lock event notification level         (MON_LCK_MSG_LVL) = 1

 SMTP Server                               (SMTP_SERVER) =
 SQL conditional compilation flags         (SQL_CCFLAGS) =
 Section actuals setting               (SECTION_ACTUALS) = NONE
 Connect procedure                        (CONNECT_PROC) =
 Adjust temporal SYSTEM_TIME period (SYSTIME_PERIOD_ADJ) = NO
 Log DDL Statements                      (LOG_DDL_STMTS) = NO
 Log Application Information             (LOG_APPL_INFO) = NO
 Default data capture on new Schemas   (DFT_SCHEMAS_DCC) = NO
 Strict I/O for EXTBL_LOCATION         (EXTBL_STRICT_IO) = NO
 Allowed paths for external tables      (EXTBL_LOCATION) = /mnt/blumeta0/db2/load;/mnt/blumeta0/home;/mnt/bludata0/scratch;/mnt/external;/mnt/backup
 Default table organization              (DFT_TABLE_ORG) = ROW
 Default string units                     (STRING_UNITS) = SYSTEM
 National character string mapping       (NCHAR_MAPPING) = CHAR_CU32
 Database is in write suspend state                      = NO
 Extended row size support             (EXTENDED_ROW_SZ) = ENABLE
 Encryption Library for Backup                 (ENCRLIB) = libdb2encr.so
 Encryption Options for Backup                (ENCROPTS) = CIPHER=AES:MODE=CBC:KEY LENGTH=256

 WLM Collection Interval (minutes)     (WLM_COLLECT_INT) = 0
 Target agent load per CPU core    (WLM_AGENT_LOAD_TRGT) = AUTOMATIC(12)
 WLM admission control enabled      (WLM_ADMISSION_CTRL) = NO
 Allocated share of CPU resources       (WLM_CPU_SHARES) = 1000
 CPU share behavior (hard/soft)     (WLM_CPU_SHARE_MODE) = HARD
 Maximum allowable CPU utilization (%)   (WLM_CPU_LIMIT) = 0
 Activity Sort Memory Limit          (ACT_SORTMEM_LIMIT) = NONE
 Control file recovery path       (CTRL_FILE_RECOV_PATH) =
 Encrypted database                                      = YES
 Procedural language stack trace        (PL_STACK_TRACE) = NONE
 HADR SSL certificate label             (HADR_SSL_LABEL) =
 HADR SSL Hostname Validation        (HADR_SSL_HOST_VAL) = OFF

 BUFFPAGE size to be used by optimizer   (OPT_BUFFPAGE) = 0
 LOCKLIST size to be used by optimizer   (OPT_LOCKLIST) = 0
 MAXLOCKS size to be used by optimizer   (OPT_MAXLOCKS) = 0
 SORTHEAP size to be used by optimizer   (OPT_SORTHEAP) = 0


[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$

```

### (5) Deploy完了時点のライセンス登録状況
Community Edition(無償)が適用された状態
```
[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$ db2licm -l
Product name:                     "DB2 Enterprise Server Edition"
License type:                     "License not registered"
Expiry date:                      "License not registered"
Product identifier:               "db2ese"
Version information:              "11.5"

Product name:                     "DB2 Community Edition"
License type:                     "Community"
Expiry date:                      "Permanent"
Product identifier:               "db2dec"
Version information:              "11.5"
Max amount of memory (GB):        "16"
Max number of cores:              "4"
Features:
IBM DB2 Performance Management Offering:              "Not licensed"



[db2inst1@c-db2uinstance-2-db2u-0 - Db2U db2inst1]$
```


### (6) タイムゾーン設定方法の追跡
環境変数 TIMEZONE, TZ は、/etc/profile.d/os_envar_configmap.sh スクリプトで設定されるようでした。

```sh:/etc/profile.d/os_envar_configmap.sh
export EXTERNAL_SSH_ENABLED=NO
export TIMEZONE="Asia/Tokyo"
export TZ="Asia/Tokyo"
export ENABLE_ANALYTICS_ACCELERATOR=NO
export STIG_HARDENING=NO
export IAM_ENABLED=NO
export IAM_STASH_FILE=""
export SEGMENT_CRED_FILE=""
export ASPERA_HOST=""
export GUARDIUM_INFO=""
export PRUNE_LOGS_SCHEDULE=2
export USAGE_TRACKING_ENABLED=NO
export RUNTIME_ENV="LOCAL"
export SSH_PORT=50022
export BLUADMPASS=""
export REBALANCE_TABLESPACE=NO
export CERT_SVR_LABEL="CA-signed"
export DB2_ALLOW_SSL_ONLY="false"
export MLN_TOTAL="1"
export DATA_ON_MLN0="true"
export MLN_DISTRIBUTION="0:0"
export LDAP_ENABLED="true"
export LDAP_SERVER="c-db2uinstance-2-ldap"
export LDAP_DOMAIN="dc=blustratus,dc=com"
export LDAP_ADMIN="bluldap"
export LDAP_USER_GROUP="bluusers"
export LDAP_ADMIN_GROUP="bluadmin"
export LDAP_PORT="50389"
export STAGING_PATH=/local/db2inst1/staging
export FCM_IPS=""
export DB2TYPE="db2oltp"
export DBNAME="SAMPLEDB"
export DB_PATH=/mnt/blumeta0/db2/databases
export TABLE_ORG="ROW"
export DB_PAGE_SIZE="16384"
export ENCRYPT_DB="YES"
export ENCRYPT_DB_COMPRESS="NO"
export INSTANCE_MEMORY_PERCENT="90"
export DB_CODESET="UTF-8"
export DB_TERRITORY="JP"
export DB_COLLATION_SEQUENCE="IDENTITY"
export DB2INSTANCE="db2inst1"
export INST_GROUP="db2iadm1"
export FENCED_USER="db2fenc1"
export DB_USER_UID=500
export DB_ADM_GROUP_GID=1000
export DB_FENCED_USER_UID=501
export DB_FENCED_GROUP_GID=1001
export DB2_SEC_PLUGIN="NULL"
export DB2WOC_V3_MIGRATION="false"
export AUDIT_PV_IS_MOUNTED=false
export AUDIT_ENABLE_AUDIT="false"
export AUDIT_INTERVAL="15"
export AUDIT_APPLY_DEFAULT_POLICY="false"
export AUDIT_ARCHIVE_TO_DB="true"
export POD_NAME=c-db2uinstance-2-db2u-0
```