Обсуждение: Implementing Replication via pgAdmin

Поиск
Список
Период
Сортировка

Implementing Replication via pgAdmin

От
"Daniel B. Thurman"
Дата:
I have tried to follow the pgAdmin slony support in the help sections
of pgAdmin and it seems to be inconsistent.  For example, it is not
intuitively clear from the help sections how exactly to setup the master
and slave configurations.  From a windows client perspective, it seems
that one must use command-line operations in order to setup the slony
services, create and configure the configuration files, and then try to use
the pgAdmin replication objects to define the master/slave relationships?

Since it is possible to create new connections to all of the postgreSQL
servers within your network into the pgAdmin connections list, should it
also be possible to seamlessly perform (slony) replication for all of the
master/slaves databases with slony services automatically initialized and
completely within pgAdmin without having to resort to manual command-line
operations?

Perhaps this is already planned for future releases of pgAdmin?


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.21/1012 - Release Date: 9/16/2007 6:32 PM


Re: Implementing Replication via pgAdmin

От
Dave Page
Дата:
Daniel B. Thurman wrote:
> I have tried to follow the pgAdmin slony support in the help sections
> of pgAdmin and it seems to be inconsistent.  For example, it is not
> intuitively clear from the help sections how exactly to setup the master
> and slave configurations.  From a windows client perspective, it seems
> that one must use command-line operations in order to setup the slony
> services, create and configure the configuration files, and then try to use
> the pgAdmin replication objects to define the master/slave relationships?

Yes.

> Since it is possible to create new connections to all of the postgreSQL
> servers within your network into the pgAdmin connections list, should it
> also be possible to seamlessly perform (slony) replication for all of the
> master/slaves databases with slony services automatically initialized and
> completely within pgAdmin without having to resort to manual command-line
> operations?

The slon daemon (on *nix) or service & engines (on Windows) must be
configured from the command line. pgAdmin makes no attempt to do this
because that is entirely OS dependent (in fact, it is distribution
dependent because, for example, Redhat and Slackware start daemons in
entirely different ways). In addition, you may not even want to run slon
on the machine that you're running pgAdmin on, or even that you're
running the database on.

So yes, configure the slons on the command line, then use pgAdmin to
create your replication clusters and sets.

Regards, Dave


Re: Implementing Replication via pgAdmin

От
"Daniel B. Thurman"
Дата:
Thanks Dave.

But I am having some trouble trying to get replication to work.

Here is what I did:

1) On master server:  a) I registered: lib/slevent.dll  b) I register as a service: slon -regservice  c) slon
-listengines    2 engine(s) registered for service 'Slony-I'     Engine 1: E:\Program
Files\PostgreSQL\8.2\data\slon.conf    Engine 2: E:\Program Files\PostgreSQL\8.2\data\master.conf  d) Started the slon
servicevia manage->services 

2) On Slave Server  a) I registered: lib/slevent.dll  b) I register as a service: slon -regservice  c) slon
-listengines    2 engine(s) registered for service 'Slony-I'     Engine 1: E:\Program
Files\PostgreSQL\8.2\data\slon.conf    Engine 2: E:\Program Files\PostgreSQL\8.2\data\slave.conf  d) Started the slon
servicevia manage->services 

3) Launched: pgAdmin3 (v1.6.2)  a) Created Master Server Connection  b) Selected database: MyTest  c) Right-clicked
Replicationobject, selected from menu: New slony-I Cluster ...  d) Join existsing cluster: [unchecked]     Server:
<Master-Server-Name>[Greyed out]     Database: MyTest [Entered data]     Cluster Name: <Master-HostName>-Master-Cluster
[entereddata]     Local Node: 1,  Value: "Master Node" [entered data]     Admin Node: 99, Value: "pgAdmin Node"
[entereddata]     Comment: <empty> [no data entered]  d) Clicked OK and Completed structure shows:     <Master
Hostname>-Master-Cluster      Nodes (2)         Master Node           Paths (0)           listens (0)         pgAdmin
Node          Paths (1)             Master Node           listens (1)             Master Node (Master Node)
ReplicationSets (0) 
   At this point, I tried to add a slave node but was unable to:   a) I tried (on Master server) connection:     1)
Right-clickedReplication object, selected from menu: New slony-I Cluster ...     2) Join existing cluster: [checked]
   Server: Master-Server-Name [no change]        Database: MyTest [no change]        Cluster-name: <Master-Server-Name>
      Local Node: 2, Value: "Slave Node" [entered data]        Admin node: "99 - pgAdmin Node" [no change]
Comment:<empty> [no data entered]     3) Clicked OK and...        "An error has occurred:         ERROR: schema
"_<Master-Host-Server>-Master-Cluster"already exists        " 
     So, perhaps I should not have added a join here, in the master server connection,     so I clicked CANCEL
   b) Then I tried (on Slave Server) connection:     1) Right-clicked Replication object, selected from menu: New
slony-ICluster ...     2) Join existing cluster: [checked]        Server: <Slave-Server-Name> [Initially was Greyed
out,but active after a delay]        Database: MyTest [unchanged]        Cluster Name: <empty> [dropdown shows empty
listand not selecteable]        Local Node: <empty>, Value: <empty>        Admin Node: <empty>, Value: <empty>
Comment:<empty> 
     At this point, it makes no sense to enter any fields after 'Cluster Name' since     the 'Cluster Name' must have a
valueand 'OK' remains greyed out. 
   So I am at loss to go any further...
   Any advice?

>-----Original Message-----
>From: Dave Page [mailto:dpage@postgresql.org]
>Sent: Monday, September 17, 2007 8:58 AM
>To: Daniel B. Thurman
>Cc: Pgadmin-Support (E-mail)
>Subject: Re: [pgadmin-support] Implementing Replication via pgAdmin
>
>
>Daniel B. Thurman wrote:
>> I have tried to follow the pgAdmin slony support in the help sections
>> of pgAdmin and it seems to be inconsistent.  For example, it is not
>> intuitively clear from the help sections how exactly to
>setup the master
>> and slave configurations.  From a windows client
>perspective, it seems
>> that one must use command-line operations in order to setup the slony
>> services, create and configure the configuration files, and
>then try to use
>> the pgAdmin replication objects to define the master/slave
>relationships?
>
>Yes.
>
>> Since it is possible to create new connections to all of the
>postgreSQL
>> servers within your network into the pgAdmin connections
>list, should it
>> also be possible to seamlessly perform (slony) replication
>for all of the
>> master/slaves databases with slony services automatically
>initialized and
>> completely within pgAdmin without having to resort to manual
>command-line
>> operations?
>
>The slon daemon (on *nix) or service & engines (on Windows) must be
>configured from the command line. pgAdmin makes no attempt to do this
>because that is entirely OS dependent (in fact, it is distribution
>dependent because, for example, Redhat and Slackware start daemons in
>entirely different ways). In addition, you may not even want
>to run slon
>on the machine that you're running pgAdmin on, or even that you're
>running the database on.
>
>So yes, configure the slons on the command line, then use pgAdmin to
>create your replication clusters and sets.
>
>Regards, Dave
>
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.487 / Virus Database: 269.13.21/1012 - Release
>Date: 9/16/2007 6:32 PM
>
>

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.21/1012 - Release Date: 9/16/2007 6:32 PM


Re: Implementing Replication via pgAdmin

От
Dave Page
Дата:
Daniel B. Thurman wrote:
> Thanks Dave.
> 
> But I am having some trouble trying to get replication to work.
> 
> Here is what I did:
> 
> 1) On master server:
>    a) I registered: lib/slevent.dll
>    b) I register as a service: slon -regservice
>    c) slon -listengines
>       2 engine(s) registered for service 'Slony-I'
>       Engine 1: E:\Program Files\PostgreSQL\8.2\data\slon.conf
>       Engine 2: E:\Program Files\PostgreSQL\8.2\data\master.conf
>    d) Started the slon service via manage->services
> 
> 2) On Slave Server
>    a) I registered: lib/slevent.dll
>    b) I register as a service: slon -regservice
>    c) slon -listengines
>       2 engine(s) registered for service 'Slony-I'
>       Engine 1: E:\Program Files\PostgreSQL\8.2\data\slon.conf
>       Engine 2: E:\Program Files\PostgreSQL\8.2\data\slave.conf
>    d) Started the slon service via manage->services

Why did you register 2 engines on each? For a simple master-slave setup
you would only need one engine for the master and one for the slave.

> 3) Launched: pgAdmin3 (v1.6.2)

You might want to try 1.8 beta 5. There have been some useful
improvements to the Slony code.

>    a) Created Master Server Connection
>    b) Selected database: MyTest
>    c) Right-clicked Replication object, selected from menu: New slony-I Cluster ...
>    d) Join existsing cluster: [unchecked]
>       Server: <Master-Server-Name> [Greyed out]
>       Database: MyTest [Entered data]
>       Cluster Name: <Master-HostName>-Master-Cluster [entered data]
>       Local Node: 1,  Value: "Master Node" [entered data]
>       Admin Node: 99, Value: "pgAdmin Node" [entered data]
>       Comment: <empty> [no data entered]
>    d) Clicked OK and Completed structure shows:
>       <Master Hostname>-Master-Cluster
>         Nodes (2)
>           Master Node
>             Paths (0)
>             listens (0)
>           pgAdmin Node
>             Paths (1)
>               Master Node
>             listens (1)
>               Master Node (Master Node)
>         Replication Sets (0)

OK.

>     At this point, I tried to add a slave node but was unable to:
>     a) I tried (on Master server) connection:

Setup the slave on the slave, not the master.

> 
>     b) Then I tried (on Slave Server) connection:
>       1) Right-clicked Replication object, selected from menu: New slony-I Cluster ...
>       2) Join existing cluster: [checked]
>          Server: <Slave-Server-Name> [Initially was Greyed out, but active after a delay]
>          Database: MyTest [unchanged]
>          Cluster Name: <empty> [dropdown shows empty list and not selecteable]
>          Local Node: <empty>, Value: <empty>
>          Admin Node: <empty>, Value: <empty>
>          Comment: <empty>
> 
>       At this point, it makes no sense to enter any fields after 'Cluster Name' since
>       the 'Cluster Name' must have a value and 'OK' remains greyed out.

Yeah, iirc that could happen on earlier versions of pgAdmin. Install a
copy of 1.8 beta 5 (it'll install alongside your current copy) and try
that. It should work more as you would expect.

Regards, Dave.


Re: Implementing Replication via pgAdmin

От
"Daniel B. Thurman"
Дата:
>> Thanks Dave.
>>
>> But I am having some trouble trying to get replication to work.
>>
>> Here is what I did:
>>
>> 1) On master server:
>>    a) I registered: lib/slevent.dll
>>    b) I register as a service: slon -regservice
>>    c) slon -listengines
>>       2 engine(s) registered for service 'Slony-I'
>>       Engine 1: E:\Program Files\PostgreSQL\8.2\data\slon.conf
>>       Engine 2: E:\Program Files\PostgreSQL\8.2\data\master.conf
>>    d) Started the slon service via manage->services
>>
>> 2) On Slave Server
>>    a) I registered: lib/slevent.dll
>>    b) I register as a service: slon -regservice
>>    c) slon -listengines
>>       2 engine(s) registered for service 'Slony-I'
>>       Engine 1: E:\Program Files\PostgreSQL\8.2\data\slon.conf
>>       Engine 2: E:\Program Files\PostgreSQL\8.2\data\slave.conf
>>    d) Started the slon service via manage->services
>
>Why did you register 2 engines on each? For a simple master-slave setup
>you would only need one engine for the master and one for the slave.
>

Because I did not know what I was doing. FYI: For the master and the slave
the configuration is taken directly from the slon-sample.conf CVS area and
I made no changes to it.  It turns out that the master.conf and slave.conf
was perhaps for an old version and caused errors to the slon service on the
slave and thus removing slave.conf from the service reported no more errors.
The error reported was that the service was not able to connect to the local
database, fwiw.

I am assuming that there is nothing needed to be changed to the config file
(all of the entries are commented out by default).  Restarting both the master
and slave service reports no errors at this time.

>> 3) Launched: pgAdmin3 (v1.6.2)
>
>You might want to try 1.8 beta 5. There have been some useful
>improvements to the Slony code.
>
>>    a) Created Master Server Connection
>>    b) Selected database: MyTest
>>    c) Right-clicked Replication object, selected from menu:
>New slony-I Cluster ...
>>    d) Join existsing cluster: [unchecked]
>>       Server: <Master-Server-Name> [Greyed out]
>>       Database: MyTest [Entered data]
>>       Cluster Name: <Master-HostName>-Master-Cluster [entered data]
>>       Local Node: 1,  Value: "Master Node" [entered data]
>>       Admin Node: 99, Value: "pgAdmin Node" [entered data]
>>       Comment: <empty> [no data entered]
>>    d) Clicked OK and Completed structure shows:
>>       <Master Hostname>-Master-Cluster
>>         Nodes (2)
>>           Master Node
>>             Paths (0)
>>             listens (0)
>>           pgAdmin Node
>>             Paths (1)
>>               Master Node
>>             listens (1)
>>               Master Node (Master Node)
>>         Replication Sets (0)
>
>OK.
>
>>     At this point, I tried to add a slave node but was unable to:
>>     a) I tried (on Master server) connection:
>
>Setup the slave on the slave, not the master.
>
>>
>>     b) Then I tried (on Slave Server) connection:
>>       1) Right-clicked Replication object, selected from
>menu: New slony-I Cluster ...
>>       2) Join existing cluster: [checked]
>>          Server: <Slave-Server-Name> [Initially was Greyed
>out, but active after a delay]
>>          Database: MyTest [unchanged]
>>          Cluster Name: <empty> [dropdown shows empty list
>and not selecteable]
>>          Local Node: <empty>, Value: <empty>
>>          Admin Node: <empty>, Value: <empty>
>>          Comment: <empty>
>>
>>       At this point, it makes no sense to enter any fields
>after 'Cluster Name' since
>>       the 'Cluster Name' must have a value and 'OK' remains
>greyed out.
>

Oh bust my knuckles.  NOW I understand what is going on!  I did
not realize that I needed to change the Server: <Slave-Server-name>
dropdown to that of the MASTER-SERVER-NAME for which I wanted to add
my slave DB to.  Uh, duhoh!

Now I am able to join the slave to the master cluster.

>
>Yeah, iirc that could happen on earlier versions of pgAdmin. Install a
>copy of 1.8 beta 5 (it'll install alongside your current copy) and try
>that. It should work more as you would expect.
>
>Regards, Dave.

But uh, there is still another problems for me...

I changed an entry in the myTest database table and I do not see this value
replicated to the slave db.  Is there something more I need to do after coming
this far along?

So far I see:
      On Master Server:      <Master Hostname>-Master-Cluster        Nodes (3)          Master Node            Paths
(0)           listens (0)          Slave Node            Paths (0)            listens (0)          pgAdmin Node
  Paths (2)              Master Node              Slave Node            listens (2)              Master Node (Master
Node)             Slave Node (Slave Node)        Replication Sets (0) 
      On Slave Server:      <Slave Hostname>-Master-Cluster        Nodes (3)          Master Node            Paths (0)
         listens (0)          Slave Node            Paths (0)            listens (0)          pgAdmin Node
Paths(1)              Master Node            listens (1)              Master Node (Master Node)        Replication Sets
(0)
 I am not sure where to look for any activities...

Thanks!

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.21/1012 - Release Date: 9/16/2007 6:32 PM


Re: Implementing Replication via pgAdmin

От
Dave Page
Дата:
Daniel B. Thurman wrote:
> I changed an entry in the myTest database table and I do not see this value
> replicated to the slave db.  Is there something more I need to do after coming
> this far along?
> 
> So far I see:
> 
>        On Master Server:
>        <Master Hostname>-Master-Cluster
>          Nodes (3)
>            Master Node
>              Paths (0)
>              listens (0)
>            Slave Node
>              Paths (0)
>              listens (0)
>            pgAdmin Node
>              Paths (2)
>                Master Node
>                Slave Node
>              listens (2)
>                Master Node (Master Node)
>                Slave Node (Slave Node)
>          Replication Sets (0)
> 
>        On Slave Server:
>        <Slave Hostname>-Master-Cluster
>          Nodes (3)
>            Master Node
>              Paths (0)
>              listens (0)
>            Slave Node
>              Paths (0)
>              listens (0)
>            pgAdmin Node
>              Paths (1)
>                Master Node
>              listens (1)
>                Master Node (Master Node)
>          Replication Sets (0)
> 
>   I am not sure where to look for any activities...

I only see one listen on your slave. Make sure there is one there for
the master and not (just) the admin node.

Regards, Dave.



Re: Implementing Replication via pgAdmin

От
"Daniel B. Thurman"
Дата:
I have gone over the following document:
http://www.slony.info/documentation/firstdb.html

To get some idea of what is going on (at the manual level)
as to how replication services works.  From what I have done,
was to manually start the slon for the master and server sides
the following:

MASTER:
1) Set the privileges for the MyTest database so as to allow  postgres user to access the table completely (ALL)
2) In the windows command window:  a) set path variable to include the path to postgreSQL/bin  b) set PGUSER=postgre
c)set PGPASSWORD=*****  d) 
slon Copper-Master-Cluster dbname=MyTest user=postgres host=copper.cdkkt.com
<a gadzillion debug messages are shown. Make sure there are no errors reported>
[I found initially tho, that slon complained that myTest did not exist, and Ifound that my entries in BOTH of server
sidesin the Replication tree containeda couple of dbname=myTest when they should have been dbname=MyTest (I did notknow
theywere case sensitive), so I updated the entries via pgAdmin interfaceto proper values, then retried slon again, and
theerrors disappeared!] 

SLAVE:
1) Set the privileges for the MyTest database so as to allow  postgres user to access the table completely (ALL)
2) In the windows command window:  a) set path variable to include the path to postgreSQL/bin  b) set PGUSER=postgre
c)set PGPASSWORD=*****  d) 
slon Copper-Master-Cluster dbname=MyTest user=postgres host=raider.cdkkt.com
<a gadzillion debug messages are shown.  Make sure there are no errors reported>
[I found an error reported for "duplicate key" violation on sl_table_tab_reliod_keyand I compared the value of 18989
againstthat of the master side and the valuethere was found to be: 18988.  So I updated the slave side value to 18988
tomatch,updated the table, and the error disappeared and replication went on smoothly!] 

I found that, if PGPASSWORD was not supplied, the connection will fail since slon
could not find the password, even if I provided the .pgpass file with the correct
information.

I had tested replication by changing a value in one of the columns in the MyTest.car
table and lo' and behold!  The slave server's MyTest table was updated!  For fun, I
also tried the converse, to change a value in the slave side table and the master car
table was not updated (as expected).

Now... here comes the hard part...

How to I put this slon replication service "into the background" on windows or
more to the point, how do I normally start the replication process normally (as
a service?) and not manually as I have done in the above steps?

I noticed that if I tried to "start" the replication via pgAdmin3 w/o having the
slon programs running by selecting: "Restart Node" menu item when slon replication
programs are not running on either the master or slaves, it would simply pop up an
error message saying that the replication services are not 'running'.  Shouldn't
there be some sort of a 'Start Node', 'Stop Node' type of menu item or what?

Again, what is the proper way to start the replication service w/o having to open
a command window and manually start it in the manner as I have done above?

Thanks!
Dan

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date: 9/17/2007 1:29 PM


Re: Implementing Replication via pgAdmin

От
"Daniel B. Thurman"
Дата:
As suggested by Dave,

The following link is a jpeg File, size 274K, showing the
pgAdmin3 setup I have so far.  Note that there are a couple
of problems already found:

1) The Cluster name is now: CopperMasterCluster.  I think that  slonik does not like '-' characters.

2) The entries for dbname have all been updated to the correct  case-sensitive names, ie, all 'myTest' are all
'MyTest'. I found these problems when I ran slon in the command windows  for the master and slave and in debug mode,
andthere was connection  errors reported.  This is all fixed now. 

http://www.cdkkt.com/images/pgAdmin/Master-Slave.jpg

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.22/1015 - Release Date: 9/18/2007 11:53 AM


Re: Implementing Replication via pgAdmin

От
"Daniel B. Thurman"
Дата:
>> >I see that my Master and Slave replication process is not
>> >even running so at this point I am not sure how to start
>> >them running.
>
>Are the slons running? They should be started from the Services control
>panel applet after the engines are registered. When they are, check the
>connections on each server to ensure they have actually connected. If
>not, check the log files/event log for error messages to see
>why not. If
>required, modify the config files or pgpass files are required and
>restart the slons.
>
>If they are connected and running, check that you have listens defined
>on each node in the cluster for every other node in the cluster (except
>the admin node).
>
>Regards, Dave.
>

Sigh, I am not getting anywhere, so it seems.

1) I have been able to completely reconstruct the replication  structure using pgAdmin3
2) I was able to manually run on the Master server, in a command window:  slon MasterCluster dbname=MyTest
user=postgreshost=copper.cdkkt.com 
  But I noticed the error:  "2007-09-19 17:42:39 Pacific Daylight Time ERROR  remoteWorkerThread_2:   "select
"_MasterCluster".setAddTable_int(1,3, '"public"."cars"',   'cars_pkey', ''); " PGRES_FATAL_ERROR ERROR:  Slony-I:
setAddTable_int:  table id 3 has already been assigned!" 
   Ignoring this error for now,

3) I was able to manually run on the Slave server, in a command window:  slon MasterCluster dbname=MyTest user=postgres
host=copper.cdkkt.com [No errors reported] 

4) Changed a value in MyTest.cars and it was successfully replicated to slave

5) Feeling that all was working, I proceeded on the master to run slonik:  > slonik slonyReplication.txt    [No errors
reported]
  [File configuration is:   #--  This defines which namespace the replication system uses   cluster name =
MasterCluster;
   #-- Admin conninfo's are used by the slonik program to connect   #-- to the node databases.  So these are the
PQconnectdbarguments   #-- that connect from the administrators workstation (where   #-- slonik is executed).   node 1
adminconninfo = 'dbname=MyTest host=copper.cdkkt.com user=postgres';   node 2 admin conninfo = 'dbname=MyTest
host=raider.cdkkt.comuser=postgres'; 
   #-- Node 2 subscribes set 1   subscribe set ( id = 1, provider = 1, receiver = 2, forward = yes);  ]

6) Proceeded on the slave to run slonik:  > slonik slonyReplication.txt  [No errors reported]
  [Same file configuration as above]

7) Restared master and slave services

8) Ran pgAdmin3 and noticed:
  on MASTER:  a) Master Node: Running PID: not running  b)  Slave Node: Running PID: administrative node
  on SLAVE:  a) Master Node: Running PID: not running  b)  Slave Node: Running PID: not running
  And of course, replication failed when a value is changed in MyTest.cars

9) So, I tried testing to see if the manually running slon on both  servers would work showing:
  on MASTER:  a) Master Node: Running PID: 1528  b)  Slave Node: Running PID: administrative node
  on SLAVE:  a) Master Node: Running PID: 1528  b)  Slave Node: Running PID: 1752
  And of course, replication still fails.
  Seems that my running of slonik messed up the configuration  as is shown where the slave Running PID =
'administrativenode' 

So -- what now?

What am I doing wrong with the slonik configuration file that so messed
it all up and is it possible to remove this configuration using pssql?

I know I can tear everything down again and start over, but I would end
up using manual slons.  Perhaps I do not have a good handle as to the
proper configuration files for slonik?

Thanks -
Dan

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.22/1015 - Release Date: 9/18/2007 11:53 AM


Re: Implementing Replication via pgAdmin

От
Dave Page
Дата:
On Wed, 2007-09-19 at 19:00 -0700, Daniel B. Thurman wrote:
> What am I doing wrong with the slonik configuration file that so messed
> it all up and is it possible to remove this configuration using pssql?
> 
> I know I can tear everything down again and start over, but I would end
> up using manual slons.  Perhaps I do not have a good handle as to the
> proper configuration files for slonik?

Don't use Slonik if you're using pgAdmin *except* for switchover and
failover. Startover and do everything in pgAdmin *or* with Slonik.

Regards Dave



Re: Implementing Replication via pgAdmin

От
"Daniel B. Thurman"
Дата:
Configuring Replication on Windows,
using pgAdmin3 v8.0 Beta 5
==========================

On Master:
==========
1) Adding a new Master Replication Set:  a) Right-click 'Replication', and select: 'New slony-I Cluster...'  b)
UnCheck:Join existing cluster  c) Enter: Cluster name: MasterCluster  d) Enter: Local node: 1:  Master Node  e) Enter:
Adminnode: 99: pgAdmin Node  f) Click: OK 

On Slave:
=========
2) Adding a new Slave Replication Set:  a) Right-click 'Replication', and select: 'New slony-I Cluster...'  b) Check:
Joinexisting cluster     [wait for Server dropdown list to complete]  c) Click Server dropdown list and select: <Master
hostname>     [Cluster name is filled automatically]     [Database     is filled automatically]     [Admin Node   is
filledautomatically]  d) Enter: Local node for slave: 2: Slave Node  e) Click: OK 
  Adding a new Master Path/listener:  a) Refresh and expand all items in the Replication tree  b) Right-click 'Path
(0)',under 'Master Node'       and select: 'New Path' menu item     [Server:     '2 - Slave Node' appears]     [Conn
retry:'10'             appears]     Enter: Connect info:        'host=<slave-host> dbname=<database> user=<postgres>'
 Click: OK  c) Click on Master Node: listens     [Note that a master listener is automatically added] 
  Adding a new Slave Path/Listeners:  a) Right-click 'Path (0)', under 'Slave Node'       and select: 'New Path' menu
item    [Server:     '1 - Master Node' appears]     [Conn retry: '10'              appears]     Enter: Connect info:
   'host=<master-host> dbname=<database> user=<postgres>'     Click: OK  b) Click on Slave Node: listens     [Note that
aslave listener is automatically added] 

On Master:
==========
3) Completely refresh the entire 'Replication' tree and expand fully.  [Should see newly added sub-trees: 'Slave Node'
andpgAdmin Node] 
  Adding a new master Path/listeners:  a) Right-click 'Path (0)', under 'Master Node'       and select: 'New Path' menu
item    [Server:     '2 - Slave Node' appears]     [Conn retry: '10'             appears]     Enter: Connect info:
 'host=<slave-host> dbname=<database> user=<postgres>'     Click: OK  b) Click on Master Node: listens     [Note that a
listeneris automatically added] 
  Adding a new slave Path/listeners:  a) Right-click 'Path (0)', under 'Slave Node'       and select: 'New Path' menu
item    [Server:     '1 - Master Node' appears]     [Conn retry: '10'              appears]     Enter: Connect info:
   host=<master-host> dbname=<database> user=<postgres>'     Click: OK  b) Click on Slave Node: listens     [Note that
alistener is automatically added] 
  Adding a new Replication Set:     Right-click 'Replication Sets (0)' and select: 'New Replication Set'     Enter: ID:
'1'    Enter: Comment: 'Hardware'     Click: OK     Fully expand tree: 'Replication Sets (1)' 
  Adding a new table:     Right click: 'Tables (0)' and select: 'New Table'     Click table dropdown list and select:
<Databasetable>     Enter: ID: '1'     Clieck: OK 
  Adding a new sequence:     Right-click 'Sequences (0)' and select: 'New Sequence'     Click 'Sequence' dropdown list
item.    [This step does not work for me, as I find at this point,      there are no sequence dropdown items so a
sequencecannot      be created at this point. Otherwise if you have a sequence      dropdown item, continue...]
Enter:ID: '2'     Click: OK 
  Adding a new Subscription:     Right-click 'Subscriptions (0)' and select: 'New Subscription'     [  Origin: '1',
         appears]     [Provider: '1 - Master Node', appears]     [Reciever: '2 - Slave Node',  appears (a single item)]
   Check: 'Can forward' [If you want this.]     Click: OK 
  [At this point, you can check to see that 'Tables (1)' and   'Subscriptions (1)' can be expanded and contains
sub-treeitems    so if desired, verify that your entries were properly set.] 

On Slave:
=========  Adding a new Replication Set:     Right-click 'Replication Sets (0)' and select: 'New Replication Set'
Enter:ID: '1'     Enter: Comment: 'Hardware'     Click: OK     Fully expand tree: 'Replication Sets (1)' 
  Adding a new table:     Right click: 'Tables (0)' and select: 'New Table'     Click table dropdown list and select:
<Databasetable>     Enter: ID: '1'     Clieck: OK 
  Adding a new sequence:     Right-click 'Sequences (0)' and select: 'New Sequence'     Click 'Sequence' dropdown list
item.    [This step does not work for me, as I find at this point,      there are no sequence dropdown items so a
sequencecannot      be created at this point. Otherwise if you have a sequence      dropdown item, continue...]
Enter:ID: '2'     Click: OK 
  Adding a new Subscription:     Right-click 'Subscriptions (0)' and select: 'New Subscription'     [  Origin: '2',
         appears]     [Provider: '2 - Slave Node',  appears]     [Reciever: '1 - Master Node', appears (single item)]
 Check: 'Can forward' [If you want this.]     Click: OK 
  [At this point, you can check to see that 'Tables (1)' and   'Subscriptions (1)' can be expanded and contains
sub-treeitems    so if desired, verify that your entries were properly set.] 

+ For both Master and Slaves, restart the services via control panel.
+ For pgAdmin3, stop the services and reconnect to ensure all is there.

Notes/Questions:
================
1) At this point, I think configuration is complete?  What is not clear  to me is the 'Sequence' in Replication Sets,
shouldthere be something  added there?  As explained above, I am not able to do this so is this  a required step? 

2) Expand the Replication (1) for master and slave. I note the following:  On Master:  a) Master Node: Running PID='not
running' b) Slave  Node: Running PID='not running'  On Slave:  a) Master Node: Running PID='not running'  b) Slave
Node:Running PID='not running' 
  I am able to manually run the slons both servers in a command window  with the entries as:  > slon MasterCluster
dbname=MyTestuser=postgres host=copper.cdkkt.com 
  Debugging shows no errors. When running, I show that the 'Running PID'  are filled with process ID's as expected.  I
amable to see that  replication works; updating an item on the master database table updates  the slave database table. 
  All is fine except that these slons are running as foreground processes  and cannot be backgrounded and killing the
commandwindow will terminate  the process! How can I get the slons running without resorting to using  command windows
tostart the replication processes? 
=================

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.25/1018 - Release Date: 9/19/2007 3:59 PM


Re: Implementing Replication via pgAdmin

От
Dave Page
Дата:
Daniel B. Thurman wrote:
>    All is fine except that these slons are running as foreground processes
>    and cannot be backgrounded and killing the command window will terminate
>    the process! How can I get the slons running without resorting to using
>    command windows to start the replication processes?

Install them as a service, eg.

slon -regservice Slony-I

The service can then be started from the services control panel applet 
or from the command line using:

net start Slony-I

It'll start automatically at next reboot as well.

Regards, Dave



Re: Implementing Replication via pgAdmin

От
"Daniel B. Thurman"
Дата:
>> All is fine except that these slons are running as
>> foreground processes and cannot be backgrounded and
>> killing the command window  will terminate the process!
>> How can I get the slons running without  resorting to
>> using command windows to start the replication processes?
>
>Install them as a service, eg.
>
>slon -regservice Slony-I
>
>The service can then be started from the services control panel
>applet or from the command line using:
>
>net start Slony-I
>
>It'll start automatically at next reboot as well.
>
>Regards, Dave
>

I think might I see what is happening and why I was not able to
get the nodes running for replication.

What I said before was that I grabbed a copy of slon.conf from
the CVS HEAD and used this file verbatim, i.e. no changes were
made at all to this file and I used this file as my engine.

First, I want to point out, that the slon service is using
LocalSystem account. I further note that I had to change the
password for the LocalSystem account to the password I am
using for the slon, then apply it.  Next, I had to define the
environment variable PGUSER=postgres and PGPASSWORD=***,
then start the service.  I found that if I did not do this,
then there is an error message reported that PostgreSQL
could not reach the local databases and pgAdmin was unable to
connect either as it was reporting TCP connection errors.

Anyway, after the service were started,

1) The Log Messages reported:
"INFO   started 0 slon engine(s)"

2) Followed with: "ERROR  Process for engine at 'E:\Program Files \PostgreSQL\8.2\Slony\slon.conf' died on startup. "

I had assumed all along that since the service was still running
all must be OK, but I assumed wrongly, I think.  The key point
here is that the slon.conf file has NO ENTRIES, they are ALL
COMMENTED OUT!

OK, with this line of thinking that *SOMETHING* has to be exposed
in the slon.conf file, then I proceeded to uncomment 2 lines.

More specifically:

# Set the cluster name that this instance of slon is running against
# default is to read it off the command line
cluster_name='MasterCluster'

# Set slon's connection info, default is to read it off the command line
conn_info='host=copper.cdkkt.com port=5432 dbname=MyTest user=postgres password=***'

Ok, then I restarted the slon service and then I get alot of slon Log
messages, but apparently at some intervals, I still get these errors
cropping up:
3) ERROR  slon_connectdb: PQconnectdb("host=raider.cdkkt.com dbname=MyTest  user=postgres") failed - fe_sendauth: no
passwordsupplied 

OK, seems that I finally was able to get at least the slon.conf files to be
accepted.  I find that without the password= entry, I would get a different
error message reported (unable to reach local databases), so it seems that
I need it.

I did the same thing for slave side, and I get an error message:
4) ERROR  slon_connectdb: PQconnectdb("host=copper.cdkkt.com dbname=MyTest  user=postgres") failed - fe_sendauth: no
passwordsupplied 

Seems that master cannot reach the slave and the slave cannot reach
the master?

I thought that perhaps this was due to the account being LocalSystem
accounts, for the both master and slave servers and perhaps network
access is not permitted with these accounts?

And yet, I note that the Nodes on both the master and slave are
running with PID and valid process id numbers.  However, changing
a value in the master database table does not replicate to the slave.

As a test, I tried to use a local user account for the slon service on
the master as 'postgres', which is a Windows 2000 Professional OS, which
allows local user accounts to be created and I was able to get slon to
run, but as for the slave server, which is a Windows 2000 Server, which
is also a secondary Domain Controller, I am not allowed to create local
user accounts, but instead must use the domain user account
as: 'postgres@cdkkt.com' which differs from that used by PostgreSQL
as: 'postgres'?

This is getting really confusing...

Please advise?

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.27/1020 - Release Date: 9/20/2007 12:07 PM


Re: Implementing Replication via pgAdmin

От
Dave Page
Дата:
Daniel B. Thurman wrote:
> # Set the cluster name that this instance of slon is running against
> # default is to read it off the command line
> cluster_name='MasterCluster'
> 
> # Set slon's connection info, default is to read it off the command line
> conn_info='host=copper.cdkkt.com port=5432 dbname=MyTest user=postgres password=***'

That is the minimum you need to get started.

> I did the same thing for slave side, and I get an error message:
> 4) ERROR  slon_connectdb: PQconnectdb("host=copper.cdkkt.com dbname=MyTest
>    user=postgres") failed - fe_sendauth: no password supplied

Well the connection string in that error message doesn't contain a
password, unlike the one in the conf file you showed above. Are you sure
you registered the right file?

> Seems that master cannot reach the slave and the slave cannot reach
> the master?
> 
> I thought that perhaps this was due to the account being LocalSystem
> accounts, for the both master and slave servers and perhaps network
> access is not permitted with these accounts?

Not that I'm aware of - and you wouldn't get that specific message in
that case anywy.

> And yet, I note that the Nodes on both the master and slave are
> running with PID and valid process id numbers.  However, changing
> a value in the master database table does not replicate to the slave.
> 
> As a test, I tried to use a local user account for the slon service on
> the master as 'postgres', which is a Windows 2000 Professional OS, which
> allows local user accounts to be created and I was able to get slon to
> run, but as for the slave server, which is a Windows 2000 Server, which
> is also a secondary Domain Controller, I am not allowed to create local
> user accounts, but instead must use the domain user account
> as: 'postgres@cdkkt.com' which differs from that used by PostgreSQL
> as: 'postgres'?

Shouldn't matter in the slightest.

> This is getting really confusing...
> 
> Please advise?

You're asking in the wrong place really - this list is for pgAdmin
issues but this is Slony installation issue.

Regards, Dave.