### Fast Path Installation and Setup Source: https://github.com/percona/postgresql-docs/blob/17/docs/quick-start.md Installs Percona Distribution for PostgreSQL, initializes the database, and starts the psql terminal. ```bash wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb sudo percona-release setup ppg-{{pgversion}} sudo apt install percona-postgresql-{{pgversion}} sudo -i -u postgres psql ``` -------------------------------- ### Enable and Start Patroni Service Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-patroni.md Use this command to enable the Patroni service to start on boot and start it immediately. This is the first step on each node. ```bash $ sudo systemctl enable --now percona-patroni ``` -------------------------------- ### Enable and Start etcd Service Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-etcd-config.md Enables the etcd service to start on boot and starts it immediately. Also shows how to check its status. ```bash $ sudo systemctl enable --now etcd $ sudo systemctl status etcd ``` -------------------------------- ### Enable and Start pgBackRest Service Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/pgbackrest.md Enables the pgBackRest service to start automatically on boot and starts the service immediately. The '--now' flag combines enabling and starting. ```bash $ sudo systemctl enable --now pgbackrest.service ``` -------------------------------- ### Start PostgreSQL Service on RHEL Source: https://github.com/percona/postgresql-docs/blob/17/docs/migration.md Start the PostgreSQL service after installation or migration on RHEL and derivatives, replacing {{pgversion}} with your PostgreSQL version. ```bash $ sudo systemctl start postgresql-{{pgversion}} ``` -------------------------------- ### Start PostgreSQL {{pgversion}} Service Source: https://github.com/percona/postgresql-docs/blob/17/docs/major-upgrade.md Starts the newly upgraded PostgreSQL {{pgversion}} service. ```bash $ systemctl start postgresql-{{pgversion}} ``` -------------------------------- ### Install Dependencies Source: https://github.com/percona/postgresql-docs/blob/17/CONTRIBUTING.md Installs all required dependencies for building the documentation from the requirements.txt file. ```sh pip install -r requirements.txt ``` -------------------------------- ### Install HAProxy Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs HAProxy, a high-performance TCP/HTTP load balancer. ```bash $ sudo yum install percona-haproxy ``` -------------------------------- ### Start pgpool with Configuration File Source: https://github.com/percona/postgresql-docs/blob/17/docs/enable-extensions.md Specify the path to the pgpool.conf file when starting the pgpool service. ```bash $ pgpool -f /pgpool.conf ``` -------------------------------- ### Enable Repository and Install Package Source: https://github.com/percona/postgresql-docs/blob/17/docs/quick-start.md Enables the Percona repository and installs the PostgreSQL distribution. ```bash sudo percona-release setup ppg-{{pgversion}} sudo apt install percona-postgresql-{{pgversion}} ``` -------------------------------- ### Setup Percona repository for PostgreSQL Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Enable the Percona repository for the specified PostgreSQL version using the percona-release tool. This allows installation of Percona Distribution for PostgreSQL packages. ```bash $ sudo percona-release setup ppg-{{pgversion}} ``` -------------------------------- ### Install EPEL repository on Oracle Linux 8 Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs the EPEL repository using the dnf install command. ```bash $ sudo dnf install -y epel-release ``` -------------------------------- ### Enable CodeReady Builder and Install Perl IPC-Run on Rocky Linux 8 Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs dnf-plugins-core, enables the PowerTools repository, and installs perl-IPC-Run on Rocky Linux 8. ```bash $ sudo dnf install dnf-plugins-core $ sudo dnf config-manager --set-enabled powertools $ sudo dnf install perl-IPC-Run -y ``` -------------------------------- ### Install libreadline-dev on Debian/Ubuntu Source: https://github.com/percona/postgresql-docs/blob/17/docs/tarball.md Ensures the libreadline library is installed, which is required for tarball installations. ```bash $ sudo apt install -y libreadline-dev ``` -------------------------------- ### PostGIS Full Version Output Example Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/postgis-deploy.md Example output showing the full version details of the PostGIS extension and its dependencies. ```sql postgis_full_version ----------------------------------------------------------------------------------------------------------------------------------------------------------------- POSTGIS="3.3.3" [EXTENSION] PGSQL="140" GEOS="3.10.2-CAPI-1.16.0" PROJ="8.2.1" LIBXML="2.9.13" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" ``` -------------------------------- ### Install pgBackRest on RHEL/derivatives Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/dr-pgbackrest-setup.md Installs the pgBackRest utility on RHEL and its derivatives. ```bash $ sudo yum install percona-pgbackrest ``` -------------------------------- ### Example CREATE TABLE with Encryption Source: https://github.com/percona/postgresql-docs/blob/17/docs/docker.md Provides a concrete example of creating a table named 'test_users' with encryption enabled using `tde_heap`. ```sql CREATE TABLE test_users ( user_id INT, username VARCHAR(50), email VARCHAR(100), signup_date DATE ) USING tde_heap; ``` -------------------------------- ### Install pgBouncer Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs pgBouncer, a lightweight connection pooler for PostgreSQL. ```bash $ sudo yum install percona-pgbouncer ``` -------------------------------- ### Start PostgreSQL server Source: https://github.com/percona/postgresql-docs/blob/17/docs/tarball.md Starts the PostgreSQL server using the 'pg_ctl' command. Replace {{pgversion}} with the correct PostgreSQL version. ```bash $ /opt/pgdistro/percona-postgresql{{pgversion}}/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start ``` -------------------------------- ### Install percona-release tool Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs the percona-release repository management tool to subscribe to Percona repositories. ```bash $ sudo yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm ``` -------------------------------- ### Install pgBackRest on Debian/Ubuntu Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/dr-pgbackrest-setup.md Installs the pgBackRest utility on Debian and Ubuntu systems. ```bash $ sudo apt-get install percona-pgbackrest ``` -------------------------------- ### Install pgpool2 Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Install pgpool2, a connection pooling and load balancing solution for PostgreSQL, from the Percona repositories. Run as root or with sudo. ```bash $ sudo apt install percona-pgpool2 ``` -------------------------------- ### Install Patroni (RHEL) Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-patroni.md Installs the Patroni package on RHEL and derivatives. ```bash $ sudo yum install percona-patroni ``` -------------------------------- ### Start PostgreSQL Service on Debian/Ubuntu Source: https://github.com/percona/postgresql-docs/blob/17/docs/minor-upgrade.md Start the PostgreSQL service using systemctl on Debian or Ubuntu systems after the upgrade is complete. ```bash $ sudo systemctl start postgresql.service ``` -------------------------------- ### Install pgaudit Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs the pgaudit extension for Percona Distribution for PostgreSQL. ```bash $ sudo yum install percona-pgaudit{{pgversion}} ``` -------------------------------- ### Install wal2json Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs the wal2json logical decoding adapter for PostgreSQL. ```bash $ sudo yum install percona-wal2json{{pgversion}} ``` -------------------------------- ### Install pg_gather Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs pg_gather, a tool for collecting PostgreSQL performance metrics. ```bash $ sudo yum install percona-pg_gather ``` -------------------------------- ### Install curl Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs the curl package, which is used for Telemetry. ```bash $ sudo yum -y install curl ``` -------------------------------- ### Install pgBackRest Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Install pgBackRest, a popular backup and restore tool for PostgreSQL, as part of the Percona Distribution. Run as root or with sudo. ```bash $ sudo apt install percona-pgbackrest ``` -------------------------------- ### Install pgBackRest on Debian/Ubuntu Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/pgbackrest.md Installs the percona-pgbackrest package on Debian or Ubuntu systems using apt. ```bash $ sudo apt install percona-pgbackrest ``` -------------------------------- ### Install Patroni (Debian/Ubuntu) Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-patroni.md Installs the Patroni package on Debian or Ubuntu systems. ```bash $ sudo apt install percona-patroni ``` -------------------------------- ### Example Output for ALTER SYSTEM Source: https://github.com/percona/postgresql-docs/blob/17/docs/telemetry.md This is an example of the output you might see after executing the ALTER SYSTEM SET and SELECT pg_reload_conf() commands. ```sql ALTER SYSTEM pg_reload_conf ---------------- t (1 row) ``` -------------------------------- ### Install curl Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Install the curl utility, which is used for Percona's product telemetry. Run this command as root or with sudo. ```bash $ sudo apt install curl ``` -------------------------------- ### Start PostgreSQL Service Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/dr-pgbackrest-setup.md Command to start the PostgreSQL service after a restore operation. ```bash $ sudo systemctl start postgresql ``` -------------------------------- ### Install HAProxy Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Install HAProxy, a high-performance TCP/HTTP load balancer and proxy, from the Percona repositories. This command requires root or sudo privileges. ```bash $ sudo apt install percona-haproxy ``` -------------------------------- ### Install etcd on RHEL/Derivatives Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-etcd-config.md Installs the etcd server and Python client library on RHEL or compatible systems. ```bash $ sudo yum install etcd python3-python-etcd ``` -------------------------------- ### Install HAProxy Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-haproxy.md Installs the Percona HAProxy package on Debian-based systems. This is the first step in setting up HAProxy nodes. ```bash $ sudo apt install percona-haproxy ``` -------------------------------- ### Install pgBadger Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs pgBadger, a script to analyze PostgreSQL log files. ```bash $ sudo yum install percona-pgbadger ``` -------------------------------- ### Install etcd on Debian/Ubuntu Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-etcd-config.md Installs the etcd server and client packages on Debian or Ubuntu systems. ```bash $ sudo apt install etcd etcd-server etcd-client ``` -------------------------------- ### Install Percona PostgreSQL server package Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Install the main Percona Server for PostgreSQL package for the specified version. This command should be run as root or with sudo. ```bash $ sudo apt install percona-postgresql-{{pgversion}} ``` -------------------------------- ### Install pgBadger Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Install pgBadger, a powerful PostgreSQL log analysis tool, from the Percona repositories. Run this command as root or with sudo. ```bash $ sudo apt install percona-pgbadger ``` -------------------------------- ### Start PostgreSQL Service on RHEL/Derivatives Source: https://github.com/percona/postgresql-docs/blob/17/docs/minor-upgrade.md Start the PostgreSQL service using systemctl on Red Hat Enterprise Linux or its derivatives after the upgrade is complete. ```bash $ sudo systemctl start postgresql-17 ``` -------------------------------- ### Install Python and Auxiliary Packages (Debian/Ubuntu) Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-patroni.md Installs necessary Python and auxiliary packages for Patroni on Debian/Ubuntu. ```bash $ sudo apt install python3-pip python3-dev binutils ``` -------------------------------- ### Install pgBouncer Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Install pgBouncer, a connection pooler for PostgreSQL, from the Percona repositories. This command requires root or sudo privileges. ```bash $ sudo apt install percona-pgbouncer ``` -------------------------------- ### Install Patroni Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Install Patroni, a template for the template for creating HA PostgreSQL solutions, from the Percona repositories. Requires root or sudo privileges. ```bash $ sudo apt install percona-patroni ``` -------------------------------- ### Install Percona Distribution for PostgreSQL 17 Source: https://github.com/percona/postgresql-docs/blob/17/docs/major-upgrade.md Install the Percona Distribution for PostgreSQL 17 package using apt. ```bash $ sudo apt install percona-postgresql-17 ``` -------------------------------- ### Install pgvector package suite Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs the pgvector package suite, including the main package, debug symbols, and JIT compiler. ```bash $ sudo yum install percona-pgvector_{{pgversion}} percona-pgvector_{{pgversion}}-debuginfo percona-pgvector_{{pgversion}}-debugsource percona-pgvector_{{pgversion}}-llvmjit ``` -------------------------------- ### Install Percona Repository Package and Dependencies Source: https://github.com/percona/postgresql-docs/blob/17/snippets/percona-release-apt.md Install the downloaded Percona repository package along with necessary dependencies like gnupg2 and lsb-release. ```bash $ sudo apt install gnupg2 lsb-release ./percona-release_latest.generic_all.deb ``` -------------------------------- ### Configure pgBackRest Directories and Permissions Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/dr-pgbackrest-setup.md Sets up the pgBackRest configuration directories and the main configuration file with appropriate permissions and ownership. ```bash $ sudo mkdir -p /etc/pgbackrest $ sudo mkdir -p /etc/pgbackrest/conf.d $ sudo touch /etc/pgbackrest/pgbackrest.conf $ sudo chmod 640 /etc/pgbackrest/pgbackrest.conf $ sudo chown postgres:postgres /etc/pgbackrest/pgbackrest.conf $ sudo mkdir -p /home/pgbackrest $ sudo chmod postgres:postgres /home/pgbackrest ``` -------------------------------- ### Install readline-devel on RHEL/derivatives Source: https://github.com/percona/postgresql-docs/blob/17/docs/tarball.md Ensures the readline library is installed, which is required for tarball installations. ```bash $ sudo yum install -y readline-devel ``` -------------------------------- ### Install Python, Development, and Auxiliary Packages (RHEL) Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-patroni.md Installs necessary Python, development, and auxiliary packages for Patroni and etcd on RHEL and derivatives. ```bash $ sudo yum install python3-pip python3-devel binutils ``` -------------------------------- ### Enable CodeReady Builder and Install Perl IPC-Run on RHEL 9 Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Enables the CodeReady Builder repository and installs the perl-IPC-Run package on RHEL 9. ```bash $ sudo dnf config-manager --set-enabled codeready-builder-for-rhel-9-rhui-rpms $ sudo dnf install perl-IPC-Run -y ``` -------------------------------- ### Enable CodeReady Builder and Install Perl IPC-Run on RHEL 10 Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Enables the CodeReady Builder repository and installs the perl-IPC-Run package on RHEL 10. ```bash $ sudo dnf config-manager --set-enabled codeready-builder-for-rhel-10-rhui-rpms $ sudo dnf install perl-IPC-Run -y ``` -------------------------------- ### Sample SQL Version Output Source: https://github.com/percona/postgresql-docs/blob/17/docs/release-notes/release-notes-v17.0.md Example output from the `SELECT version();` query, showing the Percona Server version. ```sql version ---------------------------------------------------------------------------------------------------------------------------------------------- PostgreSQL 17.0 - Percona Server for PostgreSQL 17.0.1 ``` -------------------------------- ### Install acl package on RHEL/derivatives Source: https://github.com/percona/postgresql-docs/blob/17/docs/tarball.md Installs the acl package, necessary for correct permission handling in tarball installations on RHEL 10 and derivatives. ```bash $ sudo dnf install -y acl ``` -------------------------------- ### Disable Telemetry During Installation (Debian) Source: https://github.com/percona/postgresql-docs/blob/17/docs/telemetry.md To prevent telemetry data collection during installation on Debian-derived systems, set the PERCONA_TELEMETRY_DISABLE=1 environment variable before running the installation command. ```bash $ sudo PERCONA_TELEMETRY_DISABLE=1 apt install percona-ppg-server-{{pgversion}} ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/percona/postgresql-docs/blob/17/CONTRIBUTING.md Builds the documentation and serves it locally, automatically rebuilding and reloading the browser as changes are made. ```sh mkdocs serve ``` -------------------------------- ### Create Table and Insert Data Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-test.md Use these SQL commands to create a 'customer' table and insert sample data. This is a prerequisite for testing replication. ```sql CREATE TABLE customer(name text,age integer); INSERT INTO CUSTOMER VALUES('john',30); INSERT INTO CUSTOMER VALUES('dawson',35); ``` -------------------------------- ### Create Database and Table Source: https://github.com/percona/postgresql-docs/blob/17/docs/quick-start.md Creates a new database and a 'customers' table within it. ```sql CREATE DATABASE test; \c test CREATE TABLE customers (first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(100)); ``` -------------------------------- ### Start Percona Distribution for PostgreSQL container using an environment file Source: https://github.com/percona/postgresql-docs/blob/17/docs/docker.md Start a Percona Distribution for PostgreSQL container using an environment file to manage sensitive information like the superuser password. The container runs in detached mode. ```bash docker run --name container-name --env-file ./.my-pg.env -d percona/percona-distribution-postgresql:{{dockertag}} ``` -------------------------------- ### Install EPEL and Perl IPC-Run on RHEL 9 if Packages Not Available Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs the EPEL repository and perl-IPC-Run package on RHEL 9 if the required packages are not found in the default RHEL repositories. ```bash $ sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm $ sudo dnf install perl-IPC-Run -y ``` -------------------------------- ### Install EPEL and Perl IPC-Run on RHEL 10 if Packages Not Available Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs the EPEL repository and perl-IPC-Run package on RHEL 10 if the required packages are not found in the default RHEL repositories. ```bash $ sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm $ sudo dnf install perl-IPC-Run -y ``` -------------------------------- ### Enable CodeReady Builder and Install Perl IPC-Run on Oracle Linux 8 Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Enables the CodeReady Builder repository and installs the perl-IPC-Run package on Oracle Linux 8. ```bash $ sudo dnf config-manager --set-enabled ol8_codeready_builder $ sudo dnf install perl-IPC-Run -y ``` -------------------------------- ### Database and Table Creation Source: https://github.com/percona/postgresql-docs/blob/17/docs/quick-start.md Creates a database named 'test', a 'customers' table, inserts a row, and queries it. ```sql CREATE DATABASE test; \c test CREATE TABLE customers (first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(100)); INSERT INTO customers VALUES ('John','Doe','john.doe@example.com'); SELECT * FROM customers; \q ``` -------------------------------- ### Sample psql Version Output Source: https://github.com/percona/postgresql-docs/blob/17/docs/release-notes/release-notes-v17.0.md Example output from the `psql --version` command, indicating the Percona Server version. ```bash psql (PostgreSQL) 17.0 - Percona Server for PostgreSQL 17.0.1 ``` -------------------------------- ### Create Basic pgBackRest Configuration for Debian/Ubuntu Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/pgbackrest.md Generate a basic pgBackRest configuration file using environment variables. This example configures global settings, retention policies, TLS options, and cluster/node details for a Debian/Ubuntu system. ```bash echo " [global] # Server repo details repo1-path=/var/lib/pgbackrest ### Retention ### # - repo1-retention-archive-type # - If set to full pgBackRest will keep archive logs for the number of full backups defined by repo-retention-archive repo1-retention-archive-type=full # repo1-retention-archive # - Number of backups worth of continuous WAL to retain # - NOTE: WAL segments required to make a backup consistent are always retained until the backup is expired regardless of how this option is configured # - If this value is not set and repo-retention-full-type is count (default), then the archive to expire will default to the repo-retention-full # repo1-retention-archive=2 # repo1-retention-full # - Full backup retention count/time. # - When a full backup expires, all differential and incremental backups associated with the full backup will also expire. # - When the option is not defined a warning will be issued. # - If indefinite retention is desired then set the option to the max value. repo1-retention-full=4 # Server general options process-max=4 # This depends on the number of CPU resources your server has. The recommended value should equal or be less than the number of CPUs. While more processes can speed up backups, they will also consume additional system resources. log-level-console=info #log-level-file=debug log-level-file=info start-fast=y delta=y backup-standby=y ########## Server TLS options ########## tls-server-address=* tls-server-cert-file=${CA_PATH}/${SRV_NAME}.crt tls-server-key-file=${CA_PATH}/${SRV_NAME}.key tls-server-ca-file=${CA_PATH}/ca.crt ### Auth entry ### tls-server-auth=${NODE1_NAME}=cluster_1 tls-server-auth=${NODE2_NAME}=cluster_1 tls-server-auth=${NODE3_NAME}=cluster_1 ### Clusters and nodes ### [cluster_1] pg1-host=${NODE1_NAME} pg1-host-port=8432 pg1-port=5432 pg1-path=/var/lib/postgresql/{{pgversion}}/main pg1-host-type=tls pg1-host-cert-file=${CA_PATH}/${NODE1_NAME}.crt pg1-host-key-file=${CA_PATH}/${NODE1_NAME}.key pg1-host-ca-file=${CA_PATH}/ca.crt pg1-socket-path=/var/run/postgresql pg2-host=${NODE2_NAME} pg2-host-port=8432 pg2-port=5432 pg2-path=/var/lib/postgresql/{{pgversion}}/main pg2-host-type=tls pg2-host-cert-file=${CA_PATH}/${NODE2_NAME}.crt pg2-host-key-file=${CA_PATH}/${NODE2_NAME}.key pg2-host-ca-file=${CA_PATH}/ca.crt pg2-socket-path=/var/run/postgresql pg3-host=${NODE3_NAME} pg3-host-port=8432 pg3-port=5432 pg3-path=/var/lib/postgresql/{{pgversion}}/main pg3-host-type=tls pg3-host-cert-file=${CA_PATH}/${NODE3_NAME}.crt pg3-host-key-file=${CA_PATH}/${NODE3_NAME}.key pg3-host-ca-file=${CA_PATH}/ca.crt pg3-socket-path=/var/run/postgresql ``` -------------------------------- ### Enable CRB and Install Perl IPC-Run on Rocky Linux 9 Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs dnf-plugins-core, enables the CRB (CodeReady Builder) repository, and installs perl-IPC-Run on Rocky Linux 9. ```bash $ sudo dnf install dnf-plugins-core $ sudo dnf config-manager --set-enabled crb $ sudo dnf install perl-IPC-Run -y ``` -------------------------------- ### Disable Telemetry During Installation (Red Hat) Source: https://github.com/percona/postgresql-docs/blob/17/docs/telemetry.md To prevent telemetry data collection during installation on Red Hat-derived systems, set the PERCONA_TELEMETRY_DISABLE=1 environment variable before running the installation command. ```bash $ sudo PERCONA_TELEMETRY_DISABLE=1 yum install percona-ppg-server{{pgversion}} ``` -------------------------------- ### Build Static Documentation Source: https://github.com/percona/postgresql-docs/blob/17/CONTRIBUTING.md Builds the static HTML site for the documentation. The output is placed in the 'site' directory. ```sh mkdocs build ``` -------------------------------- ### Insert Sample Data into Customers Table Source: https://github.com/percona/postgresql-docs/blob/17/docs/crud.md Populate the 'customers' table with multiple rows of sample data using the INSERT INTO command. Each row includes first name, last name, and email. ```sql INSERT INTO customers (first_name, last_name, email) VALUES ('John', 'Doe', 'john.doe@example.com'), -- Insert a new row ('Jane', 'Doe', 'jane.doe@example.com'), -- Insert another new row ('Alice', 'Smith', 'alice.smith@example.com'); ``` -------------------------------- ### Verify pg_stat_monitor Setup Source: https://github.com/percona/postgresql-docs/blob/17/docs/docker.md Use this psql command to check if the pg_stat_monitor view has been successfully created. This confirms that the extension is active and ready for use. ```sql \d pg_stat_monitor; ``` -------------------------------- ### Connect to PostgreSQL Container using psql Source: https://github.com/percona/postgresql-docs/blob/17/docs/docker.md Starts a new container to run the psql client against an existing database container. Ensure you replace placeholders with your actual container names and network address. ```bash docker run -it --network container:db-container-name --name container-name percona/percona-distribution-postgresql:{{dockertag}} psql -h address -U postgres ``` -------------------------------- ### Sample psql version output Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Example output when checking the Percona Distribution for PostgreSQL version using 'psql --version'. ```text psql (PostgreSQL) {{pspgversion}} (Percona Server for PostgreSQL) {{pspgversion}} ``` -------------------------------- ### Install PostGIS Packages on RHEL Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/postgis-deploy.md Installs the PostGIS extension packages and client on RHEL and derivatives. ```bash $ sudo yum install percona-postgis33_{{pgversion}} percona-postgis33_{{pgversion}}-client ``` -------------------------------- ### Install PostGIS Packages on Debian/Ubuntu Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/postgis-deploy.md Installs the PostGIS extension packages on Debian and Ubuntu systems. ```bash $ sudo apt install percona-postgis ``` -------------------------------- ### Create pgBackRest Configuration File Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/pgbackrest.md This snippet shows how to create the pgBackRest configuration file with global settings, retention policies, TLS options, and cluster/node definitions. Ensure to adjust paths and names according to your environment. ```bash [global] # Server repo details repo1-path=/var/lib/pgbackrest ### Retention ### # - repo1-retention-archive-type # - If set to full pgBackRest will keep archive logs for the number of full backups defined by repo-retention-archive repo1-retention-archive-type=full # repo1-retention-archive # - Number of backups worth of continuous WAL to retain # - NOTE: WAL segments required to make a backup consistent are always retained until the backup is expired regardless of how this option is configured # - If this value is not set and repo-retention-full-type is count (default), then the archive to expire will default to the repo-retention-full # repo1-retention-archive=2 # repo1-retention-full # - Full backup retention count/time. # - When a full backup expires, all differential and incremental backups associated with the full backup will also expire. # - When the option is not defined a warning will be issued. # - If indefinite retention is desired then set the option to the max value. repo1-retention-full=4 # Server general options process-max=4 # This depends on the number of CPU resources your server has. The recommended value should equal or be less than the number of CPUs. While more processes can speed up backups, they will also consume additional system resources. log-level-console=info #log-level-file=debug log-level-file=info start-fast=y delta=y backup-standby=y ########## Server TLS options ########## tls-server-address=* tls-server-cert-file=${CA_PATH}/${SRV_NAME}.crt tls-server-key-file=${CA_PATH}/${SRV_NAME}.key tls-server-ca-file=${CA_PATH}/ca.crt ### Auth entry ### tls-server-auth=${NODE1_NAME}=cluster_1 tls-server-auth=${NODE2_NAME}=cluster_1 tls-server-auth=${NODE3_NAME}=cluster_1 ### Clusters and nodes ### [cluster_1] pg1-host=${NODE1_NAME} pg1-host-port=8432 pg1-port=5432 pg1-path=/var/lib/postgresql/{{pgversion}}/main pg1-host-type=tls pg1-host-cert-file=${CA_PATH}/${NODE1_NAME}.crt pg1-host-key-file=${CA_PATH}/${NODE1_NAME}.key pg1-host-ca-file=${CA_PATH}/ca.crt pg1-socket-path=/var/run/postgresql pg2-host=${NODE2_NAME} pg2-host-port=8432 pg2-port=5432 pg2-path=/var/lib/postgresql/{{pgversion}}/main pg2-host-type=tls pg2-host-cert-file=${CA_PATH}/${NODE2_NAME}.crt pg2-host-key-file=${CA_PATH}/${NODE2_NAME}.key pg2-host-ca-file=${CA_PATH}/ca.crt pg2-socket-path=/var/run/postgresql pg3-host=${NODE3_NAME} pg3-host-port=8432 pg3-port=5432 pg3-path=/var/lib/postgresql/{{pgversion}}/main pg3-host-type=tls pg3-host-cert-file=${CA_PATH}/${NODE3_NAME}.crt pg3-host-key-file=${CA_PATH}/${NODE3_NAME}.key pg3-host-ca-file=${CA_PATH}/ca.crt pg3-socket-path=/var/run/postgresql " | sudo tee /etc/pgbackrest.conf ``` -------------------------------- ### Install PostgreSQL contrib extensions Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs the PostgreSQL contrib extensions package for Percona Distribution for PostgreSQL. ```bash $ sudo yum install percona-postgresql{{pgversion}}-contrib ``` -------------------------------- ### Install percona-release on RHEL/derivatives Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-init-setup.md Installs the percona-release package on RHEL and its derivatives, which is required for managing Percona repositories. ```bash --8<-- "percona-release-yum.md" ``` -------------------------------- ### Start etcd Node 1 Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-etcd-config.md Initiates the first etcd node with specific data directory, name, URLs, and cluster configuration. Run in the background. ```bash THIS_NAME=${NAME_1} THIS_IP=${HOST_1} etcd --data-dir=data.etcd --name ${THIS_NAME} \ --initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://${THIS_IP}:2380 \ --advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://${THIS_IP}:2379 \ --initial-cluster ${CLUSTER} \ --initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN} & ``` -------------------------------- ### Start Keepalived Service Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-haproxy.md Starts the Keepalived system service. This command should be run on all HAProxy nodes after configuring Keepalived. ```bash $ sudo systemctl start keepalived ``` -------------------------------- ### Install Percona Distribution for PostgreSQL on Debian/Ubuntu Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/dr-pgbackrest-setup.md Installs Percona Distribution for PostgreSQL packages on Debian and Ubuntu systems. ```bash $ sudo apt install percona-postgresql-{{pgversion}} -y ``` -------------------------------- ### Start etcd Node 2 Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-etcd-config.md Initiates the second etcd node with specific data directory, name, URLs, and cluster configuration. Run in the background. ```bash THIS_NAME=${NAME_2} THIS_IP=${HOST_2} etcd --data-dir=data.etcd --name ${THIS_NAME} \ --initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://${THIS_IP}:2380 \ --advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://${THIS_IP}:2379 \ --initial-cluster ${CLUSTER} \ --initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN} & ``` -------------------------------- ### Stop PostgreSQL Server from Tarball Installation Source: https://github.com/percona/postgresql-docs/blob/17/docs/uninstalling.md Stop the PostgreSQL server when installed from binary tarballs using pg_ctl. ```bash $ /path/to/tarballs/percona-postgresql{{pgversion}}/bin/pg_ctl -D path/to/datadir -l logfile stop ``` -------------------------------- ### Install percona-release on Debian/Ubuntu Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-init-setup.md Installs the percona-release package on Debian and Ubuntu systems, which is required for managing Percona repositories. ```bash --8<-- "percona-release-apt.md" ``` -------------------------------- ### Copy pgpool2 Sample Configuration Source: https://github.com/percona/postgresql-docs/blob/17/docs/enable-extensions.md Copy the sample pgpool.conf file to the configuration file path when installing pgpool from tarballs. ```bash $ cp /percona-pgpool-II/etc/pgpool2/pgpool.conf.sample /pgpool.conf ``` -------------------------------- ### Configure Oracle-Linux repository for RHEL UBI 9 Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Creates a repository configuration file for Oracle Linux 9 to install required dependencies. ```init [ol9_baseos_latest] name=Oracle Linux 9 BaseOS Latest ($basearch) baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/baseos/latest/$basearch/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle gpgcheck=1 enabled=1 [ol9_appstream] name=Oracle Linux 9 Application Stream ($basearch) baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/appstream/$basearch/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle gpgcheck=1 enabled=1 [ol9_codeready_builder] name=Oracle Linux 9 CodeReady Builder ($basearch) - Unsupported ``` -------------------------------- ### Start etcd Node 3 Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-etcd-config.md Initiates the third etcd node with specific data directory, name, URLs, and cluster configuration. Run in the background. ```bash THIS_NAME=${NAME_3} THIS_IP=${HOST_3} etcd --data-dir=data.etcd --name ${THIS_NAME} \ --initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://${THIS_IP}:2380 \ --advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://${THIS_IP}:2379 \ --initial-cluster ${CLUSTER} \ --initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN} & ``` -------------------------------- ### Install Keepalived on RHEL/Derivatives Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-haproxy.md Installs the Keepalived package on RHEL-based systems. This is the first step in setting up HAProxy high availability. ```bash $ sudo yum install keepalived ``` -------------------------------- ### Install Keepalived on Debian/Ubuntu Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-haproxy.md Installs the Keepalived package on Debian-based systems. This is the first step in setting up HAProxy high availability. ```bash $ sudo apt install keepalived ``` -------------------------------- ### Create Certificate Directory Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/pgbackrest.md Creates a directory to store SSL certificates for pgBackRest. This command should be run as root or with sudo privileges. ```bash $ sudo mkdir -p /etc/ssl/certs/pg_ha ``` -------------------------------- ### Install libsfcgal1 Dependency on Ubuntu 18.04 Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/postgis-deploy.md Manually installs the libsfcgal1 dependency required for the postgis_sfcgal-3 extension on Ubuntu 18.04. ```bash $ sudo apt-get install libsfcgal1 ``` -------------------------------- ### Initialize PostgreSQL database Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Initializes the default database storage for Percona Distribution for PostgreSQL. ```bash $ /usr/pgsql-{{pgversion}}/bin/postgresql-{{pgversion}}-setup initdb ``` -------------------------------- ### Install pgvector Source: https://github.com/percona/postgresql-docs/blob/17/docs/apt.md Install the pgvector extension for Percona Distribution for PostgreSQL. This extension enables the storage and querying of vector embeddings. ```bash $ sudo apt install percona-postgresql-{{pgversion}}-pgvector ``` -------------------------------- ### Create Patroni Configuration Directory Source: https://github.com/percona/postgresql-docs/blob/17/docs/solutions/ha-patroni.md Creates the directory for Patroni configuration files and sets ownership to the 'postgres' user. ```bash $ sudo mkdir -p /etc/patroni/ $ sudo chown -R postgres:postgres /etc/patroni/ ``` -------------------------------- ### Install DNF plugin utilities on RHEL 8 Source: https://github.com/percona/postgresql-docs/blob/17/docs/yum.md Installs the DNF plugin core utilities required for managing repositories and packages. ```bash $ sudo dnf install dnf-plugins-core ``` -------------------------------- ### Install Percona Release Package with YUM Source: https://github.com/percona/postgresql-docs/blob/17/snippets/percona-release-yum.md Run this command as the root user or with sudo privileges to install the Percona release package. ```bash $ sudo yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm ``` -------------------------------- ### Install Percona Distribution for PostgreSQL Source: https://github.com/percona/postgresql-docs/blob/17/docs/major-upgrade.md Installs the Percona Distribution for PostgreSQL server package. Replace {{pgversion}} with the target PostgreSQL version. ```bash $ sudo yum install percona-postgresql{{pgversion}}-server ``` -------------------------------- ### Sample psql Session Output Source: https://github.com/percona/postgresql-docs/blob/17/docs/docker.md Illustrates the typical output when connecting to the PostgreSQL database via the psql client. ```text psql ({{pgsubversion}} - Percona Server for PostgreSQL {{dockertag}}) Type "help" for help. postgres=# ```