Replicating data between your clusters

Learn how to replicate the data stored in PostgreSQL between your primary and secondary clusters.

Before you begin

To be able to run oc get secret commands on Red Hat® Enterprise Linux® systems, you must install jq.
yum install jq

About this task

The Inventory and User Configuration services store data in a PostgreSQL cluster, which is installed as part of the Netcool® Operations Insight® on Red Hat OpenShift® installation. When you install a geo-redundant deployment of Netcool Operations Insight on Red Hat OpenShift, you must replicate the data, which is stored in PostgreSQL, between the primary and secondary clusters.

Procedure

Share cluster certificate authorities

  1. To replicate data stored in PostgreSQL between two clusters, the Certificate Authority (CA) certificates for each cluster must be stored in a configmap on each cluster. The configmaps must be created in the same namespaces as the Netcool Operations Insight on Red Hat OpenShift deployment. Each certificate must be added in a different property in the configmap file.

    If the automatically generated ingress CA is used on Red Hat OpenShift Container Platform, the following process can be used to create these configmaps. For more information, see Configuring TLS encryption with Red Hat OpenShift Container Platform.

    • When logged in to the primary cluster, run the following command.
      oc get secret -o json -n openshift-ingress-operator router-ca  | jq -r '.data."tls.crt"|@base64d' > primary.crt
    • When logged in to the secondary cluster, run the following command.
      oc get secret -o json -n openshift-ingress-operator router-ca  | jq -r '.data."tls.crt"|@base64d' > secondary.crt

      If these commands were run on different machines or in different directories, copy both files into the same directory.

    • When logged in to the primary cluster, run the following command. The name of the configmap can be changed, this name will be required later.
      oc create configmap -n <NAMESPACE> postgres-replication-cas --from-file=primary.crt --from-file=secondary.crt
      
      When logged in to the secondary cluster, run the same oc create configmap command. If Netcool Operations Insight on Red Hat OpenShift is installed in different namespaces on each cluster, remember to change the namespace in the command.

Configure noi or noihybrid

  1. On the primary cluster, use; the oc edit or oc patch commands, or your preferred control mechanism, to add the following properties to the noi or noihybrid resource. The .spec.postgresql.replication parameter might already exist and must be updated.
    spec:
      postgresql:
        replication:
          enabled: true
          primary: true
          caConfigMap: postgres-replication-cas  # Name of the config map created earlier
    
  2. On the primary cluster, run the following command to get the value of the <PRIMARY_FQDN> parameter.
    oc get route -l app.kubernetes.io/name=postgres-repl -o=jsonpath='{range .items[*]}{.metadata.name}: {.spec.host}{"\n"}{end}'
    
  3. On the secondary cluster, add the following properties to the noi or noihybrid resource.
    spec:
      postgresql:
        replication:
          enabled: true
          registrationURL: https://<PRIMARY_FQDN>/sync/usercfg
          caConfigMap: postgres-replication-cas  # Name of the config map created earlier
    
  4. After the secondary cluster is ready, run the following commands on the primary cluster.
    Find the primary replication pod.
    oc get pod -l app.kubernetes.io/name=postgres-repl
    Run the following command on the primary replication pod.
    oc rsh -c server <PODNAME> /open-registration.sh