pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
postgres not deleting trigger file
5+ messages / 3 participants
[nested] [flat]

* postgres not deleting trigger file
@ 2015-08-04 12:46 jkilborn <jim.kilborn@swri.org>
  2015-08-04 13:22 ` Re: postgres not deleting trigger file John Scalia <jayknowsunix@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: jkilborn @ 2015-08-04 12:46 UTC (permalink / raw)
  To: pgsql-admin

Im using postgres 9.4 with pgpool-II-94 and have streaming resplication setup
between two db servers. When I fail the primary db, pgpool creates the
/tmp/trigger_file, and the secondary server becomes the primary and is put
in read/write mode. However, the trigger file doesnt get deleted. I am not
sure where to debug why the trigger file doesnt get removed.

I have even tried using a recover_end_command to remove the trigger file,
but that doesnt seem to happen.

my failover script for pgpool creates the trigger file, then set it to chmod
777 so that postgres user can remove it. pgpool runs as root, while postgres
runs as postgres user.

Any ideas where to look on this issue of trigger file not being removed?





--
View this message in context: http://postgresql.nabble.com/postgres-not-deleting-trigger-file-tp5860795.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: postgres not deleting trigger file
  2015-08-04 12:46 postgres not deleting trigger file jkilborn <jim.kilborn@swri.org>
@ 2015-08-04 13:22 ` John Scalia <jayknowsunix@gmail.com>
  2015-08-04 13:28   ` Re: postgres not deleting trigger file jkilborn <jim.kilborn@swri.org>
  0 siblings, 1 reply; 5+ messages in thread

From: John Scalia @ 2015-08-04 13:22 UTC (permalink / raw)
  To: jkilborn <jim.kilborn@swri.org>; +Cc: pgsql-admin

Are either the pgpool or postgresql logs telling you anything about this?
Usually, at least I think so, PostgreSQL is responsible for removing the
trigger file. I'll tell you, though, I haven't tried this type of scenario
since PostgreSQL 9.3.6.
--
Jay

On Tue, Aug 4, 2015 at 7:46 AM, jkilborn <jim.kilborn@swri.org> wrote:

> Im using postgres 9.4 with pgpool-II-94 and have streaming resplication
> setup
> between two db servers. When I fail the primary db, pgpool creates the
> /tmp/trigger_file, and the secondary server becomes the primary and is put
> in read/write mode. However, the trigger file doesnt get deleted. I am not
> sure where to debug why the trigger file doesnt get removed.
>
> I have even tried using a recover_end_command to remove the trigger file,
> but that doesnt seem to happen.
>
> my failover script for pgpool creates the trigger file, then set it to
> chmod
> 777 so that postgres user can remove it. pgpool runs as root, while
> postgres
> runs as postgres user.
>
> Any ideas where to look on this issue of trigger file not being removed?
>
>
>
>
>
> --
> View this message in context:
> http://postgresql.nabble.com/postgres-not-deleting-trigger-file-tp5860795.html
> Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: postgres not deleting trigger file
  2015-08-04 12:46 postgres not deleting trigger file jkilborn <jim.kilborn@swri.org>
  2015-08-04 13:22 ` Re: postgres not deleting trigger file John Scalia <jayknowsunix@gmail.com>
@ 2015-08-04 13:28   ` jkilborn <jim.kilborn@swri.org>
  2015-08-04 13:46     ` Re: postgres not deleting trigger file John Scalia <jayknowsunix@gmail.com>
  2015-08-04 15:54     ` Re: postgres not deleting trigger file Jerry Sievers <gsievers19@comcast.net>
  0 siblings, 2 replies; 5+ messages in thread

From: jkilborn @ 2015-08-04 13:28 UTC (permalink / raw)
  To: pgsql-admin

Thanks for the reply. 

I think the problem is permissions. The fact that the pgpool runs as root
user, its likely that postgres can’t remove the created trigger file.

I ended up doing two things in my pgp failover_stream.sh script, which
creates the file:
/bin/ssh -T $new_master /bin/touch $trigger_file
	/bin/ssh -T $new_master chown postgres $trigger_file

Seems with changing the ownership of the trigger file, postgres can now
delete the file. Not sure why I’m having to do this, as I haven’t seen
anyone else encounter this issue.

Anyway, with these changes, it appears to be working correctly.

Thanks for the response.

-Jim




--
View this message in context: http://postgresql.nabble.com/postgres-not-deleting-trigger-file-tp5860795p5860802.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: postgres not deleting trigger file
  2015-08-04 12:46 postgres not deleting trigger file jkilborn <jim.kilborn@swri.org>
  2015-08-04 13:22 ` Re: postgres not deleting trigger file John Scalia <jayknowsunix@gmail.com>
  2015-08-04 13:28   ` Re: postgres not deleting trigger file jkilborn <jim.kilborn@swri.org>
@ 2015-08-04 13:46     ` John Scalia <jayknowsunix@gmail.com>
  1 sibling, 0 replies; 5+ messages in thread

From: John Scalia @ 2015-08-04 13:46 UTC (permalink / raw)
  To: jkilborn <jim.kilborn@swri.org>; +Cc: pgsql-admin

Well, in the past I've always had pgpool-II running as the postgres user,
not root. That's probably why I didn't see any issues at the time. Good
luck with this.

On Tue, Aug 4, 2015 at 8:28 AM, jkilborn <jim.kilborn@swri.org> wrote:

> Thanks for the reply.
>
> I think the problem is permissions. The fact that the pgpool runs as root
> user, its likely that postgres can’t remove the created trigger file.
>
> I ended up doing two things in my pgp failover_stream.sh script, which
> creates the file:
> /bin/ssh -T $new_master /bin/touch $trigger_file
>         /bin/ssh -T $new_master chown postgres $trigger_file
>
> Seems with changing the ownership of the trigger file, postgres can now
> delete the file. Not sure why I’m having to do this, as I haven’t seen
> anyone else encounter this issue.
>
> Anyway, with these changes, it appears to be working correctly.
>
> Thanks for the response.
>
> -Jim
>
>
>
>
> --
> View this message in context:
> http://postgresql.nabble.com/postgres-not-deleting-trigger-file-tp5860795p5860802.html
> Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: postgres not deleting trigger file
  2015-08-04 12:46 postgres not deleting trigger file jkilborn <jim.kilborn@swri.org>
  2015-08-04 13:22 ` Re: postgres not deleting trigger file John Scalia <jayknowsunix@gmail.com>
  2015-08-04 13:28   ` Re: postgres not deleting trigger file jkilborn <jim.kilborn@swri.org>
@ 2015-08-04 15:54     ` Jerry Sievers <gsievers19@comcast.net>
  1 sibling, 0 replies; 5+ messages in thread

From: Jerry Sievers @ 2015-08-04 15:54 UTC (permalink / raw)
  To: jkilborn <jim.kilborn@swri.org>; +Cc: pgsql-admin

jkilborn <jim.kilborn@swri.org> writes:

> Thanks for the reply. 
>
> I think the problem is permissions. The fact that the pgpool runs as root
> user, its likely that postgres can’t remove the created trigger file.

Right /tmp usually has sticky bit set and thus though the directory is
world writeable,  one user can't remove a file owned by another as is
the case here.

And IMO having trigger file be in tmp isn't a great idea since anyone on
the box could create the file and have your standby server come out of recovery.

> I ended up doing two things in my pgp failover_stream.sh script, which
> creates the file:
> /bin/ssh -T $new_master /bin/touch $trigger_file
> 	/bin/ssh -T $new_master chown postgres $trigger_file
>
> Seems with changing the ownership of the trigger file, postgres can now
> delete the file. Not sure why I’m having to do this, as I haven’t seen
> anyone else encounter this issue.
>
> Anyway, with these changes, it appears to be working correctly.
>
> Thanks for the response.
>
> -Jim
>
>
>
>
> --
> View this message in context: http://postgresql.nabble.com/postgres-not-deleting-trigger-file-tp5860795p5860802.html
> Sent from the PostgreSQL - admin mailing list archive at Nabble.com.

-- 
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 312.241.7800


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2015-08-04 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-08-04 12:46 postgres not deleting trigger file jkilborn <jim.kilborn@swri.org>
2015-08-04 13:22 ` John Scalia <jayknowsunix@gmail.com>
2015-08-04 13:28   ` jkilborn <jim.kilborn@swri.org>
2015-08-04 13:46     ` John Scalia <jayknowsunix@gmail.com>
2015-08-04 15:54     ` Jerry Sievers <gsievers19@comcast.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox