&slony1; Building & Installationinstallation instructionsFor &windows; users: Unless you are planning on hacking
the &slony1; code, it is highly recommended that you download and
install a prebuilt binary distribution and jump straight to the
configuration section below. Prebuilt binaries are available
from the StackBuilder application included in the EnterpriseDB
PostgreSQL installer There are also RPM binaries available in the PostgreSQL YUM repository site for recent
versions of &slony1; for recent versions of &postgres;.
This section discusses building &slony1; from source.You should have obtained the &slony1; source from the previous
step. Unpack it.
gunzip slony.tar.gz;
tar xf slony.tar
This will create a directory under the current directory with
the &slony1; sources. Head into that that directory for the rest of
the installation procedure.Short Version installation: short version
PGMAIN=/usr/local/pgsql839-freebsd-2008-09-03 \
./configure \
--with-pgconfigdir=$PGMAIN/bin
gmake all; gmake install
Configurationconfiguration instructions &slony1; normally needs to be built and installed by the
&postgres; Unix user. The installation target must be identical to
the existing &postgres; installation particularly in view of the fact
that several &slony1; components represent libraries and SQL scripts
that need to be in the &slony1; lib and
share directories. The first step of the installation procedure is to configure the
source tree for your system. This is done by running the
configure script.&slony1; is configured by
pointing it to the
various &postgres; library, binary, and include directories. For a
full list of these options, use the command ./configure
--help. It is sufficient, for the purposes of building a usable build,
to run configure
,
where /some/path/somewhere is the directory where
the &postgres; program pg_config is
located. Based on the output of pg_config,
the configure script determines the various
locations where &postgres; components are found, which indicate where
the essential components of &slony1; must be installed. For a full listing of configuration options, run the command
./configure --help. Beware: configure defaults
to permit indicating values for various paths, including
generic values:
=DIR user executables [EPREFIX/bin] =DIR system admin executables [EPREFIX/sbin] =DIR program executables [EPREFIX/libexec] =DIR read-only single-machine data [PREFIX/etc] =DIR modifiable architecture-independent data [PREFIX/com] =DIR modifiable single-machine data [PREFIX/var] =DIR object code libraries [EPREFIX/lib] =DIR C header files [PREFIX/include] =DIR C header files for non-gcc [/usr/include] =DIR read-only arch.-independent data root [PREFIX/share] =DIR read-only architecture-independent data [DATAROOTDIR] =DIR info documentation [DATAROOTDIR/info] =DIR locale-dependent data [DATAROOTDIR/locale] =DIR man documentation [DATAROOTDIR/man] =DIR documentation root [DATAROOTDIR/doc/slony1] =DIR html documentation [DOCDIR] =DIR dvi documentation [DOCDIR] =DIR pdf documentation [DOCDIR] =DIR ps documentation [DOCDIR] There are also &postgres;-specific options specified, which should not be expressly set, as pg_config should already provide correct values:
=DIR Location of the PostgreSQL postmaster. =DIR Location of the PostgreSQL headers. =DIR Location of the PostgreSQL server headers. =DIR Location of the PostgreSQL libs. =DIR Location of the PostgreSQL pkglibs. E.g. plpgsql.so =DIR Location of the PostgreSQL share dir. E.g. postgresql.conf.sample The compile of &postgres; must be expressly
configured with the option --enable-thread-safety
to provide correct client libraries. &slony1; requires that the &postgres; server headers be installed.
Some binary distributions of &postgres; include this is a a -dev package.After running configure, you may wish to review the file
Makefile.global to ensure it is looking in the
right places for all of the components. Example After determining that the &postgres; instance to be used is
installed in
/opt/dbs/pgsql746-aix-2005-04-01:
PGMAIN=/opt/dbs/pgsql746-aix-2005-04-01 \
./configure \
--with-pgconfigdir=$PGMAIN/bin
The configure script will run a
number of tests to guess values for various dependent variables and
try to detect some quirks of your system. BuildTo start the build process, type
gmake all
Be sure to use GNU make; on BSD systems, it is called
gmake; on Linux, GNU make is typically the
nativemake, so the name of
the command you type in may be either make or
gmake. On other platforms, you may need additional
packages or even install GNU make from scratch. The build may take
anywhere from a few seconds to 2 minutes depending on how fast your
hardware is at compiling things. The last line displayed should
be All of Slony-I is successfully made. Ready to
install. Installing &slony1 Once Built; To install &slony1;, enter
gmake install
This will install files into the postgresql install directory as
specified by the configure
option used in the &postgres; installation.
Make sure you have appropriate permissions to write into that area.
Commonly you need to do this either as root or as the postgres user.
The main list of files installed within the &postgres; instance
is, for versions of &slony1; $bindir/slon $bindir/slonik $libdir/slony1_funcs.$(SLONY_VERSION).$(DLSUFFIX) $datadir/slony1_base.$(SLONY_VERSION).sql $datadir/slony1_funcs.$(SLONY_VERSION).sql $datadir/slony1_funcs.v83.$(SLONY_VERSION).sql $datadir/slony1_funcs.v84.$(SLONY_VERSION).sqlBuilding on Win32
Building &slony1; on Win32 with the Microsoft SDK (Visual Studio) is
different than building &slony1; on other platforms. Visual Studio
builds can be done with out involving configure or gmake.
To build &slony1 you need
The &slony1; source from a source distribution tar
(The distribution tar files contain pre-built copies of the parser and
scanner generated files. The Win32 makefiles do not currently support
building these).&postgres; binaries, headers and libraries. pthreads for win32The Microsoft SDK 6.1 or Visual Studio 2008 (other versions
might work)gettext
for win32 or gettext for win64
To compile the &slony1; binaries you will need to
Set the environment variables PGSHARE,PG_INC,PG_LIB,
PTHREADS_INC,PTHREADS_LIB, GETTEXT_LIB to point to the proper locations
based on where these applications were installed. You will also
need to set SLONY_VERSION to the version of slony you are building.
The PGVER environment variable should be set the PostgreSQL MAJOR
number of the PostgreSQL instance you are compiling against(8.4 , 9.1, etc..).
For example
set PG_INC=c:\Postgresql\9.0\include
set PG_LIB=c:\Postgresql\9.0\lib
set PGSHARE=c:\\Postgresql\\9.0\\share
set PTHREADS_INC=c:\pthreads-win32\include
set PTHREADS_LIB=c:\pthreads-win32\lib
set GETTEXT_LIB=c:\gettext\lib
set GETTEXT_INC=c:\gettext\include
set SLONY_VERSION=2.2.0
set PGVER=9.2
Note that the backslash characters must be escaped for PGSHARE as in the
above example
From the Visual Studio or Microsoft Windows SDK command prompt run
cd src\backend
nmake /f win32.mak slony1_funcs.%SLONY_VERSION%.dll
cd ..\slon
nmake /f win32.mak slon.exe
cd ..\slonik
nmake /f win32.mak slonik.exe
src\backend\slony1_funcs.$SLONY_VERSION.dll and any of the .sql files in
src\backend need to be installed in your postgresql $share directory.
The SQL files also need to be renamed to contain the slony version number in
them. For example the slony1_funcs.sql should be renamed slony1_funcs.2.2.1.sql
copy slony1_base.sql c:\Program Files\Postgresql\9.1\share\slony1_base.2.2.0.sql
copy slony1_base.v83.sql c:\Program Files\Postgresql\9.1\share\slony1_base.v83.2.2.0.sql
copy slony1_base.v84.sql c:\Program Files\Postgresql\9.1\share\slony1_base.v84.2.2.0.sql
copy slony1_funcs.sql c:\Program Files\Postgresql\9.1\share\slony1_funcs.2.2.0.sql
copy slony1_funcs.v83.sql c:\Program Files\Postgresql\9.1\share\slony1_funcs.v83.2.2.0.sql
copy slony1_funcs.v84.sql c:\Program Files\Postgresql\9.1\share\slony1_funcs.v84.2.2.0.sql
pthreadVC.dll from the pthreads-win32 package also needs to be copied to the
directory you install the slon.exe and slonik.exe binaries in
Building Documentation: Admin Guide building &slony1; documentation The document you are reading now is a fairly extensive
Administrator's Guide containing what wisdom has been
discovered and written down about the care and feeding of &slony1;. This is only built if you specify --with-docs Note that you may have difficulty building the documentation on
older Red Hat systems (RHEL4 and below) See Bug
159382 (For RHEL) See the INSTALL file
for a workaround for Fedora...A pre-built copy of the admin guide should be
readily available, either in the form of a separate tarball nearby, or
in the directory doc/adminguide/prebuilt Installing &slony1; from RPMsRPMs for &slony1; Even though &slony1; can be compiled and run on most Linux
distributions, it is also possible to install &slony1; using binary
packages. Slony Global Development Team provides official RPMs and
SRPMs for many versions or Red Hat and Fedora .The RPMs are available at &postgres RPM Repository
. Please read the howto provided in the website for configuring
yum to use that repository. Please note that the RPMs will look for RPM
installation of &postgres;, so if you install &postgres; from source,
you should manually ignore the RPM dependencies related to
&postgres;.Installing &slony1; using these RPMs is as easy as
installing any RPM.yum install slony1yum will pick up dependencies. This repository provides Slony-I binaries
built against every supported &postgres version.The RPM installs the files into their usual places. The
configuration files are installed under /etc, the
binary files are installed in /usr/bin, libraries
are installed in /usr/lib/pgsql, and finally the
docs are installed in
/usr/share/doc/slony1. Installing the &slony1; service on &windows;installing &slony1; on &windows; On &windows; systems, instead of running one daemon per node, a single slon service is installed
which can then be controlled through the Services
control panel applet, or from a command prompt using the
net command.
C:\Program Files\PostgreSQL\8.3\bin> slon -regservice my_slon
Service registered.
Before you can run Slony, you must also register an engine!
WARNING! Service is registered to run as Local System. You are
encouraged to change this to a low privilege account to increase
system security.
Once the service is installed, individual nodes can be setup
by registering slon configuration files with the service.
C:\Program Files\PostgreSQL\8.3\bin> slon -addengine my_slon c:\node1.conf
Engine added.
Other, self explanatory commands include slon -unregservice
<service name>, slon -listengines
<service name> and slon -delengine
<service name> <config file>. For further information about the &windows; port, you may want
to see the following URLs: Slony-I Windows
installer sample