vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.69k stars 410 forks source link

postgresql cluster (patroni) with PostgresPro #38

Open ib2828 opened 4 years ago

ib2828 commented 4 years ago

postgrespro

Compatibility with Postgres Pro Standard

:heavy_exclamation_mark: To use any version of Postgres Pro, you must purchase a license. You can get the version of the DBMS you are interested in for free for testing, exploring the capabilities of the DBMS, and developing application software.

vitabaks commented 4 years ago

Example for: Installation on: СentOS PostgresPro version: 12.4.1

:heavy_exclamation_mark: To use any version of Postgres Pro in production, you must purchase a license.

  1. Add PostgresPro repository (v12.4.1) for CentOS 7/8 (in the /vars/RedHat.yml variable file)
yum_repository:
  - name: "postgrespro-std"
    description: "Postgres Pro Standard repo"
    baseurl: "http://repo.postgrespro.ru//pgpro-archive/pgpro-12.4.1/centos/{{ ansible_distribution_major_version }}/os/x86_64/rpms"
    gpgkey: "http://repo.postgrespro.ru/keys/GPG-KEY-POSTGRESPRO"
    gpgcheck: "yes"

and disable pgdg repo (optional)

install_postgresql_repo: false
  1. Add PostgresPro packages for automatic installation in the postgresql_packages variable (in the /vars/RedHat.yml variable file):
postgresql_packages:
  - postgrespro-std-{{ postgresql_version }}-server
  - postgrespro-std-{{ postgresql_version }}-client
  - postgrespro-std-{{ postgresql_version }}-contrib
  - postgrespro-std-{{ postgresql_version }}-devel
  1. Specify postgresql_bin_dir and postgresql_unix_socket_dir as follows:

    postgresql_data_dir: "/var/lib/pgpro/std-{{ postgresql_version }}/data"  # or other path to PGDATA
    postgresql_bin_dir: "/opt/pgpro/std-{{ postgresql_version }}/bin"
    postgresql_unix_socket_dir: "/tmp"
  2. Add/edit the necessary PostgreSQL parameters (in the /vars/main.yml variable file):

postgresql_version: "12"

postgresql_users:  # this is optional
postgresql_databases:  # this is optional
postgresql_extensions:  # this is optional

postgresql_parameters:
  - {option: "max_connections", value: "100"}
  - {option: "superuser_reserved_connections", value: "5"}
  - {option: "max_locks_per_transaction", value: "512"}
  ...

Specify all other variables according to your personal requirements for the database cluster.

Deployment: quick start

vitabaks commented 4 years ago

Tested with Postgres Pro Standard 12.2.1 on Centos 7 and 8.

vitabaks commented 4 years ago

Tested with Postgres Pro Standard 12.2.1 on Debian, Ubuntu.

PostgresPro repository for Debian / Ubuntu (ex. v12.4.1) (in the /vars/Debian.yml variable file)

apt_repository_keys:
  - key: "http://repo.postgrespro.ru/keys/GPG-KEY-POSTGRESPRO"
apt_repository:
  - repo: "deb http://repo.postgrespro.ru//pgpro-archive/pgpro-12.4.1/{{ ansible_distribution |lower }}/ {{ ansible_distribution_release }} main"

dev package is named differently (different from RHEL)

postgresql_packages:
  - postgrespro-std-{{ postgresql_version }}-server
  - postgrespro-std-{{ postgresql_version }}-client
  - postgrespro-std-{{ postgresql_version }}-contrib
  - postgrespro-std-{{ postgresql_version }}-dev