Re: Real time replication of PG DBs accross two servers -

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Real time replication of PG DBs accross two servers -
Дата
Msg-id 20040414145753.GA30859@wolff.to
обсуждение исходный текст
Ответ на Re: Real time replication of PG DBs accross two servers -  ("Paul Breen" <pbreen@computerpark.co.uk>)
Ответы Re: Real time replication of PG DBs accross two servers -
Список pgsql-admin
On Wed, Apr 14, 2004 at 14:44:57 +0100,
  Paul Breen <pbreen@computerpark.co.uk> wrote:
>
> The way we approached it was to do the replication ourselves at the
> application level.  This isn't as hard as it sounds: you just open 2 db
> connections (1 to the master, 1 to the slave), start transactions on both
> connections, then write your data.  If an error occurs on either
> connection, you rollback on both connections.  This means you can still
> have writes that fail (for whatever reason) but both dbs are _consistent_.

This is guarenteed to work in general. When there are concurrent transactions,
one transaction may succeed on commit and the other fail. If you are using
sequences you could also end up with different values in each database.
That may or may not be a problem depending on how you use them.

В списке pgsql-admin по дате отправления:

Предыдущее
От: Ben Kim
Дата:
Сообщение: Re: sequence value of the record just inserted.
Следующее
От: Joe Maldonado
Дата:
Сообщение: Performance tuning for copy in