pgReplicator INSTALLATION



During this quick start we will show you how to install and configure the pgReplicator package.

First of all you have to correctly install PostgreSQL (v. 6.5.x or 7.0.x). You can download the source code and compile it or get the binaries for your system.
If you are going to compile PostgreSQL, please remember to support TCL language. You also have to get TCL-DP (
get it here) which is not provided in binary format.
TCL-DP compilation requires TCL source code, that should be the same version of TCL supported in PostgreSQL . You can find it a little boring... yes, it is;-]

After the installation of PostgreSQL and Tcl-DP you can start the installation of PostgreSQL Replicator



Create replicator account

You have to create an account for a replication supervisor. The username must be named replicator.

useradd -g postgres -d /home/replicator replicator

(/home/replicator may be changed)

passwd replicator

(set a pwd as you like)

chmod 770 /home/replicator


createuser

(answer to the prompt with replicator, yes, yes)



Uncompress pgReplicator tarball

Uncompress the PostgreSQL Replicator tarball where you want. In this example we uncompress the tarball in the replicator's home directory /var/lib/pgsql getting the following directory tree

/home/replicator



\___

/pgreplica



\___

/bin


\___

/docs


\___

/test



Configure your installation

Change working directory to bin and edit pgr.conf file:

Uncomment and set the environment variables PGRBIN , PGRDATA , PGRBOX.
PGRBIN points to the executables of the replica system.
PGRDATA points to a writeable directory that will contain data extension of the replicated data bases.
PGRBOX is a writeable directory used for temporary storage operations.
In this example PGRBIN=/home/replicator/pgreplica/bin , PGRDATA=/home/replicator/data and PGRBOX=/home/replicator/pgrBOX .
Note that PGRBOX must be the same for each host in the replica set. (You can use symlinks to accommodate this)

As root:
cp pgr.conf /etc
chmod 644 /etc/pgr.conf

The pgrd deamon need to be running on the system. You can start it yourself by the system console or when the system boots. We provide a startup script for pgReplicator deamon in bin/utilities/pgrd. (You can customize this in base of the Linux distribution you have) and
cp ./utilities/pgrd /etc/rc.d/init.d


As replicator you can now create the new PostgresSQL Replicator installation:
./initdbr



Please remember that pgReplicator will always search for pgr.conf in /etc !
If you want you can put PGRBIN into replicator PATH. This is not required but could be useful.

Permitting replica files propagation among sites

Actually pgReplicator's propagation module uses rcp to propagate replica files among sites, so you have to trust in replicator user among involved hosts adding in the /etc/hosts.equiv file of each host a line per remote host:

<remote hostname> replicator


(If you like you can set up better methods such Kerberos intstead of trusted hosts....)



NEXT SECTION: Managing Replicated Databases