Setting a timezone in new or existing Db2 deployments

You can edit the advOpts field to set a specific timezone for new or existing Db2 deployments.

About this task

You can add a timezone field within advOpts in your YAML file to set a timezone for new or existing Db2 deployments. The timezone field holds a string value that specifies the preferred timezone. This value follows the form "Continent/Specific city in continent".

While the code examples show commands for db2ucluster custom resources, this task can also be run for db2uinstance. You can replace occurrences of db2ucluster in code blocks with db2uinstance.

Procedure

  1. For new deployments:
    1. Before you deploy Db2, specify the timezone by creating a timezone field inside of advOpts in your YAML file, as seen in example:
      advOpts:
          timezone: "Europe/Madrid"
    2. Save the YAML file and then create the cluster or instance. Example:
      oc create -f tz-spec.yaml
  2. For existing deployments:
    1. Run this command, replacing <Continent/City> with the timezone you want to use:
      oc patch db2ucluster -n <PROJECT> <DB2UCLUSTER-NAME> --type merge -p '{"spec": { "advOpts": { "timezone": "<Continent/City>" } }}'
      
    2. Check that the corresponding db2uconfig configMap reflects the new timezone value:
      oc get cm -n <PROJECT> -o yaml c-<DB2UCLUSTER-NAME>-db2uconfig | grep -i timezone
      
    3. Delete one or more corresponding Db2 engine pods to enable the configMap changes to take effect:
      oc delete pods -n <PROJECT> c-<DB2UCLUSTER-NAME>-db2u-0
      

      After the pod is recreated, it will deploy in the updated timezone.