Changes

Jump to: navigation, search

PgSQL Replication

700 bytes added, 09:40, 6 August 2014
no edit summary
This page describes how to set up direct replication with pgSQL. Generally, replication allows having two database servers (typically one for data entry and one for reporting) that stay synchronised. Concretely, when data is added, deleted or updated on the '''master''' server, the changes get immediately replicated on the '''slave''' or '''standby''' server. The standby database is read-only, i.e. no changes can be made directly there - only changes on the master are being replicated. Currently (August 2014) this mechanism is only in place at MACCA in Kabul.
 
== Requirements ==__NOEDITSECTION
== Steps for stetting up the replication with pgSQL ==__NOEDITSECTION__
This command makes the initial synchronisation, i.e. copies the entire database from the master to the standby. This can take some time, depending on the size of the database. The progress can be followed on the command window as shown below.
{{Note|The hot standby replication mechanism can only be applied to the '''entire''' database server, i.e. all the databases from the master will be replication to the standby -- not only the database ''imsma'' but any database that is running on the master.}}
</li>
<li>
Create a new file called '''recovery.conf''' in C:/IMSMAng/pgsql/data with the following contents:
<pre>
standby_mode = 'on'
primary_conninfo = 'host=<master-ip> port=5432 user=replicator'
</pre>
<master-ip> is the IP address of the master server.
</li>
<li>
Uncomment and edit the following lines in '''postgresql.conf''' in C:/IMSMAng/pgsql/data:
<pre>
210 hot_standby = on
</pre>
</li>
<li>Restart the PGSQL service
{{Note|Depending on the master and standby systems, there might need to be changes made to the '''pg_hba.conf''' file, such as commenting the lines relating to IPv6 local connections. Contact VIE if there are any troubles with this.}}
</li>
</ol>
1,068
edits

Navigation menu