Redeploying IBM Db2 Warehouse on Windows or Mac

If you already set up Db2® Warehouse on a Windows or Macintosh system but need to redeploy it, you must first take steps to preserve your data and configurations.

Before you begin

If you are using the Docker for Windows or Docker for Mac app, ensure that it is running.

Ensure that your Windows or Mac system meets the prerequisites described in Getting container images.

About this task

This task requires administrative authority.

How you perform this task depends on which installation method you use:
  • If you installed the Docker for Mac app, perform the following steps from the terminal.
  • If you are using the Docker for Windows app, perform the following steps in the Windows PowerShell in admin mode.
  • If you installed Docker Toolbox instead of one of those apps, perform the following steps from the Docker CLI prompt, which you obtain by using the Docker Quickstart Terminal desktop shortcut.

Procedure

  1. Clear your browser cache.
  2. Log in to Docker by using your API key:
    echo <apikey> | docker login -u iamapikey --password-stdin icr.io
    where <apikey> is the API key that you created as a prerequisite in Getting container images.
  3. Stop the Db2 Warehouse services by issuing the following command:
    docker exec -it Db2wh stop
  4. Stop the Db2 Warehouse container by issuing the following command:
    docker stop Db2wh
  5. Optional: If there is any data, including user accounts, that you want to have in your new deployment, save that data in a safe place such as a tar file.
  6. Remove the container by issuing the following command:
    docker rm -f Db2wh
  7. Remove the contents of the db2wh_vol volume by issuing the following command:
    Important: This step results in data loss, so ensure that you backed up any data that you want to preserve, as described in step 5.
    docker volume rm db2wh_vol
  8. Sometimes, the Docker engine does not release all its resources, such as UNIX sockets, and this can result in a port-availability check failure during redeployment. To avoid this, perform the following steps as the administrator.
    1. Delete the Docker network by issuing the following command:
      docker network rm db2wh_net
    2. If you are using the Docker for Windows or Docker for Mac app, restart Docker as follows:
      1. Right-click the whale icon.
      2. Click Quit Docker.
      3. Restart the Docker engine by clicking the Docker for Mac or Docker for Windows app.
    3. If you are using Docker Toolbox, restart the docker-machine VM by issuing the following command:
      docker-machine restart default
  9. Create a network by issuing the following command:
    docker network create db2wh_net
  10. Re-create the containers:
    1. Pull, create, and initialize the Db2 Warehouse container by issuing a docker run command.
      Note:
      The basic docker run command is:
      docker run -itd -p 8443:8443 -p 50000-50001:50000-50001 --net=db2wh_net --privileged=true --name=Db2wh -v db2wh_vol:/mnt/bludata0 -v db2wh_vol:/mnt/blumeta0 <tag>
      where <tag> represents the following value:
      • For a Db2 Warehouse Enterprise Edition container:
        icr.io/obs/hdm/db2wh_ee:v11.5.7.0-cn5-db2wh-linux
    2. Check the status of the redeployment by issuing the following command:
      docker logs --follow Db2wh
      After the deployment finishes, you should see a message that tells you that you successfully deployed Db2 Warehouse, along with the console URL and login information.
    3. Exit the Docker logs by pressing Ctrl+C.
    4. If the port availability check fails even though you performed step 8, perform the following steps:
      1. Remove the container by issuing the following command:
        docker rm -f Db2wh
      2. Remove the contents of the db2wh_vol volume by issuing the following command:
        docker volume rm db2wh_vol
      3. Delete the Docker network by issuing the following command:
        docker network rm db2wh_net
      4. Restart step 10 from the beginning.
  11. Log in to the web console by using https://localhost:8443.