NAME

PGObject::Util::Replication::SMO - Replication Server Management Objects!

VERSION

Version 1

SYNOPSIS

This is intended to be a base class for server management objects for specific roles (master, standby, etc). It consolidates the PostgreSQL logic for these. It is not currently intended to be directly used though it could for basic configuration.

use PGObject::Util::Replication::SMO;
my $server = PGObject::Util::Replication::SMO->new(); # local pg
$server->slots(); # replication slots
my $config = $server->config;

This module provides a wrapper around the config handlers and replication slots.

PROPERTIES

host

Hostname or IP address

port

defaults to 5432

user

Username for the connection string. If not provided, dbi defaults to the username for the system user of the script running this module

password

Password for connecting, if needed based on pg_hba.conf settings

dbname

Database name for connecting. Defaults to postgres

autocommit

Whether to autocommit statements. This defaults to true.

persist_connect

If set, save the connection for repeated use. Defaults to off which means we reconnect for each operation.

Set to true if you are doing a lot of operations.

manage_vars

This is the variables we read or write. It is intended to be unmodified as it is.

METHDOS

connect

Returns a DBI connection to the database and checks to make sure we are not in recovery. If we are in recovery, an exception is thrown.

disconnect

Disconnect, if using persist_connect

METHODS

is_recovering

Returns true if the database is in recovery mode and false if not. Typically in replication environments, standby databases will always be in recovery mode while master systems should generally not be.

can_manage

Returns true if the user credentials allow us to create and manage replication slots.

This requires either superuser or replication attributes for the user.

slots([prefix])

Lists all replication slots, their lags, etc.

getslot($name)

Returns info from a single named slot

addslot

Adds a named replication slot

deleteslot($name)

Deletes a named replication slot

readconfig

Reads all settings from the pg instance.

addconfig

Adds one more config setting to the managed list and sets it to the default

setconfig

Sets a config value for later config file writing.

configcontents

Returns a file of the structure of the config file, based on all managed values.

AUTHOR

Chris Travers, <chris.travers at adjust.com>

BUGS

Please report any bugs or feature requests to bug-pgobject-util-replication-smo at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=PGObject-Util-Replication-SMO. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc PGObject::Util::Replication::SMO

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2017 Adjust.com

This program is distributed under the (Revised) BSD License: http://www.opensource.org/licenses/BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of Adjust.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.