PostgreSQL Replication

3 FAQ's, Hints & Traps

<- 2.2 Slave [  up  ] - [ TOC ] 4 Related Links ->

  • How to start PostgreSQL daemons in replication mode?
    The Master host always has to run over TCP/IP (and not via Socket!), usually on port 5432 while PostgreSQL on the Slave can run via Socket. You may run both DBMS processes over TCP/IP but not necessarily.

  • I've created one more table to be replcated as well
    It's necessary to create it with a primary key! To enable replication, just add the trigger to this table:
    psql -d database < AddTrigger_table.sql

  • What happen if...?
    You may manually insert a row into a replicated table of the Slave host. This will be executed but might lead into an error if the replication process gets a conflict because of an already existing primary key you've created manually in the Slave table. Normally you don't do such things anyway ;-)

  • Set TCP/IP Permissions On Master:

    vi /usr/local/pgsql/data/pg_hba.conf
    
    host    all         all         1.2.3.4   255.255.255.255   trust
    
    # where 1.2.3.4 is the external IP address of the Slave host
    Restart or reload PostgreSQL so this change can take effect.

  • ERROR: function recordchange() does not exist
    Means: You have to add this function first:
    This is done by MirrorSetup.sql which includes
    CREATE FUNCTION "recordchange" () RETURNS trigger AS '/usr/local/pgsql/lib/pending.so', 'recordchange' LANGUAGE 'C';

  • undefined symbol: elog
    psql:MirrorSetup.sql:5: ERROR: could not load library "/usr/local/pgsql/lib/pending.so": /usr/local/pgsql/lib/pending.so: undefined symbol: elog
    You might have to play with /etc/ld.so.conf and ldconfig.
    Search





copyright by retoh - created with mytexi