Preparing to back up or restore Db2 Warehouse
Before you can run the db2 backup
or db2 restore
commands, you need to identify the Db2
Warehouse catalog node and data nodes of the database
deployment.
Procedure
-
To identify the Db2
Warehouse containers, run the following command on any node in your
cluster:
kubectl get pods -n ${PROJECT_CPD_INSTANCE} | grep db2u
This command returns a list of one or more nodes for the Db2 Warehouse database configuration. A symmetric multiprocessing (SMP) configuration has only one physical node. A massively parallel processing (MPP) configuration has a container on each physical node in the deployment.
A sample SMP configuration:
A sample MPP configuration with three physical nodes:db2wh-1556786589-db2u-0 1/1 Running 0 3h54m
db2wh-1557883508-db2u-0 1/1 Running 0 3h26m db2wh-1557883508-db2u-1 1/1 Running 0 3h26m db2wh-1557883508-db2u-2 1/1 Running 0 3h26m
- To identify which container node is the Db2
Warehouse catalog node: For a single node configuration, the catalog node is always the same as physical node.
For a configuration with two or more nodes, you need to identify which physical node is the catalog node by reading the db2nodes.cfg file.
- Open a shell to any container
node:
Replace db2wh-container-name with the node name of any of the containers found the previous step.kubectl exec -it -n ${PROJECT_CPD_INSTANCE} db2wh-container-name -- bash
- Read the db2nodes.cfg file on the container node:
cat ~db2inst1/sqllib/db2nodes.cfg
Here is a sample db2nodes.cfg file that shows six multiple logical nodes (MLN) over three physical nodes:
The first node that is listed is the catalog node. In this example,0 db2wh-1557883508-db2u-0 0 1 db2wh-1557883508-db2u-1 1 2 db2wh-1557883508-db2u-2 2 3 db2wh-1557883508-db2u-0 0 4 db2wh-1557883508-db2u-1 1 5 db2wh-1557883508-db2u-2 2
db2wh-1557883508-db2u-0
is the catalog node.
- Open a shell to any container
node:
- Exit that bash shell and open a new shell to the catalog node.
kubectl exec -it -n ${PROJECT_CPD_INSTANCE} db2wh-catalog-name bash
Replace db2wh-catalog-name with the name of the catalog node that you found in the previous step.