Cloud Pak for Business Automation

Cloud Pak for Business Automation

Come for answers. Stay for best practices. All we’re missing is you.

 View Only

Another method to Backup and Restore Business Teams Service (BTS) in IBM Cloud Pak for Business Automation

By DIAN GUO ZOU posted Wed October 12, 2022 11:54 AM

  


Authors: Dian Guo Zou,
Georg SanderBenjamin Wende

Introduction


The Business Teams Service (BTS) is a foundation service that is used in IBM Cloud Pak for Business Automation (CP4BA).

To protect the environment from data loss and corruption, it is important to backup the data from environment, so that the environment could be rebuilt from the backup data if the primary environment failed to provide services when disaster happened.

BTS data should be backup too. BTS data are stored in the EDB PostgreSQL service database, the EDB documentation contains examples for several storage providers including AWS S3, Google Cloud, Microsoft Azure and Minio. BTS Knowledge center describes how to utilize the S3 compatible storage to backup and restore BTS data.

In some environments, due to some reasons, the S3 compatible storage may be a service that can’t be accessed by CP4BA, so it’s better to provide a different method to backup and restore BTS data without S3 compatible storage.

This Blog describes a method to backup and restore BTS data without S3 compatible storage. To backup and restore BTS data is a sub-step of backup and restore CP4BA, this blog is using Business Automation Workflow (BAW) in IBM CP4BA 22.0.1 as an example, this blog won’t describe too much about the detail steps for backup and restore BAW, more information could reference the IBM Knowledge center.

Please note, the deployment may be different in different user’s environment, so the backup and restore method for that environment maybe some different from others. In below section, it is using following configuration and method to backup and restore:

  • Use Offline backup method. i.e. stop related pods before backup, so that there is no new data would be generated during backup, and the backup data could be in consistency state.
  • The deployment is using NFS as storage class, so the backup and restore method here based on the file system.
  • The deployment is using dynamic provision.
  • The deployment is BAW enterprise pattern for CP4BA 22.0.1 with Business Automation Workflow Capability and Content Platform Engine Capability.
  • The deployment is using DB2 single server as database server, and there is not configured JDBC over SSL.

  

Backup BAW environment and Backup BTS

This section describes the steps to backup the BAW environment and backup BTS. Here provides another method to backup BTS data.

  1. backup following secret: icp4adeploy-cpe-oidc-secret, admin-user-details, ibm-bts-cnpg-bawent-cp4ba-bts-app, and other secrets associated with CR deployment (e.g. DB username/password etc.)
  2. scale down working pods to 0.
  3. backup databases.
  4. backup necessary PVC definition. For example, backup following PVC definitions:
    • cpe-filestore-pvc-ctnrs
    • icn-cfgstore-ctnrs
    • datadir-zen-metastoredb-0
    • datadir-zen-metastoredb-1
    • datadir-zen-metastoredb-2
    • demo-instance1-baw-jms-data-vc-demo-instance1-baw-jms-0
  5. backup necessary PV files. To be simple, you could backup all files, but we would only restore the necessary files on target env. Please preserve permissions for all content during backup
  6. backup BTS data. Assumed that the name of BTS EDB pod is ibm-bts-cnpg-bawent-cp4ba-bts-1, execute following commands.
    # Firstly, backup BTS database 
      oc rsh ibm-bts-cnpg-bawent-cp4ba-bts-1
      export PX_USER=$(cat /etc/superuser-secret/username)
      export PX_PASSWORD=$(cat /etc/superuser-secret/password)
      pg_dump -d BTSDB -U postgres -Fp  -c -C --if-exists  -f /var/lib/postgresql/data/bk_btsdb.sql   
    exit

    # Secondly, copy the backup from the pod.
     oc cp ibm-bts-cnpg-bawent-cp4ba-bts-1:/var/lib/postgresql/data/bk_btsdb.sql  /tmp/bk_btsdb.sql
  7. copy the generated bk_btsdb.sql to target environment.

       

       Restore BAW environment and Restore BTS

      This section describes the steps to restore the BAW environment and restore BTS.

      Prerequisite before restoring:

      1. IAF/common services should be installed.
      2. Create a openshift project with exactly the same name as the primary environment.

      Please follow below steps to restore the environment.

      1. restore database
      2. restore secret for icp4adeploy-cpe-oidc-secret, admin-user-details, ibm-bts-cnpg-bawent-cp4ba-bts-app, and other secrets used for CR deployment (e.g. DB username/password etc.)
      3. Modify the permission for the PV backup files. Restore site may use different file permission from the source environment.
      4. Create the necessary PVC, Restore files for corresponding PVs.
      5. Prepare the custom resource (CR) definition, modify hostname, set “shared_configuration.sc_content_initialization: false” and “shared_configuration.sc_content_verification: false”to avoid redo initialization and verification to break existing data in database. If BAI is enabled, please remove initialize_configuration section in CR.
      6. Deploy the CR file.
      7. After deployment completed, copy bk_btsdb.sql to BTS PV folder, so that BTS pod could access bk_btsdb.sql.
      8. After deployment completed, restore BTS data with following commands:
        # Firstly, stop BTS server:

            oc scale deployment ibm-bts-cp4ba-bts-316-deployment --replicas=0  

        # Secondly, login BTS EDB pod to restore BTS data:

            oc rsh ibm-bts-cnpg-bawent-cp4ba-bts-1
            export PX_USER=$(cat /etc/superuser-secret/username)
            export PX_PASSWORD=$(cat /etc/superuser-secret/password)
            psql -U postgres -f /var/lib/postgresql/data/bk_btsdb.sql
            exit

        # Thirdly, restart BTS server.

           oc scale deployment ibm-bts-cp4ba-bts-316-deployment --replicas=1

      After that, you could verify if BTS data is completed.

       

       Reference:
       
      [1] Knowledge Center - Backing up and restoring: https://www.ibm.com/docs/en/cloud-paks/1.0?topic=service-backup-restore

      2 comments
      27 views

      Permalink

      Comments

      Sun July 21, 2024 11:16 PM

      @Shashi Mara, Had updated the document following your comments, Thanks!

      Fri July 19, 2024 07:30 PM

      Thanks for publishing the article; very useful to do a local backup before attempting to work on the Postgresql cluster .  

      Please add  'oc cp"  command for the pg_dump and restore option so the dumps are saved in the local filesystem.  It is too late if the pods restart or get destroyed.