Installing, configuring, running and administrating Slony-I 2.0 on Red Hat / CentOS using RPMs - Part 1 : Pre-installation and installation phases
This article series will tell about installation, configuration and the running phases of Slony-I 2.0 series on Red Hat / CentOS 5. This article assumes that you installed PostgreSQL from RPMs on each node and you are already using PostgreSQL RPM repository, If you have not, please refer here for details.
This article series will tell about installation, configuration and the running phases of Slony-I 2.0 series on Red Hat / CentOS 5. This article assumes that you installed PostgreSQL from RPMs on each node and you are already using PostgreSQL RPM repository, If you have not, please refer here for details.
Before you start using Slony-I, make sure that:
** Origin and slave(s) are syncing their clocks from a (preferably local) time server.
On RHEL/CentOS, running an NTP server is really easy:
yum install ntp
chkconfig ntpd on
service ntpd start
** All tables have Primary Keys
This is a basic Slony-I requirement. Slony-I needs PK to perform replication.
Here is the query I use to find tables that have primary keys on public schema:
SELECT tablename FROM pg_tables
WHERE tablename IN
(SELECT r.relname FROM pg_class r, pg_constraint c
WHERE r.oid = c.conrelid AND c.contype = 'p'
)
AND schemaname = 'public';
Probably there are much better ways to do it, but ...
(Comments are welcome.)
To find tables that don't have PKs, change IN to NOT IN. Also you may want to change schema part.
** PostgreSQL clusters can talk between themselves.
This is done using pg_hba.conf. It only requires a reload. You will probably edit listen_addresses in postgresql.conf, too. Default value is localhost, and you will want to change it to * . Please note that this change requires restart, as noted in postgresql.conf.
Installing Slony-I-2.0 with yum is really easy:
yum install slony1-II

It will install slon with altperl tools (the tools written with perl, which really makes administration of Slony-I easier). We will examine these tools in the upcoming parts.
Please note that documentation cannot be built (yet) on RHEL/CentOS 5, so slony1-II-docs package is not available for now. Since then, you can use online documentation at Slony-I website
File locations:
Configuration files:
/etc/slon.conf: Configuration file for slon daemon
/etc/slon_tools.conf : Configuration file that are used by altperl scripts. We will heavily use this one in our examples.
Binary files:
All binary files are under /usr/bin: Full list : rpm -ql slony1-II|grep /usr/bin
There are some more files.
In the next article, I will tell about preparing clusters for replication.
** Origin and slave(s) are syncing their clocks from a (preferably local) time server.
On RHEL/CentOS, running an NTP server is really easy:
yum install ntp
chkconfig ntpd on
service ntpd start
** All tables have Primary Keys
This is a basic Slony-I requirement. Slony-I needs PK to perform replication.
Here is the query I use to find tables that have primary keys on public schema:
SELECT tablename FROM pg_tables
WHERE tablename IN
(SELECT r.relname FROM pg_class r, pg_constraint c
WHERE r.oid = c.conrelid AND c.contype = 'p'
)
AND schemaname = 'public';
Probably there are much better ways to do it, but ...

To find tables that don't have PKs, change IN to NOT IN. Also you may want to change schema part.
** PostgreSQL clusters can talk between themselves.
This is done using pg_hba.conf. It only requires a reload. You will probably edit listen_addresses in postgresql.conf, too. Default value is localhost, and you will want to change it to * . Please note that this change requires restart, as noted in postgresql.conf.
Installing Slony-I-2.0 with yum is really easy:
yum install slony1-II

It will install slon with altperl tools (the tools written with perl, which really makes administration of Slony-I easier). We will examine these tools in the upcoming parts.
Please note that documentation cannot be built (yet) on RHEL/CentOS 5, so slony1-II-docs package is not available for now. Since then, you can use online documentation at Slony-I website
File locations:
Configuration files:
/etc/slon.conf: Configuration file for slon daemon
/etc/slon_tools.conf : Configuration file that are used by altperl scripts. We will heavily use this one in our examples.
Binary files:
All binary files are under /usr/bin: Full list : rpm -ql slony1-II|grep /usr/bin
There are some more files.
In the next article, I will tell about preparing clusters for replication.
The author does not allow comments to this entry
13 Comments
Linear