Skip to main content
Skip table of contents

Requirements for PostgreSQL staging and target environments

Environments must follow a set of requirements that have been defined in the Minimum Staging and Target environment requirements. Additionally, for operations (1) and (2), sudo privileges for the environment's operating system (OS) user requirements are necessary. 

Optionally, you can configure Privilege Elevation, which allows a low-privilege user to perform higher-privileged operations; improving the environment’s security profile. This feature can be added later at any time.

As background, the Delphix Continuous Data Engine connects via SSH to the staging and target environments to perform the following operations: 

  1. Mount and unmount directories for linking and provisioning operations. These privileges are essential to Delphix functionality;  mount and unmount are typically privileged and likely require additional privileges to be granted during installation and configuration.

  2. Create and remove directories for linking and provisioning operations.

  3. Run a variety of commands requested by the PostgreSQL connector.

Minimum staging and target environment configuration requirements

Follow these requirements to ensure that your environment is configured accordingly:

Staging/Target environment requirements

Explanation

Environment compatibility check

The operating system and architecture of the target environment must match the source environment. 

It is required that the source and the target environments have compatible operating systems and hardware configurations. This is to ensure that the database runs correctly.

PostgreSQL installation and compatibility check

There must be an installation of PostgreSQL on the staging/target environment that is compatible with the installation of PostgreSQL on the source environment.

Two installations of PostgreSQL are compatible only if:

  1. They share the same vendor (for example, PostgreSQL is incompatible with EnterpriseDB Postgres Plus Advanced Server).

  2. They share the same major version number (for example, 14.4 is compatible with 14.x; however, it is incompatible with 12.x, 13.x, or 15.x).

“Toolkit Path” 

There must be a directory on the staging/target environment with the following properties:

  1. The directory must be writable by the operating system user mentioned above.

  2. The directory must have at least 1.5 GB of available storage.

The “Toolkit Path” in the Environment creation UI page is the directory on the staging/target environment where the PostgreSQL Connector support files are installed (for example, /var/tmp) and the connector logs are located. The Delphix Toolkit facilitates communication between Delphix CD Engine and this specific Environment. Files will be deposited into this path by the Delphix CD Engine during Environment Discovery operation.

There must be a directory (e.g. "/mnt/provision/" or "/mnt/staging/") that will be used as a container for the NFS mount points that are created when provisioning a VDB or linking a staging push dSource.

The primary OS group (i.e. postgres) must own the directory.

The directory must have at least permissions -rwxrwx--- (0770).

There must be no symbolic links in the path of this directory, because NFS can mount into a directory with symlinks in its path, but cannot unmount.

Locale en_US.UTF-8 should be available at OS level on staging/target environment.

The PostgreSQL connector uses en_US.UTF-8 LANG settings to capture snapshot metadata in English.

Required utilities and tools

The netstat or ss utility must be installed on the staging/target environment.

The PostgreSQL connector checks the status of the running PostgreSQL instance and validates if ports are available on the staging/target environment using the netstat or ss utility.

Checking if netstat or ss utility is installed with:

CODE
which netstat
which ss

Zip and unzip must be installed on the staging/target environment for external backup support.

Note: This is required if providing the source backup to the PostgreSQL Connector as a ZIP file.

PostgreSQL connector requires zip and unzip utility to unzip archived external backup files.

Check if zip and unzip utility is installed with:

CODE
which zip
which unzip

The DELPHIX_PG_PATH must be set if the PostgreSQL installation you want to discover is in a shutdown state.

The following syntax should be used for the DELPHIX_PG_PATH environment variable:

CODE
DELPHIX_PG_PATH="<postgres_binary_path1>:<data_path1>; <postgres_binary_path2>:<data_path2>"

For more information, refer to the Discovering installations sections.

(Optional) Hostname and IP may need to be set in /etc/hosts file to point to the correct IP address.

The output of the “hostname -i” command should produce the correct result as the IP address of the server.

For example:

CODE
[postgres@source postgres]$ hostname -i
10.110.207.113

Sudo privileges for the environment users

An environment user account on the environment must be selected to communicate with both the staging and target environments. As required by the PostgreSQL connector, you must grant this environment user the following two key privileges:

  1. Disable requiretty: The Delphix Continuous Data Engine requires the `requiretty` setting to be disabled. This allows the environment user to run sudo commands without a logged-in terminal session (tty).

  2. Add NOPASSWD: By including the NOPASSWD qualifier, you ensure that the "sudo" command does not prompt for a password when executing certain commands such as mount, umount, mkdir, and rmdir.

In the example configurations, the environment username postgres is used. Make sure to modify the username based on the environment user available in the environment for performing the linking and/or provisioning operations.

Procedure

Perform the following steps on both the staging and target environments. 

  1. The sudo configuration is located in the /etc/sudoers file. Run the following  commands to open the `sudoers’ file:

    CODE
    vi /etc/sudoers

Third party tools like `visudo`, can be helpful in minimizing syntax errors.

  1. Next, update the file with the following snippet to grant the required privileges to the postgres` user:

    CODE
    Defaults:postgres !requiretty
    postgres ALL=NOPASSWD:  /bin/mount,/bin/umount,/bin/mkdir,/bin/rmdir

Additional examples

The examples below demonstrate how a user’s privileges can be further refined. Note that these examples are for illustrative purposes only and are subject to change.

Example one

This example restricts the use of sudo privileges to the `/postgres` directory.

Note that wildcards are allowed for the options with mount and umount commands because those commands expect a fixed number of arguments after the options. The option wildcard on the mount command also enables you to specify the file-system being mounted from the Delphix Continuous Data Engine. However, wildcards are not allowed with mkdir and rmdir because they can have any number of arguments after the options. For those commands, you must specify the exact options (-p, -p -m 755) used by the Delphix Continuous Data Engine.

Example: /etc/sudoers file configuration on the target environment for sudo privileges on the VDB mount directory only (Linux OS)

CODE
Defaults:postgres !requiretty
delphix_os ALL=(root) NOPASSWD: \
/bin/mount  *        /postgres/*, \
/bin/umount *        /postgres/*, \
/bin/umount          /postgres/*, \
/bin/mkdir -p        /postgres/*, \
/bin/mkdir -p -m 755 /postgres/*, \
/bin/mkdir           /postgres/*, \
/bin/rmdir           /postgres/*

Example two

This example restricts use of sudo privileges to the /postgres directory, restricts the mount commands to a specific Delphix Continuous Data Engine hostname and IP, and does not allow user-specified options for the umount command. This configuration is more secure, but there is a tradeoff with deployment simplicity. This approach would require a different sudo configuration for targets configured for different Delphix Continuous Data Engines.

Example: Configuring the /etc/sudoers file on the target environment for privileges on the VDB mount directory only (Linux OS)

CODE
Defaults:delphix_os !requiretty
delphix_os ALL=(root) NOPASSWD: \
/bin/mount           <delphix-server-name>* /postgres/*, \
/bin/mount *         <delphix-server-name>* /postgres/*, \
/bin/mount           <delphix-server-ip>*   /postgres/*, \
/bin/mount *         <delphix-server-ip>*   /postgres/*, \
/bin/mount "", \
/bin/umount          /postgres/*, \
/bin/umount *        /postgres/*, \
/bin/mkdir [*]       /postgres/*, \
/bin/mkdir           /postgres/*, \
/bin/mkdir -p        /postgres/*, \
/bin/mkdir -p -m 755 /postgres/*, \
/bin/rmdir           /postgres/*

Privilege elevation requirements

The optional Privilege Elevation feature allows a non-privileged environment user (e.g., delphix_os) to gain the permissions of a privileged environment user (e.g., postgres) for operations on the staging or target environments. This configuration can be valuable to maximize an environment's security posture. 

Procedure

First, the privilege elevation script, dlpx_db_exec, must be created and uploaded onto the Delphix Continuous Data Engine. Then, the non-privileged environment user must be granted the appropriate permissions.

  1. Upload the privilege elevation script.

Perform one of the following  methods to upload the privilege elevation script:

a) CURL file upload method

Before running any of the following  commands, update <CONTINUOUS-DATA-FQDN-or-IP>,  <USERNAME>, and <PASSWORD> placeholder values.

  1. Create a session with the Delphix Continuous Data Engine.

    1. Also, update the version values for  `major`, `minor`, and `micro` fields. 

      1. The correct values for your Delphix Continuous Data Engine version can be found in the API version information.

        CODE
        curl -i -c cookies.txt -X POST -H "Content-Type:application/json" https://<CONTINUOUS-DATA-FQDN-or-IP>/resources/json/delphix/session -d '{
            "version":{
                "major":1, 
                "minor":11,
                "micro": 5, 
                "type":"APIVersion"
            },
            "type":"APISession"
        }'
  2. Login to Delphix Continuous Data Engine as the `admin` user.

    CODE
    curl -i -c cookies.txt -b cookies.txt -X POST -H "Content-Type:application/json" https://<CONTINUOUS-DATA-FQDN-or-IP>/resources/json/delphix/login -d '{
        "username":"<USERNAME>",
        "password":"<PASSWORD>",
        "type":"LoginRequest",
        "target":"DOMAIN"
    }'
  3. Copy DLPX_DB_EXEC contents to the Delphix Continuous Data Engine.

    CODE
    curl -i -b cookies.txt -X POST -H "Content-Type:application/json" https://<CONTINUOUS-DATA-FQDN-or-IP>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-7 -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2018 by Delphix. All rights reserved.\n#\n#\n# This script allows customization of command execution with an alternate user\n# account.\nif [[ $1 != -u* ]]; then\n    echo \"Incorrect command line parameters, -u<optional user account> is required as the first parameter\"\n    exit 1\nfi\nuser_id=`echo $1 | sed -e \"s\/^-u\/\/\"`\nshift 1\nif [[ $user_id != \"delphix_os\" ]]; then\n    command=$(printf \"%s\" \"$@\")\n    cd /tmp\n    sudo -E su $user_id -p -c \"$command\"\nelse\n    $@\nfi\n"
    }'

If the dlpx_db_exec script is updated after the environment(s) is added, refresh the environment to propagate the changes.

b) CLI method

For steps on creating a Privilege Elevation Profile, refer to CLI Cookbook: How to create or edit privilege elevation profiles and profile scripts.

  1. Configure sudo privileges to grant Privilege Elevation

With Privilege Elevation, all PostgreSQL connector commands are run via the dlpx_db_exec script, and within this script, the commands are run using ‘sudo’. In order to execute the connector commands as the high-privileged environment user, sudoers entries are required.

To add additional sudoers entries you need to edit the /etc/sudoers file. Run the following  commands to open the `sudoers’ file:

CODE
vi /etc/sudoers
# or
visudo

Third party tools like `visudo`, can be helpful in minimizing syntax errors.

Templates for different connector versions are given below. These examples assume the following:

  • The Operating System is Linux

  • The privileged environment user is named “postgres”

  • The low privileged environment user is named “delphix_os”

You must update the `privileged environment user` and the `low privileged environment user` as per your environment.

Entries required for both linking and provisioning via low-privileged user (delphix_os):

Connector Version >= 4.1.0 (as a drop-down)

CODE
Defaults:delphix_os !requiretty
delphix_os ALL=NOPASSWD:SETENV: /bin/mount,\
/bin/umount,\
/bin/mkdir,\
/bin/rmdir,\
/bin/ps,\
/bin/su postgres -p -c '*'/createdb -p * '*',\
/bin/su postgres -p -c '*'/dropdb -p * '*',\
/bin/su postgres -p -c '*'/pg_dump -Fd '*' -p * -j * -h '*' -f '*/*_backup' -U * --verbose,\
/bin/su postgres -p -c '*'/pg_dumpall --globals-only --no-role-password --clean -p * -h '*' -f '*/*dumpall_file.sql' -U *,\
/bin/su postgres -p -c '*'/pg_restore -p * -d '*' -j * '*/*_backup' --verbose,\
/bin/su postgres -p -c */pg_basebackup -D */data -F t -v -w * -p * -U * --checkpoint\=fast,\
/bin/su postgres -p -c */pg_controldata */data,\
/bin/su postgres -p -c */pg_ctl --version,\
/bin/su postgres -p -c */pg_ctl initdb -D */data,\
/bin/su postgres -p -c */pg_ctl initdb -D */data -o '*',\
/bin/su postgres -p -c */pg_ctl initdb -D */postgres_init,\
/bin/su postgres -p -c */pg_ctl initdb -D */postgres_init -o '*',\
/bin/su postgres -p -c */pg_ctl start -D */data -t * &> */.delphix/postgres_db_log,\
/bin/su postgres -p -c */pg_ctl status -D */data,\
/bin/su postgres -p -c */pg_ctl stop -D */data &> */.delphix/postgres_db_log,\
/bin/su postgres -p -c */pg_isready -h * -p *,\
/bin/su postgres -p -c */psql -t -U * -p * -d * -h * -c 'select 1;',\
/bin/su postgres -p -c */psql -p * -d postgres -f '*/dumpall_file.sql',\
/bin/su postgres -p -c */psql -t -U * -p * -d * -h * -c 'select name\, setting from pg_settings;' -o */.delphix/source_postgresql_config_file.conf,\
/bin/su postgres -p -c */psql -t -U * -p * -d * -h * -c 'show server_version;',\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'database_oid' > */.delphix/database_oid,\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'ingestion_method' > */.delphix/ingestion_method,\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'postgresql_tmp.conf' > */data/postgresql_tmp.conf,\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'recovery.conf' >> */data/recovery.conf,\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'tablespace_file' > */.delphix/tablespace_file,\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'walControl.sh' > */data/scripts/walControl.sh,\
/bin/su postgres -p -c cat '*/.delphix/postgres_db_log',\
/bin/su postgres -p -c cat '*/data/PG_VERSION',\
/bin/su postgres -p -c cat '*/data/current_logfiles',\
/bin/su postgres -p -c cat '*/data/postgresql.conf',\
/bin/su postgres -p -c cat '*/dumpall_file.sql',\
/bin/su postgres -p -c cat '*/scratch_file.sql',\
/bin/su postgres -p -c cat '*/source_postgresql_config_file.conf',\
/bin/su postgres -p -c chmod 0700 '*/data',\
/bin/su postgres -p -c chmod 0700 '*/data/recovery.conf.delphix',\
/bin/su postgres -p -c chmod 0755 '*/data/scripts/walControl.sh',\
/bin/su postgres -p -c chmod 0666 '*/scratch_file.sql',\
/bin/su postgres -p -c cp '*' '*/data/postgresql.conf',\
/bin/su postgres -p -c cp '*/data/postgresql.conf' '*/data/postgresql.conf_backup',\
/bin/su postgres -p -c cp '*/dumpall_file.sql' '*/scratch_file.sql',\
/bin/su postgres -p -c echo '' > '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c echo '' > '*/data/recovery.conf',\
/bin/su postgres -p -c echo '' > '*/data/standby.signal',\
/bin/su postgres -p -c echo '' > '*/data/recovery.signal',\
/bin/su postgres -p -c echo '' > '*/.delphix/staging_push',\
/bin/su postgres -p -c find * -type f -name PostgreSQL_T\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\].zip,\
/bin/su postgres -p -c find * -type d -name PostgreSQL_T\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\],\
/bin/su postgres -p -c find * -type f -name base.tar,\
/bin/su postgres -p -c find */data -type f -name \*.tar,\
/bin/su postgres -p -c find * -type f -name \[0-9\]\*tar,\
/bin/su postgres -p -c grep -w '^log_directory' '*/data/postgresql.conf',\
/bin/su postgres -p -c grep -w '^max_connections' '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c grep -w '^max_connections' '*/data/postgresql_source.conf',\
/bin/su postgres -p -c grep -w '^max_wal_senders' '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c grep -w '^max_wal_senders' '*/data/postgresql_source.conf',\
/bin/su postgres -p -c grep -w '^port' '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c grep -w '^port' '*/data/postgresql.conf',\
/bin/su postgres -p -c grep -w '^wal_keep_segments' '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c grep -w '^wal_keep_segments' '*/data/postgresql_source.conf',\
/bin/su postgres -p -c grep -w '^wal_keep_size' '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c grep -w '^wal_keep_size' '*/data/postgresql_source.conf',\
/bin/su postgres -p -c grep -w '^timezone' '*/data/postgresql.conf',\
/bin/su postgres -p -c ln -s '../tablespace/*' '*/data/pg_tblspc',\
/bin/su postgres -p -c ls -lrt '*' | tail -n+2,\
/bin/su postgres -p -c mkdir -p '*',\
/bin/su postgres -p -c du -sb '*',\
/bin/su postgres -p -c mv '*/data/postgresql.auto.conf' '*/data/postgresql.auto.conf.delphix',\
/bin/su postgres -p -c mv '*/data/postgresql.auto.conf' '*/data/postgresql.auto.source.conf',\
/bin/su postgres -p -c mv '*/data/postgresql.conf' '*/data/postgresql_source.conf',\
/bin/su postgres -p -c mv '*/data/postgresql_tmp.conf' '*/data/postgresql.conf',\
/bin/su postgres -p -c mv '*/data/postmaster.opts' '*/data/postmaster.opts.delphix',\
/bin/su postgres -p -c mv '*/data/recovery.conf' '*/data/recovery.conf.delphix',\
/bin/su postgres -p -c mv '*/data/standby.signal' '*/data/standby.signal.delphix',\
/bin/su postgres -p -c mv '*/postgres_init/postgresql.auto.conf' '*/data',\
/bin/su postgres -p -c mv '*/postgres_init/postgresql.conf' '*/data',\
/bin/su postgres -p -c mv '*/postgres_init/pg_hba.conf' '*/data',\
/bin/su postgres -p -c mv '*/postgres_init/pg_ident.conf' '*/data',\
/bin/su postgres -p -c mv '*/scratch_file.sql' '*/dumpall_file.sql',\
/bin/su postgres -p -c printenv param_value >> */data/recovery.conf,\
/bin/su postgres -p -c rm -f '*/data/*.tar',\
/bin/su postgres -p -c rm -f '*/data/postmaster.pid',\
/bin/su postgres -p -c rm -f '*/data/tablespace_map',\
/bin/su postgres -p -c rm -r -f '*',\
/bin/su postgres -p -c tail -n 1 '*/data/scripts/WalBreakChainDetected',\
/bin/su postgres -p -c tail -n 1 '*/data/scripts/InvalidRecordFileFoundData',\
/bin/su postgres -p -c tail -n * '*/data/log/*',\
/bin/su postgres -p -c tail -n * '*/data/pg_log/*',\
/bin/su postgres -p -c tar -xf */base.tar -C */data,\
/bin/su postgres -p -c tar -xf */pg_wal.tar -C */data/pg_wal,\
/bin/su postgres -p -c tar -xf */*.tar -C */data/tablespace*,\
/bin/su postgres -p -c test -d '*',\
/bin/su postgres -p -c test -f '*',\
/bin/su postgres -p -c test -r '*' && test -w '*' && test -x '*',\
/bin/su postgres -p -c test -r '*' && test -x '*',\
/bin/su postgres -p -c test -r '*',\
/bin/su postgres -p -c test -w '*' && test -x '*',\
/bin/su postgres -p -c unzip '*/PostgreSQL_T[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].zip' -d '*/data',\
/bin/su postgres -p -c zipinfo* '*/PostgreSQL_T[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].zip'

3.1.0 <= Connector Version < 4.1.0 (as a drop-down)

CODE
Defaults:delphix_os !requiretty
delphix_os ALL=NOPASSWD:SETENV: /bin/mount,\
/bin/umount,\
/bin/mkdir,\
/bin/rmdir,\
/bin/ps,\
/bin/su postgres -p -c '*'/createdb -p * '*',\
/bin/su postgres -p -c '*'/dropdb -p * '*',\
/bin/su postgres -p -c '*'/pg_dump -Fd '*' -p * -j * -h '*' -f '*/*_backup' -U * --verbose,\
/bin/su postgres -p -c '*'/pg_dumpall --globals-only --no-role-password --clean -p * -h '*' -f '*/*dumpall_file.sql' -U *,\
/bin/su postgres -p -c '*'/pg_restore -p * -d '*' -j * '*/*_backup' --verbose,\
/bin/su postgres -p -c */pg_basebackup -D */data -F t -v -w * -p * -U * --checkpoint\=fast,\
/bin/su postgres -p -c */pg_controldata */data,\
/bin/su postgres -p -c */pg_ctl --version,\
/bin/su postgres -p -c */pg_ctl initdb -D */data,\
/bin/su postgres -p -c */pg_ctl initdb -D */postgres_init,\
/bin/su postgres -p -c */pg_ctl start -D */data -t * &> */.delphix/postgres_db_log,\
/bin/su postgres -p -c */pg_ctl status -D */data,\
/bin/su postgres -p -c */pg_ctl stop -D */data &> */.delphix/postgres_db_log,\
/bin/su postgres -p -c */pg_isready -h * -p *,\
/bin/su postgres -p -c */psql -t -U * -p * -d * -h * -c 'select 1;',\
/bin/su postgres -p -c */psql -p * -d postgres -f '*/dumpall_file.sql',\
/bin/su postgres -p -c */psql -t -U * -p * -d * -h * -c 'select name\, setting from pg_settings;' -o */.delphix/source_postgresql_config_file.conf,\
/bin/su postgres -p -c */psql -t -U * -p * -d * -h * -c 'show server_version;',\
/bin/su postgres -p -c */psql -t -U * -p * -c "select SUM(pg_database_size(pg_database.datname)) from pg_database;",\
/bin/su postgres -p -c */psql -t -U * -p * -d * -c "select pg_database_size(pg_database.datname) from pg_database where pg_database.datname\= '*';",\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'database_oid' > */.delphix/database_oid,\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'ingestion_method' > */.delphix/ingestion_method,\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'postgresql_tmp.conf' > */data/postgresql_tmp.conf,\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'recovery.conf' >> */data/recovery.conf,\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'tablespace_file' > */.delphix/tablespace_file,\
/bin/su postgres -p -c base64 -d $DLPX_PG_PLUGIN_ECHO_PATH/'walControl.sh' > */data/scripts/walControl.sh,\
/bin/su postgres -p -c cat '*/.delphix/postgres_db_log',\
/bin/su postgres -p -c cat '*/data/PG_VERSION',\
/bin/su postgres -p -c cat '*/data/current_logfiles',\
/bin/su postgres -p -c cat '*/data/postgresql.conf',\
/bin/su postgres -p -c cat '*/dumpall_file.sql',\
/bin/su postgres -p -c cat '*/scratch_file.sql',\
/bin/su postgres -p -c chmod 0700 '*/data',\
/bin/su postgres -p -c chmod 0700 '*/data/recovery.conf.delphix',\
/bin/su postgres -p -c chmod 0755 '*/data/scripts/walControl.sh',\
/bin/su postgres -p -c chmod 0666 '*/scratch_file.sql',\
/bin/su postgres -p -c cp '*' '*/data/postgresql.conf',\
/bin/su postgres -p -c cp '*/data/postgresql.conf' '*/data/postgresql.conf_backup',\
/bin/su postgres -p -c cp '*/dumpall_file.sql' '*/scratch_file.sql',\
/bin/su postgres -p -c echo '' > '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c echo '' > '*/data/recovery.conf',\
/bin/su postgres -p -c echo '' > '*/data/standby.signal',\
/bin/su postgres -p -c echo '' > '*/data/recovery.signal',\
/bin/su postgres -p -c echo '' > '*/.delphix/staging_push',\
/bin/su postgres -p -c find * -type f -name PostgreSQL_T\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\].zip,\
/bin/su postgres -p -c find * -type d -name PostgreSQL_T\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\],\
/bin/su postgres -p -c find * -type f -name base.tar,\
/bin/su postgres -p -c find */data -type f -name \*.tar,\
/bin/su postgres -p -c find * -type f -name \[0-9\]\*tar,\
/bin/su postgres -p -c grep -w '^log_directory' '*/data/postgresql.conf',\
/bin/su postgres -p -c grep -w '^max_connections' '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c grep -w '^max_connections' '*/data/postgresql_source.conf',\
/bin/su postgres -p -c grep -w '^max_wal_senders' '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c grep -w '^max_wal_senders' '*/data/postgresql_source.conf',\
/bin/su postgres -p -c grep -w '^port' '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c grep -w '^port' '*/data/postgresql.conf',\
/bin/su postgres -p -c grep -w '^wal_keep_segments' '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c grep -w '^wal_keep_segments' '*/data/postgresql_source.conf',\
/bin/su postgres -p -c grep -w '^wal_keep_size' '*/data/postgresql.auto.conf',\
/bin/su postgres -p -c grep -w '^wal_keep_size' '*/data/postgresql_source.conf',\
/bin/su postgres -p -c grep -w '^timezone' '*/data/postgresql.conf',\
/bin/su postgres -p -c ln -s '../tablespace/*' '*/data/pg_tblspc',\
/bin/su postgres -p -c ls -lrt '*' | tail -n+2,\
/bin/su postgres -p -c mkdir -p '*',\
/bin/su postgres -p -c mv '*/data/postgresql.auto.conf' '*/data/postgresql.auto.conf.delphix',\
/bin/su postgres -p -c mv '*/data/postgresql.auto.conf' '*/data/postgresql.auto.source.conf',\
/bin/su postgres -p -c mv '*/data/postgresql.conf' '*/data/postgresql_source.conf',\
/bin/su postgres -p -c mv '*/data/postgresql_tmp.conf' '*/data/postgresql.conf',\
/bin/su postgres -p -c mv '*/data/postmaster.opts' '*/data/postmaster.opts.delphix',\
/bin/su postgres -p -c mv '*/data/recovery.conf' '*/data/recovery.conf.delphix',\
/bin/su postgres -p -c mv '*/data/standby.signal' '*/data/standby.signal.delphix',\
/bin/su postgres -p -c mv '*/postgres_init/postgresql.auto.conf' '*/data',\
/bin/su postgres -p -c mv '*/postgres_init/postgresql.conf' '*/data',\
/bin/su postgres -p -c mv '*/postgres_init/pg_hba.conf' '*/data',\
/bin/su postgres -p -c mv '*/postgres_init/pg_ident.conf' '*/data',\
/bin/su postgres -p -c mv '*/scratch_file.sql' '*/dumpall_file.sql',\
/bin/su postgres -p -c printenv param_value >> */data/recovery.conf,\
/bin/su postgres -p -c rm -f '*/data/*.tar',\
/bin/su postgres -p -c rm -f '*/data/postmaster.pid',\
/bin/su postgres -p -c rm -f '*/data/tablespace_map',\
/bin/su postgres -p -c rm -r -f '*',\
/bin/su postgres -p -c tail -n 1 '*/data/scripts/WalBreakChainDetected',\
/bin/su postgres -p -c tail -n 1 '*/data/scripts/InvalidRecordFileFoundData',\
/bin/su postgres -p -c tail -n * '*/data/log/*',\
/bin/su postgres -p -c tail -n * '*/data/pg_log/*',\
/bin/su postgres -p -c tar -xf */base.tar -C */data,\
/bin/su postgres -p -c tar -xf */pg_wal.tar -C */data/pg_wal,\
/bin/su postgres -p -c tar -xf */*.tar -C */data/tablespace*,\
/bin/su postgres -p -c test -d '*',\
/bin/su postgres -p -c test -f '*',\
/bin/su postgres -p -c test -r '*' && test -w '*' && test -x '*',\
/bin/su postgres -p -c test -r '*' && test -x '*',\
/bin/su postgres -p -c test -r '*',\
/bin/su postgres -p -c test -w '*' && test -x '*',\
/bin/su postgres -p -c unzip '*/PostgreSQL_T[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].zip' -d '*/data',\
/bin/su postgres -p -c zipinfo* '*/PostgreSQL_T[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].zip'

The dlpx_db_exec script

The formatted dlpx_db_exec script is presented here for completeness.

CODE
#!/bin/sh
#
# This script allows customization of command execution with an              # alternate user account.
if [[ $1 != -u* ]]; then
    echo "Incorrect command line parameters, -u <optional user account> is required as the first parameter"
    exit 1
fi
user_id=`echo $1 | sed -e "s/^-u//"`

shift 1
if [[ $user_id != "delphix_os" ]]; then
    command=$(printf "%s" "$@")
    cd /tmp
    sudo -E su $user_id -p -c "$command"
else
    $@
fi
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.