Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Installation of pglogical Replication in PostgreSQL

pglogical is available as RPMs via yum for Fedora, CentOS, & RHEL, and as DEBs via apt for Debian and Ubuntu, or as source codehere. Please see below for instructions on installing from source. 

YUM Repository for pglogical

The instructions below are valid for Red Hat family of operating systems (RHEL, CentOS, Fedora). 

Pre-Requisites

These RPMs all require the PGDG PostgreSQL releases fromhttp://yum.postgresql.org/. You cannot use them with stock PostgreSQL releases included in Fedora and RHEL. If you don't have PostgreSQL already:
  • Install the appropriate PGDG repo rpm from http://yum.postgresql.org/repopackages.php
  • Install PostgreSQL
    • v9.4: yum install postgresql94-server postgresql94-contrib
    • v9.5: yum install postgresql95-server postgresql95-contrib
    • v9.6: yum install postgresql96-server postgresql96-contrib

Installing pglogical

Next step is to install the matching pglogical version. In order to do that, you should first install the repository RPM for your distro.
  • Fedora 24 and 25: yum install http://packages.2ndquadrant.com/pglogical/yum-repo-rpms/pglogical-fedora-1.0-3.noarch.rpm
  • RHEL/CentOS 6 and 7: yum install http://packages.2ndquadrant.com/pglogical/yum-repo-rpms/pglogical-rhel-1.0-3.noarch.rpm
Once the repository is installed, you can proceed to pglogical for your PostgreSQL version: 
  • PostgreSQL 9.4: yum install postgresql94-pglogical
  • PostgreSQL 9.5: yum install postgresql95-pglogical
  • PostgreSQL 9.6: yum install postgresql96-pglogical
Package Signing
You may be prompted to accept the repository GPG key for package signing:
        Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-2NDQ-PGLOGICAL
 Importing GPG key 0xEB74CAFE:
  Userid     : "pglogical repository key (2ndQuadrant) <packagers@2ndquadrant.com>"
  Fingerprint: 0005 a7af 6208 3d86 d273 d5cb bc66 be8f eb74 cafe
  Package    : pglogical-fedora-1.0-1.noarch (installed)
  From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-2NDQ-PGLOGICAL
 Is this ok [y/N]:
If so, accept the key (if it matches the above) by pressing 'y' then enter. (It's signed by the 2ndQuadrant master packaging key, if you want to verify that.)

APT Repository for pglogical

The instructions below are valid for Debian and all Linux flavors based on Debian (e.g. Ubuntu). 

Pre-Requisites

In order to use 2ndQuadrant's repository, first perform the following steps: 
  • Create file /etc/apt/sources.list.d/2ndquadrant.list. The distributions are called codename-2ndquadrant.
  • In the command below, replace "jessie" with the actual distribution you are using. (You may determine the codename of your distribution by running lsb_release -c.)
deb [arch=amd64] http://packages.2ndquadrant.com/pglogical/apt/ jessie-2ndquadrant main
  • Add the http://apt.postgresql.org/ repository. See the site for instructions. 
  • Import the 2ndQuadrant apt repository key, update the package lists, and start installing packages
wget --quiet -O - http://packages.2ndquadrant.com/pglogical/apt/AA7A6805.asc | sudo apt-key add -
  sudo apt-get update

Installing pglogical

Once pre-requisites are complete, installing pglogical is simply a matter of executing the following for your version of PostgreSQL:
  • PostgreSQL 9.4: sudo apt-get install postgresql-9.4-pglogical
  • PostgreSQL 9.5: sudo apt-get install postgresql-9.5-pglogical
  • PostgreSQL 9.6: sudo apt-get install postgresql-9.6-pglogical

Installing pglogical from Source Code

Source code installs are the same as for any other PostgreSQL extension built using PGXS.
Make sure the directory containing pg_config from the PostgreSQL release is listed in your PATH environment variable. You might have to install a -dev or -devel package for your PostgreSQL release from your package manager if you don't havepg_config.
Then run make USE_PGXS=1 to compile, and make USE_PGXS=1 install to install. You might need to use sudo for the install step.
e.g. for a typical Fedora or RHEL 7 install, assuming you're using the yum.postgresql.org packages for PostgreSQL:
sudo dnf install postgresql96-devel
PATH=/usr/pgsql-9.6/bin:$PATH make USE_PGXS=1 clean all
sudo PATH=/usr/pgsql-9.6/bin:$PATH make USE_PGXS=1 install

Important

Note that you must install pglogical on all servers that will act as publishers or subscribers. So if you're replicating from 9.4 to 9.5 you'd install postgresql94-pglogical on the 9.4 server and postgresql95-pglogical on the 9.5 server.
For more information, please read the pglogical README.md in /usr/share/doc/postgresql<version>-pglogical/README.md where <version> would be 94,95,96

Comments

Popular posts from this blog

Oracle DBMS SCHEDULER Examples

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

7 Steps to configure BDR replication in postgresql

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

How to Enable/Disable autovacuum on PostgreSQL