Changes

Jump to: navigation, search

PgSQL Replication

1,671 bytes added, 10:36, 6 August 2014
no edit summary
== Steps for stetting up the replication with pgSQL ==__NOEDITSECTION__
'''On the master server, with IMSMA database already installed:'''
<ol>
<li>Create a new user on the database by running the following SQL on the IMSMA database:
<pre>CREATE USER replicator REPLICATION LOGIN ENCRYPTED PASSWORD 'password';</pre>
</li>
<li>Uncomment and edit the following lines in the '''postgresql.conf''' file in C:/IMSMAng/pgsql/data:
<pre>
153 wal_level = hot_standby
174 checkpoint_segments = 8
196 max_wal_senders = 3
199 wal_keep_segments = 8
</pre>
</li>
<li>Add the following line in the '''pg_hba.conf''' file in C:/IMSMAng/pgsql/data:
<pre>
host replication replicator <standby-ip>/32 trust
</pre>
<standy-ip> is the IP address of the standby server (to be determined by running the command <pre>ipconfig /all</pre> in a command window)
</li>
<li>
Restart the PGSQL service
</li>
</ol>
'''On the standby server, also with IMSMA installed:'''
<ol>
<li>Stop the PGSQL service and delete all the contents of C:/IMSMAng/pgsql/data</li>
<li>Open a command window, cd into the directory C:/IMSMAng/pgsql/bin and run the following command:
<pre>
pg_basebackup –h <master-ip> -D c:/IMSMAng/pgsql/data –U replicator –v –P
</pre>
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>
</ol>
{{NavBox Hub}}
[[Category:NoPublic]]
[[Category:VIE]]
1,068
edits

Navigation menu