Giter Club home page Giter Club logo

bdr_demo_ansible's Introduction

bdr_demo_ansible

This repository contains a set of Ansible playbooks to easily create a simple BDR or UDR test set-up with two or more nodes running on localhost.

Requirements

BDR Configuration

Create a file your_hostname.yml in the host_vars directory with the following variables (default values in parentheses):

  • db_superuser (postgres)
  • db_name (bdrdemo)
  • bdr_bin: path to the BDR PostgreSQL bin/ directory
  • base_data_dir: arbitrary directory for each BDR instance's data files
  • base_log_dir (/tmp): directory for BDR/UDR PostgreSQL log files
  • bdr_ports: list of ports for BDR PostgreSQL instances
  • bdr_replica_src: port number of the initial BDR PostgreSQL instance, from which the other instances will replicate from (if in doubt, just use the first entry in bdr_ports).

Add your_hostname to the [bdr_hosts] section of hosts.ini

The file host_vars/sample_host.yml provides a useful template containing the parameters which will probably need to be configured.

MacPorts users: if Ansible complains about psycopg2 being missing, it is probably using the OS X native Python interpreter; set ansible_python_interpreter to point to the MacPorts version.

BDR Operation

$ ansible-playbook -i hosts.ini bdr_init.yml

PLAY [all] ********************************************************************

TASK: [bdr_init | Create data directories] ************************************
changed: [nara] => (item=5597)
changed: [nara] => (item=5598)
changed: [nara] => (item=5599)

(...)

TASK: [bdr_init | Create BDR group] *******************************************
changed: [osaka]

TASK: [bdr_init | Add other nodes to group] ***********************************
skipping: [osaka] => (item=5597)
changed: [osaka] => (item=5598)
changed: [osaka] => (item=5599)

PLAY RECAP ********************************************************************
osaka                      : ok=15   changed=13   unreachable=0    failed=0


$ /path/to/pg_bdr/bin/psql -p 5597 bdrdemo
psql (9.4beta2)
Type "help" for help.

bdrdemo=# CREATE TABLE foo(id INT);
DEBUG:  attempting to acquire global DDL lock for (bdr (6056475237161047104,1,16384,))
DEBUG:  sent DDL lock request, waiting for confirmation
DEBUG:  global DDL lock acquired successfully by (bdr (6056475237161047104,1,16384,))
CREATE TABLE
Time: 16.755 ms
bdrdemo=# COMMENT ON TABLE foo IS 'Created on 5597';
COMMENT
Time: 28.503 ms
bdrdemo=# \q

$ /path/to/pg_bdr/bin/psql -p 5598 bdrdemo
psql (9.4beta2)
Type "help" for help.

bdrdemo=# \dt+
                      List of relations
 Schema | Name | Type  |  Owner  |  Size   |   Description
--------+------+-------+---------+---------+-----------------
 public | foo  | table | barwick | 0 bytes | Created on 5597
(1 row)

UDR Configuration

UDR setup is essentially the same as BDR setup.

Create a file your_hostname_udr.yml in the host_vars directory with the following variables (default values in parentheses):

  • db_superuser (postgres)
  • db_name (bdrdemo)
  • bdr_bin: path to the UDR PostgreSQL bin/ directory
  • base_data_dir: arbitrary directory for each BDR instance's data files
  • base_log_dir (/tmp): directory for BDR/UDR PostgreSQL log files
  • udr_ports: list of ports for UDR PostgreSQL instances
  • udr_replica_src: port number of the initial UDR PostgreSQL instance, from which the other instances will replicate from (if in doubt, just use the first entry in udr_ports).

Currently only the servers will be set up (with appropriate configuration and extensions installed); the actual UDR configuration must be done manually

Playbooks

Following playbooks have been defined:

  • bdr_init.yml

    Creates and configures BDR-enabled instances

  • bdr_destroy.yml

    Halts existing BDR-enabled instances and removes the database directories

  • bdr_start.yml

    Starts previously configured but not running BDR-enabled instances

  • bdr_stop.yml

    Stops running BDR-enabled instances

bdr_demo_ansible's People

Contributors

ibarwick avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

devekkoio

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.