Thread: pgpool question
I'm experimenting with pgpool 2.51 on my Linux box runnung two postgresql backends: pg74:5432 and pg801:5433 I configured pgpool to use pg74:5432 as primary backend and pg801:5433 as second one. Pgpool is running on default port (9999) and I configured my web application to use it, so I could start/stop backends without disturbing client (web browser). When I stop primary backend (pg74:5432) pgpool switched to backend failover from (5432) to (5433) done but when I start primary and stopped secondary backend pgpool never switched back to primary backend as expected ! I see bogus message like: starting failover from (5433) to (5433) What I'm doing wrong ? Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83
Oleg Bartunov wrote: > I'm experimenting with pgpool 2.51 on my Linux box runnung > two postgresql backends: pg74:5432 and pg801:5433 > > I configured pgpool to use pg74:5432 as primary backend and pg801:5433 > as second one. Pgpool is running on default port (9999) and > I configured my web application to use it, so I could start/stop backends > without disturbing client (web browser). > > When I stop primary backend (pg74:5432) pgpool switched to backend > failover from (5432) to (5433) done > but when I start primary and stopped secondary backend pgpool > never switched back to primary backend as expected ! I see bogus message > like: > starting failover from (5433) to (5433) > > What I'm doing wrong ? I don't think anything. I could be wrong, but my understanding is that if the primary goes down, you have to restart pgpool after primary comes back up. It doesn't toggle back and forth from primary <-> secondary when necessary, it only goes primary->secondary. I played with pgpool for a while and came up with effectively the same confused question. -- Jeff Hoffmann jeff@propertykey.com
On Wed, 9 Mar 2005, Jeff Hoffmann wrote: > Oleg Bartunov wrote: >> I'm experimenting with pgpool 2.51 on my Linux box runnung >> two postgresql backends: pg74:5432 and pg801:5433 >> >> I configured pgpool to use pg74:5432 as primary backend and pg801:5433 as >> second one. Pgpool is running on default port (9999) and >> I configured my web application to use it, so I could start/stop backends >> without disturbing client (web browser). >> >> When I stop primary backend (pg74:5432) pgpool switched to backend >> failover from (5432) to (5433) done >> but when I start primary and stopped secondary backend pgpool >> never switched back to primary backend as expected ! I see bogus message >> like: >> starting failover from (5433) to (5433) >> >> What I'm doing wrong ? > > I don't think anything. I could be wrong, but my understanding is that if > the primary goes down, you have to restart pgpool after primary comes back > up. It doesn't toggle back and forth from primary <-> secondary when > necessary, it only goes primary->secondary. I played with pgpool for a while > and came up with effectively the same confused question. Seems, limited functionality. But, then I don't understand switchover options ([-s {m[aster]|s[econdary]] switch). What's '-s m switch' for ? > > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83
Oleg Bartunov wrote: > On Wed, 9 Mar 2005, Jeff Hoffmann wrote: > >> Oleg Bartunov wrote: >> >>> I'm experimenting with pgpool 2.51 on my Linux box runnung >>> two postgresql backends: pg74:5432 and pg801:5433 >>> >>> I configured pgpool to use pg74:5432 as primary backend and >>> pg801:5433 as second one. Pgpool is running on default port (9999) and >>> I configured my web application to use it, so I could start/stop >>> backends >>> without disturbing client (web browser). >>> >>> When I stop primary backend (pg74:5432) pgpool switched to backend >>> failover from (5432) to (5433) done >>> but when I start primary and stopped secondary backend pgpool >>> never switched back to primary backend as expected ! I see bogus >>> message like: >>> starting failover from (5433) to (5433) >>> >>> What I'm doing wrong ? >> >> >> I don't think anything. I could be wrong, but my understanding is >> that if the primary goes down, you have to restart pgpool after >> primary comes back up. It doesn't toggle back and forth from primary >> <-> secondary when necessary, it only goes primary->secondary. I >> played with pgpool for a while and came up with effectively the same >> confused question. > > > Seems, limited functionality. But, then I don't understand > switchover options ([-s {m[aster]|s[econdary]] switch). > What's '-s m switch' for ? That was exactly my question so I sent a message on the pgpool mailing list. I was trying to set up a managed downtime system where I would switch from master to secondary, update the master, switch back to master & update the secondary. My plan was to use the "-s" switch to do that, but I could only switch from master to secondary, I couldn't switch back to master using that switch. I was told that I'd have to restart pgpool to get back to the master, which is effectively what your question was about. I'm assuming the same mechanism is at work in both cases. -- Jeff Hoffmann jeff@propertykey.com
> I'm experimenting with pgpool 2.51 on my Linux box runnung > two postgresql backends: pg74:5432 and pg801:5433 > > I configured pgpool to use pg74:5432 as primary backend and > pg801:5433 as second one. Pgpool is running on default port (9999) and > I configured my web application to use it, so I could start/stop backends > without disturbing client (web browser). > > When I stop primary backend (pg74:5432) pgpool switched to backend > failover from (5432) to (5433) done > but when I start primary and stopped secondary backend pgpool > never switched back to primary backend as expected ! > I see bogus message like: > starting failover from (5433) to (5433) > > What I'm doing wrong ? That's an intended behavior. Or at least a side effect of failover design. If we allow unlimited switching between the master and the secondary, pgpool could repeat switching forever if we have unliable network or hardware. However it would be easy to modify pgpool to allow automatic switch back (with a risk of unwanted repeating switching, of course). Is this what you want? -- Tatsuo Ishii
On Mar 9, 2005, at 7:25 PM, Tatsuo Ishii wrote: > > That's an intended behavior. Or at least a side effect of failover > design. If we allow unlimited switching between the master and the > secondary, pgpool could repeat switching forever if we have unliable > network or hardware. I didn't really think of it that way, I had just expected it to toggle back and forth for some reason. At first I thought it was just me, but apparently Oleg got the same impression as I did. After you explained it, though, it makes sense why someone would want it to work that way. > However it would be easy to modify pgpool to allow automatic switch > back (with a risk of unwanted repeating switching, of course). Is > this what you want? How about making it a switch at run-time? Like "--cycle" for the automatic fail-over toggling. It seems that there are valid reasons for both options. What makes the most sense to me would be to make the "-s" switch always be able to switch to the server specified in the command line or toggle between the two if you don't specify either master or secondary. That way an administrator can always have control or which server is being used & then either leave the automatic behavior as is or create a cycle switch in case the user preferred that behavior. -- Jeff Hoffmann jeff@propertykey.com
On Thu, 10 Mar 2005, Tatsuo Ishii wrote: >> I'm experimenting with pgpool 2.51 on my Linux box runnung >> two postgresql backends: pg74:5432 and pg801:5433 >> >> I configured pgpool to use pg74:5432 as primary backend and >> pg801:5433 as second one. Pgpool is running on default port (9999) and >> I configured my web application to use it, so I could start/stop backends >> without disturbing client (web browser). >> >> When I stop primary backend (pg74:5432) pgpool switched to backend >> failover from (5432) to (5433) done >> but when I start primary and stopped secondary backend pgpool >> never switched back to primary backend as expected ! >> I see bogus message like: >> starting failover from (5433) to (5433) >> >> What I'm doing wrong ? > > That's an intended behavior. Or at least a side effect of failover > design. If we allow unlimited switching between the master and the > secondary, pgpool could repeat switching forever if we have unliable > network or hardware. You may recognize manual action of DBA, that is why '-s m switch' is needed ! > > However it would be easy to modify pgpool to allow automatic switch > back (with a risk of unwanted repeating switching, of course). Is > this what you want? No, your arguments are important. I don't want too much intelligence, but when I restart primary backend by hand I don't see any problem to switch pgpool back using -s m switch (also by hand). For brave, probably, something like --auto would fine. > -- > Tatsuo Ishii > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83
> On Thu, 10 Mar 2005, Tatsuo Ishii wrote: > > >> I'm experimenting with pgpool 2.51 on my Linux box runnung > >> two postgresql backends: pg74:5432 and pg801:5433 > >> > >> I configured pgpool to use pg74:5432 as primary backend and > >> pg801:5433 as second one. Pgpool is running on default port (9999) and > >> I configured my web application to use it, so I could start/stop backends > >> without disturbing client (web browser). > >> > >> When I stop primary backend (pg74:5432) pgpool switched to backend > >> failover from (5432) to (5433) done > >> but when I start primary and stopped secondary backend pgpool > >> never switched back to primary backend as expected ! > >> I see bogus message like: > >> starting failover from (5433) to (5433) > >> > >> What I'm doing wrong ? > > > > That's an intended behavior. Or at least a side effect of failover > > design. If we allow unlimited switching between the master and the > > secondary, pgpool could repeat switching forever if we have unliable > > network or hardware. > > You may recognize manual action of DBA, that is why '-s m switch' is needed ! > > > > > > However it would be easy to modify pgpool to allow automatic switch > > back (with a risk of unwanted repeating switching, of course). Is > > this what you want? > > No, your arguments are important. I don't want too much intelligence, but > when I restart primary backend by hand I don't see any problem to > switch pgpool back using -s m switch (also by hand). For brave, probably, > something like --auto would fine. Problem is, the communication infrastructure between pgpool master process and another pgpool process which you started by hand to switch is very poor. Currently signal is used to tell the pgpool master process to switch/fail over. Apparently we need more info (for example the signal is sent by DBA, not because of a failure detected by a pgpool child process). To fix the problem we need shared memory, pipe, socket or whatever to pass info and it will not be a trivial fix so will take some time... -- Tatsuo Ishii
On Thu, 10 Mar 2005, Tatsuo Ishii wrote: >>> >>> However it would be easy to modify pgpool to allow automatic switch >>> back (with a risk of unwanted repeating switching, of course). Is >>> this what you want? >> >> No, your arguments are important. I don't want too much intelligence, but >> when I restart primary backend by hand I don't see any problem to >> switch pgpool back using -s m switch (also by hand). For brave, probably, >> something like --auto would fine. > > Problem is, the communication infrastructure between pgpool master > process and another pgpool process which you started by hand to switch > is very poor. Currently signal is used to tell the pgpool master > process to switch/fail over. Apparently we need more info (for example > the signal is sent by DBA, not because of a failure detected by a > pgpool child process). > > To fix the problem we need shared memory, pipe, socket or whatever > to pass info and it will not be a trivial fix so will take some > time... may be telnet interface ? > -- > Tatsuo Ishii > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83