Deploying replication using shell scripts

To deploy Q Replication using shell scripts, you must enable the replication function on the Db2uInstances or Db2uCluster type in your Db2 Warehouse deployment.

Procedure

  1. Assign a name to your namespace:
    namespace= <names of your namespace>;
  2. List all the Db2uInstances in your deployment:
    kubectl get db2uinstance -n $namespace

    If you are using Db2uCluster type deployments, list them using the following command:

    kubectl get db2ucluster -n $namespace
  3. To enable Q Replication add-on on your Db2uInstance, download the script and run it from the Infra Node on your cluster:
    cd /tmp
    
    chmod a+x  bludr-enable-qrep-addOn-db2u.sh
    Execute bludr-enable-qrep-addOn-db2u.sh
    
    ./bludr-enable-qrep-addOn-db2u.sh
    
    
    Important: This is an interactive script and the following inputs are required from you to run this script:
    • Storage Class Name for QRep data (qrepdata) mount point
    • Storage Capacity in GibiBytes (GiB) for QRep data (qrepdata) mount point
    • Db2U custom resource (deployment) instance name
    • Infra hostname/Bastion name for this instance

    Ensure that you provide the local infra hostname/bastion name on which you want to enable Q Replication. Do not provide a remote hostname for infra hostname/bastion name.

    This action restarts the Db2 Warehouse database. The system administrator must inform all active users about the database stopping and starting. There is a database outage as this step can take approximately 20 minutes to complete.

  4. Expose Q Replication NodePorts on a high availability proxy running on infra node/bastion:
    cd /tmp ; 
    namespace= <names of your namespace> ;
    db2uinstName= <name of your Db2 instance>  ; 
    kubectl cp -n $namespace  $(kubectl  -n $namespace get po | grep $db2uinstName |grep qrep  | awk '{print $1}' ):/opt/ibm/bludr/scripts/bin/qrep-expose-nodeports.sh /tmp/qrep-expose-nodeports.sh ; 
    chmod a+x qrep-expose-nodeports.sh ; 
    
    Note: The following inputs are required from you to run this script:
    • Kubernates namespace
    • Name of the formation for Db2uInstance for which Q Replication is enabled
  5. Create and display NodePorts:
    1. Create NodePorts:
      oc project $namespace ; 
      ./qrep-expose-nodeports.sh  $db2uinstName ;
    2. Display NodePorts:
      kubectl get svc -n $namespace  | grep $db2uinstName  | grep db2u-engn-svc ;
      kubectl get svc -n $namespace | grep $db2uinstName   | grep qrep ; 

      Make a note of the following NodePorts:

      • Db2 Universal NodePort
      • Q Replication REST NodePort
      • Q Replication IBM Message Queue Capture NodePort
      • Q Replication IBM Message Queue Apply NodePort

      These NodePort values are required when configuring replication from your source site to your destination site.

  6. Activate the Q Replication on your source site by running the bludr-perform-source-actions script.
    kubectl exec -it -n  $namespace  $(kubectl -n $namespace get po | grep $db2uinstName |grep qrep  | awk '{print $1}' )  bash ;
    Once inside QRep container, switch user to dsadm
    su - dsadm ;
    cd $BLUDR_HOME/scripts/bin ;
    ./bludr-perform-source-actions.sh

    This is an interactive script. Enter option 1 to ensure that the source site is activated for replication. If the source system is not activated, run the script again and enter option 2 to activate the source for replication. You can run this script on the local host (option y) or remote host (option n) when prompted, if you want to modify the replication setup running on this system.

  7. Run all the steps from Step 2 to Step 5 again on the target site.