Giter VIP home page Giter VIP logo

pglogical_cluster's Introduction

pglogical ansible playbook

Playbook set up postgresql and pglogical replication of 'city' table from 'app_db', it also set access permissions for nodes and application server in pg_hba.conf.

Tested on ubuntu 14.04, with master and slave postgresql 9.5.
Have no success with 9.4 master and 9.5 slave, because of this error:

LOG:  starting apply for subscription subscription1
postgres@app_db ERROR:  could not open extension control file "/usr/share/postgresql/9.5/extension/pglogical_origin.control": No such file or directory
postgres@app_db STATEMENT:  CREATE EXTENSION IF NOT EXISTS pglogical_origin WITH SCHEMA pglogical_origin;
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 2; 3079 16427 EXTENSION pglogical_origin
pg_restore: [archiver (db)] could not execute query: ERROR:  could not open extension control file "/usr/share/postgresql/9.5/extension/pglogical_origin.control": No such file or directory
Command was: CREATE EXTENSION IF NOT EXISTS pglogical_origin WITH SCHEMA pglogical_origin;

NOTE: pglogical extension cannot be created on 9.4 master without pglogical_origin extension, and after i try to start subscription from 9.5 slave it throws error that pglogical_origin missing and it cannot be installed on 9.5 and even when pglogical_origin.control copied to 9.5 slave then another error raised:
ERROR: pglogical_origin can only be installed into PostgreSQL 9.4

Set correct variable values in hosts file before running:
pg_version - postgresql server version
pg_master - master (provider) node ip address
pg_slave - slave (subscriber) node ip address
pg_port - postgresql server port
pg_appaddr - ip from which application will access db servers (trust access to 'app_db' for 'postgres' user)
You also may want to add your public key(s) to roles/ssh_keys/vars/main.yml for passwordless root access.

Add root ssh public key for passwordless access (separate playbook):

ansible-playbook -i hosts -u user -k -K root_ssh.yml

Setup postgresql with replication:

ansible-playbook -i hosts pg_cluster.yml

To get lag (after replication is up):

ansible-playbook -i hosts pg_cluster.yml --start-at-task="get replication lag"

pglogical_cluster's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.