Mammoth
  • Download
  • |
  • Contact
CMD | Command Prompt, Inc. - PostgreSQL Solutions, Support & Hosting
  • |
  • |
  • |
  • |
  • |

PostgreSQL + Replication

General Replicator Information

Can I use the Open Source version of PostgreSQL with your product?
Mammoth PostgreSQL + Replication IS the Open Source version of PostgreSQL. It just has Replication integrated within the backend.
Replicator Reserved Words
The following two words are added reserved words for Mammoth Replicator:

promote mcp_refresh This means that any use of the two above words within PostgreSQL outside of their intended purpose must be quoted. For example:

CREATE TABLE foo (id bigserial primary key, "promote" text);
mcp_server mysteriously dies
The maximum size of the mcp_server.log is 2 Gigabytes. If your log reaches the 2 Gigabyte limit, the mcp_server will die.

The solution is to insure that you have proper log file rotation in place. When using log file rotation do not move and rotate, use a copy truncate method.

If you are using the bash shell you can truncate your log file like so:
>/path/to/mcp_server.log


If you are using a Redhat derivative of Linux you can use logrotate with the copytruncate option.

Replicator Installation / Configuration

How do I know which tables need primary keys?
If you are unsure of which tables will need primary keys here is some SQL to help you.
SELECT nspname, relname 
   FROM pg_class 
   LEFT JOIN pg_constraint ON 
      (pg_constraint.contype = 'p' AND conrelid = pg_class.oid)
   JOIN pg_namespace ON 
      (pg_namespace.oid = pg_class.relnamespace)
   WHERE relkind = 'r' AND contype IS NULL;
How many tables can Replicator replicate?
The official answer is 10,000 tables. However there are a couple of caveats:

  1. The replicated_table_names list is scanned at the start of each connection thus if you have 10,000 tables listed there is a good chance that the connection will timeout before the backend recognizes that it is available.
  2. The replicated_table_names list uses shared memory.


In practice one should never try to replicate more than 1000 tables.
I added a table and it won't replicate!
Make sure you have checked the following:

  1. The table has a primary key.
  2. The table is listed in replication_table_names in the postgresql.conf
  3. You don't have "mcp_auto_full_sync=off" in the mcp_server.conf
mcp_server as a Win32 service?
It is possible to run the mcp_server as a service on Win32. To install the mcp_server as a service please use the following command:

./mcp_server.exe -r -l log_file -c config_file -d txlog_path -u user -p password


To uninstall the mcp_server.exe as a service use the following:
./mcp_server.exe -u

Replicator Management

How can I tell the Slave that it is already synced with the Master?
You have restored the Slave from a backup from the Master. There have been zero updates to the Master since the restoration of the Slave and you want to only replicate from the point in which you restored the backup.

This is currently not possible with Replicator. Replicator requires full knowledge of the database thus it will truncate your slave and replicate from the master.
How do I make changes to the schema once replication is running?
There is a now a section in the documentation that covers this.
I am querying slaves, how do I know which slave I am on?
If you are using replicator in an environment where you need to query from the slaves but you also need to know if you are on a slave or which slave you are on you can do the following:
Show if you are a slave:
show replication_slave;
 replication_slave
-------------------
 off
Show which slave you are:
show replication_slave_no;
 replication_slave_no
----------------------
 0
Promote Features
There is now a section in the docs on this tip.
Powered by Mammoth PostgreSQL W3C XHTML 1.0 Compliant
Copyright © 2000-2008 Command Prompt, Inc. All Rights Reserved. All trademarks property of their respective owners.