Difference between revisions of "System/PostgreSQL/Londiste"

From LunaSys
Jump to navigation Jump to search
(Created page with "== Londiste 3 == === Provider === '''provider.ini''': <pre> [londiste3] job_name = job_master db = dbname=repl port=5432 host=redis1.gre.winsoft.fr pgq_queue_name = londi...")
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Londiste 3 ==
 
== Londiste 3 ==
 +
 +
In the following example, the provider will be called '''host1.lunasys.fr''' and the subscriber will be '''host2.lunasys.fr'''. The database used is '''repl''' and the table '''test'''.
 +
 +
All the following commands have to be executed as user '''postgres'''.
  
 
=== Provider ===
 
=== Provider ===
 +
 +
Create the folders /var/log/londiste and /var/run/londiste, with user '''postgres''' as owner.
  
 
'''provider.ini''':
 
'''provider.ini''':
Line 9: Line 15:
 
job_name = job_master
 
job_name = job_master
  
db = dbname=repl port=5432 host=redis1.gre.winsoft.fr
+
db = dbname=repl port=5432 host=host1.lunasys.fr
  
 
pgq_queue_name = londiste.replica
 
pgq_queue_name = londiste.replica
Line 34: Line 40:
 
use_skylog = 0
 
use_skylog = 0
 
</pre>
 
</pre>
 +
 +
Initialize the provider (root node):
 +
 +
londiste3 provider.ini create-root node1 "dbname=repl host=host1.lunasys.fr port=5432"
 +
 +
Start the provider worker:
 +
 +
londiste3 -d provider.ini worker
 +
 +
Launch the PgQ daemon:
 +
 +
pgqd -d pgq.ini
 +
  
 
=== Subscriber ===
 
=== Subscriber ===
 +
 +
Create the folders /var/log/londiste and /var/run/londiste, with user '''postgres''' as owner.
  
 
'''subscriber.ini''':
 
'''subscriber.ini''':
Line 43: Line 64:
 
job_name = job_slave
 
job_name = job_slave
  
db = dbname=repl port=5432 host=redis2.gre.winsoft.fr
+
db = dbname=repl port=5432 host=host2.lunasys.fr
  
 
pgq_queue_name = londiste.replica
 
pgq_queue_name = londiste.replica
Line 50: Line 71:
 
pidfile = /var/run/londiste/%(job_name)s.pid
 
pidfile = /var/run/londiste/%(job_name)s.pid
 
</pre>
 
</pre>
 +
 +
Initialize the subscriber (leaf or branch node):
 +
 +
londiste3 subscriber.ini create-leaf node2 "dbname=repl host=host2.lunasys.fr port=5432" --provider="host=host1.lunasys.fr dbname=repl"
 +
 +
Start the subscriber worker:
 +
 +
londiste3 -d subscriber.ini worker
 +
 +
=== Adding tables ===
 +
 +
On both provider and subscriber(s), you need to create the table and add them for replication:
 +
 +
londiste3 provider.ini add-table test
 +
londiste3 subscriber.ini add-table test
 +
 +
=== Status ===
 +
 +
On either the provider or a subscriber, you can get the current replication status with:
 +
 +
londiste3 <ini file> status

Latest revision as of 17:24, 21 December 2012

Londiste 3

In the following example, the provider will be called host1.lunasys.fr and the subscriber will be host2.lunasys.fr. The database used is repl and the table test.

All the following commands have to be executed as user postgres.

Provider

Create the folders /var/log/londiste and /var/run/londiste, with user postgres as owner.

provider.ini:

[londiste3]
job_name = job_master

db = dbname=repl port=5432 host=host1.lunasys.fr

pgq_queue_name = londiste.replica

logfile = /var/log/londiste/%(job_name)s.log
pidfile = /var/run/londiste/%(job_name)s.pid

pgq.ini:

[pgqd]

job_name = mypgq

db = dbname=repl port=5432 host=localhost
maint_delay_min = 5

loop_delay = 0.1

logfile = /var/log/londiste/pgqd.log
pidfile = /var/run/londiste/pgqd.pid

use_skylog = 0

Initialize the provider (root node):

londiste3 provider.ini create-root node1 "dbname=repl host=host1.lunasys.fr port=5432"

Start the provider worker:

londiste3 -d provider.ini worker

Launch the PgQ daemon:

pgqd -d pgq.ini


Subscriber

Create the folders /var/log/londiste and /var/run/londiste, with user postgres as owner.

subscriber.ini:

[londiste3]
job_name = job_slave

db = dbname=repl port=5432 host=host2.lunasys.fr

pgq_queue_name = londiste.replica

logfile = /var/log/londiste/%(job_name)s.log
pidfile = /var/run/londiste/%(job_name)s.pid

Initialize the subscriber (leaf or branch node):

londiste3 subscriber.ini create-leaf node2 "dbname=repl host=host2.lunasys.fr port=5432" --provider="host=host1.lunasys.fr dbname=repl"

Start the subscriber worker:

londiste3 -d subscriber.ini worker

Adding tables

On both provider and subscriber(s), you need to create the table and add them for replication:

londiste3 provider.ini add-table test
londiste3 subscriber.ini add-table test

Status

On either the provider or a subscriber, you can get the current replication status with:

londiste3 <ini file> status