Ransomware attackers specifically target and attempt to destroy backup systems to increase the probability of payment. Hardening your system is critical. Please ensure you have reviewed your platform security using the Security Hardening Checklist
Cohesity

COHESITY Documentation

Explore our documentation to get started, discover products & new features, access troubleshooting guides, register sources, platforms support.

Products
Data Security Alliance
Visit Cohesity.com
Demos
Support
Blogs
Developers
Partner Portals
Cohesity Community
© 2026 Cohesity, Inc. All Rights Reserved.
Terms of Use|
Privacy Policy|
Legal|
  1. Home
  2. NetBackup™ Deployment Guide for Kubernetes Clusters
  3. Section II. Deployment
  4. Deploying Cloud Scale
  5. Deploying Postgres
  6. Enable request logging, update configuration, and copying files from/to PostgreSQL pod
NetBackup™ Deployment Guide for Kubernetes Clusters

Enable request logging, update configuration, and copying files from/to PostgreSQL pod

This section provides the steps to enable, update and copy the container based PostgreSQL deployment for NetBackup database service.

Following are the PostgreSQL log and configuration files location:

  • PostgreSQL log: /netbackup/postgresqldb/logs/*

  • PostgreSQL config: /netbackup/postgresqldb/postgresql.conf

  • PostgreSQL hba: /netbackup/postgresqldb/pg_hba.conf

  • PostgreSQL bin: /usr/openv/db/bin

  • PgBouncer ini: /home/nbsvcusr/postgresqldb/pgbouncer.ini

Enabling request logging in container based PostgreSQL

Perform the following to update the configuration or enable request for logging when there is a separate PostgreSQL container:

  1. Run the following command to exec into the Postgres pod:

    kubectl exec -it <postgres-pod-name> -n netbackup - - bash

    Run the following command to list the PostgreSQL logs:

    ls -l /netbackup/postgresqldb/log/

    Run the following command to view the conf file:

    cat /netbackup/postgresqldb/posgresql.conf

  2. Modify the PostgreSQL configurations, perform the following:

    Note:

    Any changes done to /netbackup/postgresqldb/postgresql.conf file would be lost during the PostgreSQL pod restart.

    Method 1

    • Run the following command to exec into the Postgres pod:

      kubectl exec -it <postgres-pod-name> -n netbackup - - bash

    • Set the value of log_parameter_max_length parameter to 0 as follows:

      sed -i 's/^#log_parameter_max_length = -1/log_parameter_max_length = 0/' /netbackup/postgresqldb/postgresql.conf

    • Restart Postgres as follows:

      su nbsvcusr -c 'pg_ctl stop -w -D /netbackup/postgresqldb'

      su nbsvcusr -c 'pg_ctl start -w -D /netbackup/postgresqldb'

    Method 2 (Requires access to the internet)

    • Run the following command to exec into the Postgres pod:

      kubectl exec -it nb-postgresql-0 -n netbackup - - bash

    • Run the following command to download the vi:

      microdnf install vi

    • Edit the postgresql.conf file as follows:

      vi /netbackup/postgresqldb/postgresql.conf

    • Restart Postgres as follows:

      su nbsvcusr -c 'pg_ctl stop -w -D /netbackup/postgresqldb'

      su nbsvcusr -c 'pg_ctl start -w -D /netbackup/postgresqldb'

To deploy PostgreSQL with custom configuration

  • Start PostgreSQL with custom configuration files as follows:
    • Create psqlconf dir and copy the configuration files:

      mkdir psqlconf

      kubectl cp netbackup/nb-postgresql-0:/netbackup/postgresqldb/postgresql.conf psqlconf/postgresql.conf
      kubectl cp netbackup/nb-postgresql-0:/netbackup/postgresqldb/pg_hba.conf psqlconf/pg_hba.conf
      kubectl cp netbackup/nb-postgresql-0:/home/nbsvcusr/postgresqldb/pgbouncer.ini psqlconf/pgbouncer.ini
    • Modify the settings of postgresql.conf file:

      vi psqlconf/postgresql.conf

    • Create the nbsqlconf configMap:

      kubectl create configmap nbpsqlconf --from-file=psqlconf -n netbackup

    • Use the following command to save the PostgreSQL chart values to a file:

      helm show values postgresql-<version>.tgz > postgres-values.yaml

    • Modify postgresql helm chart input file: :

      vi postgres-values.yaml

      Uncomment configMapName, mountConf, pgbouncerIniPath, postgresqlConfFilePath, pgHBAConfFilePath as in the following example:

      # Default values for postgresql.
      global:
        environmentNamespace: "netbackup"
        containerRegistry: "123456789abc.dkr.ecr.us-east-1.amazonaws.com"
       
      postgresql:
        replicas: 1
        # The values in the image (name, tag) are placeholders. These will be set
        image:
          name: "netbackup/postgresql"
          tag: "11.0"
          pullPolicy: Always
        service:
          serviceName: nb-postgresql
        volume:
          volumeClaimName: nb-psql-pvc
          volumeDefaultMode: 0640
          pvcStorage: 5Gi
          configMapName: nbpsqlconf
          storageClassName: nb-disk-premium
          mountPathData: /netbackup/postgresqldb
          secretMountPath: /netbackup/postgresql/keys/server
          mountConf: /netbackup
          timezone: null
        securityContext:
          runAsUser: 0
        createCerts: true
        pgbouncerIniPath: /netbackup/pgbouncer.ini
        serverSecretName: postgresql-server-crt
        clientSecretName: postgresql-client-crt
        dbSecretName: dbsecret
        dbPort: 13785
        pgbouncerPort: 13787
        dbAdminName: postgres
        initialDbAdminPassword: postgres
        dataDir: /netbackup/postgresqldb
        postgresqlConfFilePath: /netbackup/postgresql.conf
        pgHbaConfFilePath: /netbackup/pg_hba.conf
        defaultPostgresqlHostName: nb-postgresql
    • Reinstall postgresql helm chart using the modified input file:

      helm upgrade --install postgresql postgresql-<version>.tgz -f postgres-values.yaml -n netbackup

      Wait for the postgres pod to restart.

To enable request logging

  • Enable request logging by performing the following changes to postgresql.conf file:
    log_min_duration_statement = 0

    Note:

    The value 0 means the setting is the threshold in milliseconds after which the statement is to be logged.

    log_checkpoints = on
    log_connections = on
    log_disconnections = on
    log_lock_waits = on
    log_temp_files = 0
    log_autovacuum_min_duration = 0
    log_error_verbosity = default

Accessing container based PostgreSQL files
  1. Run the following command to exec into the Postgres pod:

    kubectl exec -it <postgres-pod-name> -n netbackup - - bash

    Run the following command to list the PostgreSQL logs:

    ls -l /netbackup/postgresqldb/log/

    Run the following command to view the conf file:

    cat /netbackup/postgresqldb/posgresql.conf

  2. Perform one of the following methods to copy files out of PostgreSQL container:

    • Method 1:

      Run the following commands:

      kubectl exec nb-postgresql-0 -n netbackup -- cat /netbackup/postgresqldb/postgresql.conf > /tmp/postgresql.conf

      kubectl exec nb-postgresql-0 -n netbackup -- cat /netbackup/postgresqldb/log/postgresql-Tue.log > /tmp/postgresql-Tue.log

    • Method 2 (Requires access to the internet):

      Exec into Postgres pod and install tar:

      kubectl exec -i nb-postgresql-0 -n netbackup - - microdnf install tar

      Copy the files:

      kubectl cp netbackup/nb-postgresql-0:/netbackup/postgresqldb/postgresql.conf /tmp/postgresql.conf

Feedback

Was this page helpful?
Previous

Deploying Postgres

Next

Deploying Cloud Scale environment

Feedback

Was this page helpful?