OmniPITR - Installation

INSTALLATION

You can get the OmniPITR project from https://github.com/omniti-labs/omnipitr. Within this directory you will find set of directories:

  • bin/

    This is where the scripts reside - usually this is the only place you need to look into.

  • doc/

    Documentation. In Plain Old Documentation format, so you can view it practically everywhere Perl is with perldoc command.

  • lib/

    Here be dragons. Don't look. Don't touch. Be afraid.

After fetching the omnipitr project/directory, put it in any place in your filesystem you'd want. Usually you will keep all of these together, but you can always remove the docs, put the scripts in some system bin/ directory, and put libs anyplace you want - just make sure that path to them is in PERL5LIB environment variable.

In case you will not decide to split the distribution - i.e. you will have someplace in your system omnipitr directory, which will contain bin/ and lib/ directories (just like it is distributed) - you don't have to set PERL5LIB - scripts will automatically find their libs.

REQUIREMENTS

Standard Perl distribution should be enough. On some Linux systems (Debian, Ubuntu) core Perl modules have been packaged separately - in such case you need to install also perl-modules package.

Additionally, you will need some programs installed:

  • nice

  • rsync

  • tar (it has to be GNU tar version 1.20 or newer)

Additionally, you might want to use compression, in which case you need gzip, bzip2 or lzma compression programs.

Please note that you can use pigz to get faster, but gzip-compatible, compression. To do so, specify all destinations/sources using gzip prefix, but add --gzip-path option with value pointing to pigz program.

SANITY CHECK

After installation it's good to run sanity-check.sh script (from bin/) directory - it will check if all prerequisites are available.

Output might look like this:

postgres@server:~$ omnipitr/bin/sanity-check.sh
Checking:
- /var/lib/postgres/omnipitr/bin
- /var/lib/postgres/omnipitr/lib
5 programs, 7 libraries.
All checked, and looks ok.

or like this:

postgres@server:~$ omnipitr/bin/sanity-check.sh
Checking:
- /var/lib/postgres/omnipitr/bin
- /var/lib/postgres/omnipitr/lib
5 programs, 7 libraries.
Warnings:
- you don't have ssh program available
- you don't have rsync program available
- your Perl is old (we support only 5.8 or newer. OmniPITR might work, but was not tested on your version of Perl)
Errors:
- you don't have any of programs used to transmit WAL files (ssh, rsync)
- you don't have POSIX Perl library (should be installed together with Perl)
All checked. 3 warnings, 2 errors.

Depending on your particular usecase even the errors don't have to be fatal - for example, if your rsync/ssh binary is in directory that is not in $PATH - it will not be found by sanity-check.sh, but you can always provide paths to them via --rsync-binary or --ssh-binary options to omnipitr-* scripts.

After sanity-check.sh returned All checked, and looks ok. you should be good with starting using the scripts.

INITIAL SETUP

To start Wal replication you will need to:

1. Start archiving wal segments: omnipitr-archive
2. Make initial hot backup on master: omnipitr-master-backup
3. Transfer the backup to slave server(s)
4. Start PostgreSQL recovery from hot-backup: omnipitr-restore

Afterwards you can/should monitor replication parameters with omnipitr-monitor, and that would be all. Of course you can do hot-backups on slave (with omnipitr-slave-backup) at any moment - just remember that doing them on slave requires more disc space - details in omnipitr-slave-backup.pod.

HINTS

It is technically possible, and suggested to use the same logfiles for all programs running on given server.

That is - you can setup archival to log to "archive.log" and backup to log to "backup.log", but you can make them both log to "omnipitr.log" - it will not break anything, and makes it simpler to manage log files.

Same thing applies to state directories - these can be the same between various programs from OmniPITR package.

When creating any files OmniPITR obeys ulimit, but doesn't enforce any additional restrictions. So, if you'd like it to create files that are readable only to owner, simply run it like this:

umask 0077; omnipitr-something ....

The OmniPITR project is Copyright (c) 2009-2013 OmniTI. All rights reserved.