Commit a1e5b5c8 authored by Bruce Momjian's avatar Bruce Momjian

Reconfigure failover/replication doc items to be varlist entries, rather

than new sections, so they appear all on the same web page.
parent c7a6046a
<!-- $PostgreSQL: pgsql/doc/src/sgml/failover.sgml,v 1.7 2006/11/16 18:25:58 momjian Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/failover.sgml,v 1.8 2006/11/16 21:43:33 momjian Exp $ -->
<chapter id="failover"> <chapter id="failover">
<title>Failover, Replication, Load Balancing, and Clustering Options</title> <title>Failover, Replication, Load Balancing, and Clustering Options</title>
...@@ -76,167 +76,186 @@ ...@@ -76,167 +76,186 @@
and load balancing solutions. and load balancing solutions.
</para> </para>
<sect1 id="shared-disk-failover"> <variablelist>
<title>Shared Disk Failover</title>
<varlistentry>
<para> <term>Shared Disk Failover</term>
Shared disk failover avoids synchronization overhead by having only one <listitem>
copy of the database. It uses a single disk array that is shared by
multiple servers. If the main database server fails, the backup server <para>
is able to mount and start the database as though it was recovering from Shared disk failover avoids synchronization overhead by having only one
a database crash. This allows rapid failover with no data loss. copy of the database. It uses a single disk array that is shared by
</para> multiple servers. If the main database server fails, the backup server
is able to mount and start the database as though it was recovering from
<para> a database crash. This allows rapid failover with no data loss.
Shared hardware functionality is common in network storage devices. One </para>
significant limitation of this method is that if the shared disk array
fails or becomes corrupt, the primary and backup servers are both <para>
nonfunctional. Shared hardware functionality is common in network storage devices. One
</para> significant limitation of this method is that if the shared disk array
</sect1> fails or becomes corrupt, the primary and backup servers are both
nonfunctional.
<sect1 id="warm-standby-using-point-in-time-recovery"> </para>
<title>Warm Standby Using Point-In-Time Recovery</title> </listitem>
</varlistentry>
<para>
A warm standby server (see <xref linkend="warm-standby">) can <varlistentry>
be kept current by reading a stream of write-ahead log (WAL) <term>Warm Standby Using Point-In-Time Recovery</term>
records. If the main server fails, the warm standby contains <listitem>
almost all of the data of the main server, and can be quickly
made the new master database server. This is asynchronous and <para>
can only be done for the entire database server. A warm standby server (see <xref linkend="warm-standby">) can
</para> be kept current by reading a stream of write-ahead log (WAL)
</sect1> records. If the main server fails, the warm standby contains
almost all of the data of the main server, and can be quickly
<sect1 id="continuously-running-replication-server"> made the new master database server. This is asynchronous and
<title>Continuously Running Replication Server</title> can only be done for the entire database server.
</para>
<para> </listitem>
A continuously running replication server allows the backup server to </varlistentry>
answer read-only queries while the master server is running. It
receives a continuous stream of write activity from the master server. <varlistentry>
Because the backup server can be used for read-only database requests, <term>Continuously Running Replication Server</term>
it is ideal for data warehouse queries. <listitem>
</para>
<para>
<para> A continuously running replication server allows the backup server to
Slony-I is an example of this type of replication, with per-table answer read-only queries while the master server is running. It
granularity. It updates the backup server in batches, so the replication receives a continuous stream of write activity from the master server.
is asynchronous and might lose data during a fail over. Because the backup server can be used for read-only database requests,
</para> it is ideal for data warehouse queries.
</sect1> </para>
<sect1 id="data-partitioning"> <para>
<title>Data Partitioning</title> Slony-I is an example of this type of replication, with per-table
granularity. It updates the backup server in batches, so the replication
<para> is asynchronous and might lose data during a fail over.
Data partitioning splits tables into data sets. Each set can </para>
be modified by only one server. For example, data can be </listitem>
partitioned by offices, e.g. London and Paris. While London </varlistentry>
and Paris servers have all data records, only London can modify
London records, and Paris can only modify Paris records. This <varlistentry>
is similar to section <xref <term>Data Partitioning</term>
linkend="continuously-running-replication-server"> above, except <listitem>
that instead of having a read/write server and a read-only server,
each server has a read/write data set and a read-only data <para>
set. Data partitioning splits tables into data sets. Each set can
</para> be modified by only one server. For example, data can be
partitioned by offices, e.g. London and Paris. While London
<para> and Paris servers have all data records, only London can modify
Such partitioning provides both failover and load balancing. Failover London records, and Paris can only modify Paris records. This
is achieved because the data resides on both servers, and this is an is similar to the "Continuously Running Replication Server"
ideal way to enable failover if the servers share a slow communication item above, except that instead of having a read/write server
channel. Load balancing is possible because read requests can go to any and a read-only server, each server has a read/write data set
of the servers, and write requests are split among the servers. Of and a read-only data set.
course, the communication to keep all the servers up-to-date adds </para>
overhead, so ideally the write load should be low, or localized as in
the London/Paris example above. <para>
</para> Such partitioning provides both failover and load balancing. Failover
is achieved because the data resides on both servers, and this is an
<para> ideal way to enable failover if the servers share a slow communication
Data partitioning is usually handled by application code, though rules channel. Load balancing is possible because read requests can go to any
and triggers can be used to keep the read-only data sets current. Slony-I of the servers, and write requests are split among the servers. Of
can also be used in such a setup. While Slony-I replicates only entire course, the communication to keep all the servers up-to-date adds
tables, London and Paris can be placed in separate tables, and overhead, so ideally the write load should be low, or localized as in
inheritance can be used to access both tables using a single table name. the London/Paris example above.
</para> </para>
</sect1>
<para>
<sect1 id="query-broadcast-load-balancing"> Data partitioning is usually handled by application code, though rules
<title>Query Broadcast Load Balancing</title> and triggers can be used to keep the read-only data sets current. Slony-I
can also be used in such a setup. While Slony-I replicates only entire
<para> tables, London and Paris can be placed in separate tables, and
Query broadcast load balancing is accomplished by having a inheritance can be used to access both tables using a single table name.
program intercept every SQL query and send it to all servers. </para>
This is unique because most replication solutions have the write </listitem>
server propagate its changes to the other servers. With query </varlistentry>
broadcasting, each server operates independently. Read-only
queries can be sent to a single server because there is no need <varlistentry>
for all servers to process it. <term>Query Broadcast Load Balancing</term>
</para> <listitem>
<para> <para>
One limitation of this solution is that functions like Query broadcast load balancing is accomplished by having a
<function>random()</>, <function>CURRENT_TIMESTAMP</>, and program intercept every SQL query and send it to all servers.
sequences can have different values on different servers. This This is unique because most replication solutions have the write
is because each server operates independently, and because SQL server propagate its changes to the other servers. With query
queries are broadcast (and not actual modified rows). If this broadcasting, each server operates independently. Read-only
is unacceptable, applications must query such values from a queries can be sent to a single server because there is no need
single server and then use those values in write queries. Also, for all servers to process it.
care must be taken that all transactions either commit or abort </para>
on all servers Pgpool is an example of this type of replication.
</para> <para>
</sect1> One limitation of this solution is that functions like
<function>random()</>, <function>CURRENT_TIMESTAMP</>, and
<sect1 id="clustering-for-load-balancing"> sequences can have different values on different servers. This
<title>Clustering For Load Balancing</title> is because each server operates independently, and because SQL
queries are broadcast (and not actual modified rows). If this
<para> is unacceptable, applications must query such values from a
In clustering, each server can accept write requests, and modified single server and then use those values in write queries. Also,
data is transmitted from the original server to every other care must be taken that all transactions either commit or abort
server before each transaction commits. Heavy write activity on all servers Pgpool is an example of this type of replication.
can cause excessive locking, leading to poor performance. In </para>
fact, write performance is often worse than that of a single </listitem>
server. Read requests can be sent to any server. Clustering </varlistentry>
is best for mostly read workloads, though its big advantage is
that any server can accept write requests &mdash; there is no need <varlistentry>
to partition workloads between read/write and read-only servers. <term>Clustering For Load Balancing</term>
</para> <listitem>
<para> <para>
Clustering is implemented by <productname>Oracle</> in their In clustering, each server can accept write requests, and modified
<productname><acronym>RAC</></> product. <productname>PostgreSQL</> data is transmitted from the original server to every other
does not offer this type of load balancing, though server before each transaction commits. Heavy write activity
<productname>PostgreSQL</> two-phase commit (<xref can cause excessive locking, leading to poor performance. In
linkend="sql-prepare-transaction" fact, write performance is often worse than that of a single
endterm="sql-prepare-transaction-title"> and <xref server. Read requests can be sent to any server. Clustering
linkend="sql-commit-prepared" endterm="sql-commit-prepared-title">) is best for mostly read workloads, though its big advantage is
can be used to implement this in application code or middleware. that any server can accept write requests &mdash; there is no need
</para> to partition workloads between read/write and read-only servers.
</sect1> </para>
<sect1 id="clustering-for-parallel-query-execution"> <para>
<title>Clustering For Parallel Query Execution</title> Clustering is implemented by <productname>Oracle</> in their
<productname><acronym>RAC</></> product. <productname>PostgreSQL</>
<para> does not offer this type of load balancing, though
This allows multiple servers to work concurrently on a single <productname>PostgreSQL</> two-phase commit (<xref
query. One possible way this could work is for the data to be linkend="sql-prepare-transaction"
split among servers and for each server to execute its part of endterm="sql-prepare-transaction-title"> and <xref
the query and results sent to a central server to be combined linkend="sql-commit-prepared" endterm="sql-commit-prepared-title">)
and returned to the user. There currently is no can be used to implement this in application code or middleware.
<productname>PostgreSQL</> open source solution for this. </para>
</para> </listitem>
</sect1> </varlistentry>
<sect1 id="commercial-solutions"> <varlistentry>
<title>Commercial Solutions</title> <term>Clustering For Parallel Query Execution</term>
<listitem>
<para>
Because <productname>PostgreSQL</> is open source and easily <para>
extended, a number of companies have taken <productname>PostgreSQL</> This allows multiple servers to work concurrently on a single
and created commercial closed-source solutions with unique query. One possible way this could work is for the data to be
failover, replication, and load balancing capabilities. split among servers and for each server to execute its part of
</para> the query and results sent to a central server to be combined
</sect1> and returned to the user. There currently is no
<productname>PostgreSQL</> open source solution for this.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Commercial Solutions</term>
<listitem>
<para>
Because <productname>PostgreSQL</> is open source and easily
extended, a number of companies have taken <productname>PostgreSQL</>
and created commercial closed-source solutions with unique
failover, replication, and load balancing capabilities.
</para>
</listitem>
</varlistentry>
</variablelist>
</chapter> </chapter>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment