First draft of a mini-HOWTO for installation of PgReplicator
, a system to synchronize
PostgreSQL databases.
WARNING: not for the faint of heart. Plan time.
Read .
First, you have to find the version of TCL built with PostregSQL. A
simple way is to look the source package:
apt-get source postgresql
cd postgresql-$VERSION
grep -i tcl debian/rules
Here, we will assume it is 8.3.
Install these mandatory packages:
apt-get install tcl8.3-dev tk8.3 libpgtcl fakeroot
Download TCL, you will need its source to build the DP extension (why?
I don't know, I do not need Perl's sources to install a Perl module
from the CPAN) :
cd $SRC_DIR
apt-get source tcl8.3
cd tcl8.3-$VERSION
chmod a+x debian/rules; dpkg-buildpackage -uc -us -rfakeroot
Get and build TCL-DP :
cd ..
Download and untar
cd tcl-dp/unix
./configure --with-tcl=$SRC_DIR/tcl8.3-8.3.3/unix
Patch ../generic/dpInit.c (comment "if (TclHasSockets(interp) !=
TCL_OK)", see the instructions in
.
make
rm ../tests/00-first.test
(cd ../tests; tclsh all)
cd ..
wish teki.tcl
Custom install, then choose FreeBSD as a system type, it seems to
work, suppress the default MS-Windows.
chmod -R a+r /usr/lib/tcl8.3/dp4.0
No, continue with pgreplicator installation:
adduser --ingroup postgres --home /home/replicator --gecos "PostgreSQL replicator" replicator
chmod 770 /home/replicator
createuser
As replicator, untar replicator in /home/replicator
cd pgreplica/bin
Uncomment the first three directory variables (PG*)
cp pgr.conf /etc
chmod 644 /etc/pgr.conf
cp ./utilities/pgrd.debian /etc/init.d/pgrd
(The end-of-lines seem to be DOS, copy and paste to change that.)
chmod a+x /etc/init.d/pgrd
Edit /etc/init.d/pgrd to add /usr/lib/postgresql/bin to PATH and to add:
LD_LIBRARY_PATH=/usr/lib/postgresql/lib
export LD_LIBRARY_PATH
Set up the links:
update-rc.d pgrd start 90 2 3 4 5 . stop 90 0 1 6 .
cp /etc/pgr.conf .profile
Edit .profile to add:
PATH=${PATH}:/usr/lib/postgresql/bin
LD_LIBRARY_PATH=/usr/lib/postgresql/lib
export LD_LIBRARY_PATH
As replicator you can now create the new PostgresSQL Replicator installation:
./initdbr
/etc/init.d/pgrd start
Now, the replicator started (you should see it with ps). Look
~replicator/data/log/pgrd.start.
Now, have a beer and proceed with pgreplicator configuration.
--
Stephane Bortzmeyer
bortzmeyer@nic.fr