[pgpool-general: 3051] Re: failover issue
rmichael at edgeofthenet.org
Thu Jul 24 05:56:19 JST 2014
On Wed, Jul 23, 2014 at 3:41 PM, <jayknowsunix at gmail.com> wrote:
> My original version was a failover.sh script and it was calling "service PostgreSQL-9.3 restart" the problem is that restart requires root for the service command or "sudo" which won't work due a "needs a tty error". I've implemented per your suggestion a pg_ctl as that runs as Postgres. Thanks for the suggestion! It's now working perfectly.
Read up on sudo. In particular, you'll need "!requiretty", and I'd
probably define a command alias too.
Cmnd_Alias RESTART_POSTGRES = /sbin/service postgresql-9.3 restart
postgres ALL = NOPASSWD: RESTART_POSTGRES
Note your wrapper command must match the sudo specification *exactly*.
sudo /sbin/service postgresql-9.3 restart
We're drifting a bit far from list topic, I think. :-)
> Sent from my iPad
>> On Jul 23, 2014, at 2:49 PM, Richard Michael <rmichael at edgeofthenet.org> wrote:
>> Use "pg_ctl restart", you may need "pg_ctl -D $YOUR_PGDATA_DIR
>> restart" ; depending how your system is configured (e.g., if the
>> cluster you're restarting is not in the default location).
>> Also, consult "man pg_ctl" and check if any other options apply to
>> your configuration (timeout, restart type, etc.). Though, I suspect
>> the default invocation I mentioned will be sufficient.
>> Alternatively, write a tiny wrapper to use as the "failover_command",
>> and have that wrapper do something like: "sudo service postgresql-9.3
>> restart" (after adding an appropriate sudo rule).
>> Hope this helps,
>>> On Wed, Jul 23, 2014 at 11:44 AM, John Scalia <jayknowsunix at gmail.com> wrote:
>>> By my understanding, when a change is made in the recovery.conf file, then
>>> it is necessary to restart postgresql. So, with 2 different standby servers
>>> and the failure of the primary, the first standby gets promoted to master
>>> and the second standby must have the primary_conninfo changed to point to
>>> the new master. From what I've found online, this change will not be read in
>>> with only a reload.
>>> But, as the failover_command is run with the postgres userid, you cannot, on
>>> Linux, use a "service postgresql-9.3 restart" as that requires root, but
>>> could I use pg_ctl to force a reload without becoming root? If so, what
>>> would the pg_ctl command look like?
>>> pgpool-general mailing list
>>> pgpool-general at pgpool.net
More information about the pgpool-general