Sample Installation below:
(This is for DB2 on ZLinux, change the db2_developer_c:11.1.4.4-s390x to your corresponding platform):
# docker login
# docker pull store/ibmcorp/db2_developer_c:11.1.4.4-s390x
# mkdir /data
# docker run -h db2server --name db2server --restart=always --detach --privileged=true -p 50000:50000 -p 55000:55000 --env-file .env_list -v /data:/database store/ibmcorp/db2_developer_c:11.1.4.4-s390x
# docker ps | grep db2
d3646927e758 store/ibmcorp/db2_developer_c:11.1.4.4-s390x "/var/db2_setup/lib/…" About a minute ago Up About a minute 0.0.0.0:50000->50000/tcp, 22/tcp, 60006-60007/tcp, 0.0.0.0:55000->55000/tcp db2server
# docker logs d3646927e758
(*) Creating users ...
(*) Creating instance ...
DB2 installation is being initialized.
Total number of tasks to be performed: 4
Total estimated time for all tasks to be performed: 309 second(s)
Task #1 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #1 end
Task #2 start
Description: Initializing instance list
ls: cannot access /database/data/db2inst1/NODE0000: No such file or directory
Estimated time 5 second(s)
Task #2 end
Task #3 start
Description: Configuring DB2 instances
Estimated time 300 second(s)
Task #3 end
Task #4 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #4 end
The execution completed successfully.
For more information see the DB2 installation log at "/tmp/db2icrt.log.69".
DBI1446I The db2icrt command is running.
DBI1070I Program db2icrt completed successfully.
(*) Enabling TEXT_SEARCH for instance ...
DB2 installation is being initialized.
Total number of tasks to be performed: 4
Total estimated time for all tasks to be performed: 309 second(s)
Task #1 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #1 end
Task #2 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #2 end
Task #3 start
Description: Configuring DB2 instances
Estimated time 300 second(s)
Task #3 end
Task #4 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #4 end
The execution completed successfully.
For more information see the DB2 installation log at
"/tmp/db2iupdt.log.15631".
DBI1446I The db2iupdt command is running.
DBI1070I Program db2iupdt completed successfully.
06/04/2019 06:57:32 0 0 SQL1032N No start database manager command was issued.
SQL1032N No start database manager command was issued. SQLSTATE=57019
(*) Cataloging existing databases
(*) Applying Db2 license ...
LIC1402I License added successfully.
LIC1426I This product is now licensed for use as outlined in your License Agreement. USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE AGREEMENT, LOCATED IN THE FOLLOWING DIRECTOR
Y: "/opt/ibm/db2/V11.1/license/en_US.iso88591"
(*) Saving the checksum of the current nodelock file ...
(*) Updating DBM CFG parameters ...
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.
No Cgroup memory limit detected, instance memory will follow automatic tuning
DB2 State : Operable
DB2 has not been started
Starting DB2...
06/04/2019 06:57:47 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
(*) Starting TEXT SEARCH service ...
CIE00001 Operation completed successfully.
(*) User chose to create testdb database
(*) Creating database testdb ...
DB20000I The CREATE DATABASE command completed successfully.
DB20000I The ACTIVATE DATABASE command completed successfully.
06/04/2019 06:59:22 0 0 SQL1026N The database manager is already active.
SQL1026N The database manager is already active.
### Enabling LOGARCHMETH1
Database Connection Information
Database server = DB2/LINUXZ64 11.1.4.4
SQL authorization ID = DB2INST1
Local database alias = TESTDB
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
SQL1363W One or more of the parameters submitted for immediate modification
were not changed dynamically. For these configuration parameters, the database
must be shutdown and reactivated before the configuration parameter changes
become effective.
### Restarting DB2
06/04/2019 06:59:30 0 0 SQL1064N DB2STOP processing was successful.
SQL1064N DB2STOP processing was successful.
------------------------------
Carlos Mejia Johnson
------------------------------
Original Message:
Sent: Sun June 02, 2019 11:10 AM
From: Rachel Miles
Subject: Need Help Setting up the Db2 Developer-C Edition
I'm trying to set up the Db2 Developer-C Edition and I'm stuck at the "Setting up and running containers" part. It jumps from pulling the image to setting up a container with no real instruction between that. I'd like to be told explicitly how I need to write and run this .env_list and what all I need to customize myself.
Db2 Developer-C Edition | Sat Jun 01 2019
Summary
Install and run Db2 Developer-C Edition v11.1.4.4 using Docker and containers running CentOS. The image tag is now 11.1.4.4.
Highlights
- Latest:
Db2 v11.1 Mod Pack 4 Fix Pack 4
- Db2 HADR Support
- Multi-platform support- x86_64, ppc64le, s390x
Table of Contents
Prerequisites
- Docker engine
- Directory/filesystem for persistent storage (
Getting Db2 Developer-C image
Login into repository:
docker login User: <docker> Password: <docker>
Pull the db2server image:
For 11.1.4.4, we support 3 different architectures. Their respective docker pull
commands are:
docker pull store/ibmcorp/db2_developer_c:11.1.4.4-x86_64
docker pull store/ibmcorp/db2_developer_c:11.1.4.4-ppc64le
docker pull store/ibmcorp/db2_developer_c:11.1.4.4-s390x
- Previous version tags: 11.1.3.3b, 11.1.3.3a, 11.1.3.3x, 11.1.3.3 and 11.1.2.2b
Setting up and running containers
Below is an example configuration. Save it to an .env_list and edit it if you wish.
LICENSE=accept
DB2INSTANCE=db2inst1
DB2INST1_PASSWORD=password
DBNAME=testdb
BLU=false
ENABLE_ORACLE_COMPATIBILITY=false
UPDATEAVAIL=NO
TO_CREATE_SAMPLEDB=false
REPODB=false
IS_OSXFS=false
PERSISTENT_HOME=true
HADR_ENABLED=false
ETCD_ENDPOINT=
ETCD_USERNAME=
ETCD_PASSWORD=
- LICENSE is to agree to the terms and conditions of the Db2 software contained in this image
- DB2INSTANCE is to specify the Db2 Instance name
- DB2INST1_PASSWORD is to specify the respective Db2 Instance Password
- DBNAME creates an initial database with the name provided or leave empty if no database is needed
- BLU can be set to true to enable BLU Acceleration for instance
- ENABLE_ORACLE_COMPATIBILITY can be set to true to enable Oracle Compatibility on the instance
- UPDATEAVAIL can be set to yes if there is an existing instance and running a new container with a higher Db2 level. Will be deprecated on next release
- TO_CREATE_SAMPLEDB can be set to true to create a sample (pre-populated) database
- REPODB can be set to true to create a Data Server Manager repository database
- set IS_OSXFS=true if you are running on macOS
- PERSISTENT_HOME is true by default, only specify to false if you are running Docker for Windows
- HADR_ENABLED if set to true, Db2 HADR will be configured. The following three env variables depend on HADR_ENABLED to be true
- ETCD_ENDPOINT is for specifying your own provided ETCD key-value store. Enter your endpoints with a comma as the delimiter and without a space. This env variable is needed if HADR_ENABLED is set to true
- ETCD_USERNAME specify the username credential for ETCD. If empty, it will use your Db2 instance
- ETCD_PASSWORD specify the password credential for ETCD. If empty, it will use your Db2 instance password
docker run -h db2server_
--name db2server --restart=always \ --detach \ --privileged=true \ -p 50000:50000 -p 55000:55000 \ --env-file .env_list \ -v <db dir>:/database \ <image name>
- where
<db dir>
is an existing local directory and .env_list
is a collection of environment variables.
After the docker run command is executed, a duration will be required until completion. User may run docker logs -f <your_container_name>
to tail the docker entry point script. To confirm Db2 container is ready, in the logs we will see the message Setup has completed.
Log on to the container:
docker exec -ti db2server_<your_container_name> bash -c "su - ${DB2INSTANCE}"
- where
${DB2INSTANCE}
is the name of the instance user used during docker run
.
Running Db2 HADR
Requirements:
- Two Db2 Developer-C Edition containers running preferably on different servers. One will automatically configured to be the primary, and the other will be the standby. The takeovers will happen accordingly.
- An additional shared volume mount -v
- Include --ipc=host in the docker run command and of course the HADR environment variables mentioned above.
- Most importantly: You must have your own ETCD distributed key-value store which will be the two Db2 containers source of truth in the event one container goes down. Our governor that resides in both Db2 Docker containers must be able to communicate with the ETCD endpoints provided.
An example docker run command to include HADR:
docker run --name db2server --restart=always --privileged --ipc=host -p 50000 -p 55000 --env-file .env_list -v /home/db2server_fs/database:/database -v /home/db2server_fs/shared:/hadr -e HADR_ENABLED=true --net=host store/ibmcorp/db2_developer_c:11.1.4.4-x86_64
In the event we lose one of the containers, the user must manually start back up the container so the two Db2 containers can HADR connect once again.
For more information refer to https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.ha.doc/doc/c0011267.html
Build Your Own
You can use the Developer-C docker container as a base to build your own custom container. Customizations may include additional setup scripts to execute after Db2 setup has completed, different license activation keys, additional OS packages installed, etc.
To build your own, create a new Dockerfile and specify the desired Db2 Developer-C base in the FROM
line in the Dockerfile. The following example builds a simple container with Db2 Developer-C as a base and copy a custom script into the /var/custom
directory. Any script copied into the /var/custom
will be automatically executed after main Db2 setup has completed.
FROM store/ibmcorp/db2_developer_c:11.1.4.4-x86_64RUN mkdir /var/customCOPY createschema.sh /var/customRUN chmod a+x /var/custom/createschema.sh
Change Db2 License Key
The Db2 Developer-C docker container is licensed with the Db2 Developer-C license, which has limitations on CPU, memory, and database size (4 cores, 16 GB of memory, and 100GB of storage; see https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.licensing.doc/doc/c0058536.html for details).
You can change the license for the docker container by executing these commands:
docker cp <new> db2server_<your_container_name>:/database/config
, where
docker exec -ti db2server_<your_container_name> bash -c "/opt/ibm/db2/V11.1/adm/db2licm -r db2dec && /opt/ibm/db2/V11.1/adm/db2licm -a /database/config/<new>"
, where
------------------------------
Rachel Miles
------------------------------
#Db2